diff options
Diffstat (limited to 'contrib/binutils/bfd')
186 files changed, 42529 insertions, 19860 deletions
diff --git a/contrib/binutils/bfd/ChangeLog b/contrib/binutils/bfd/ChangeLog index 5bb5bb2a6009..e006595f969e 100644 --- a/contrib/binutils/bfd/ChangeLog +++ b/contrib/binutils/bfd/ChangeLog @@ -1,1359 +1,1788 @@ -2006-12-11 Eric Botcazou <ebotcazou@adacore.com> +2007-07-02 Joseph Myers <joseph@codesourcery.com> - * elflink.c (bfd_elf_gc_sections): Also search for corresponding - sections with .gnu.linkonce.t. prefix. + * elfxx-mips.c (mips_elf_calculate_relocation): Handle + R_MIPS_TLS_DTPREL32 and R_MIPS_TLS_DTPREL64. + * elf64-mips.c (mips_elf64_howto_table_rela): Support + R_MIPS_TLS_DTPREL64. -2006-08-08 Nick Clifton <nickc@redhat.com> +2007-07-02 Alan Modra <amodra@bigpond.net.au> - PR binutils/2724 - * coffcode.h (coff_new_section_hook): Only modify the section - symbol of sections which were created by the user. + * Makefile.am: Run "make dep-am". + * Makefile.in: Regenerate. + * aclocal.m4: Regenerate. + * config.in: Regenerate. + * po/SRC-POTFILES.in: Regenerate. + * po/bfd.pot: Regenerate. + +2007-07-02 Alan Modra <amodra@bigpond.net.au> + + * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Tidy + symsec != NULL tests. + +2007-07-02 Alan Modra <amodra@bigpond.net.au> + + PR 4712 + * elf.c (assign_file_positions_for_load_sections): Adjust lma + by p_vaddr_offset. + +2007-06-30 H.J. Lu <hongjiu.lu@intel.com> + + * aclocal.m4: Regenerated. + * Makefile.in: Likewise. + +2007-06-29 Joseph Myers <joseph@codesourcery.com> + + * elf32-ppc.c (ppc_elf_merge_obj_attributes): New. + (ppc_elf_merge_private_bfd_data): Call it. + +2007-06-29 Joseph Myers <joseph@codesourcery.com> + + * elfxx-mips.c (mips_elf_merge_obj_attributes): New. + (_bfd_mips_elf_merge_private_bfd_data): Call it. + +2007-06-29 Joseph Myers <joseph@codesourcery.com> + + * elf-attrs.c: New. + * Makefile.am (BFD32_BACKENDS): Add elf-attrs.lo. + (BFD32_BACKENDS_CFILES): Add elf-attrs.c. + (elf-attrs.lo): Generate dependencies. + * Makefile.in: Regenerate. + * configure.in (elf): Add elf-attrs.lo. + * configure: Regenerate. + * elf-bfd.h (struct elf_backend_data): Add entries for object + attributes. + (NUM_KNOWN_OBJ_ATTRIBUTES, obj_attribute, obj_attribute_list, + OBJ_ATTR_PROC, OBJ_ATTR_GNU, OBJ_ATTR_FIRST, OBJ_ATTR_LAST, + Tag_NULL, Tag_File, Tag_Section, Tag_Symbol, Tag_compatibility): + New. + (struct elf_obj_tdata): Add entries for object attributes. + (elf_known_obj_attributes, elf_other_obj_attributes, + elf_known_obj_attributes_proc, elf_other_obj_attributes_proc): + New. + (bfd_elf_obj_attr_size, bfd_elf_set_obj_attr_contents, + bfd_elf_get_obj_attr_int, bfd_elf_add_obj_attr_int, + bfd_elf_add_proc_attr_int, bfd_elf_add_obj_attr_string, + bfd_elf_add_proc_attr_string, bfd_elf_add_obj_attr_compat, + bfd_elf_add_proc_attr_compat, _bfd_elf_attr_strdup, + _bfd_elf_copy_obj_attributes, _bfd_elf_obj_attrs_arg_type, + _bfd_elf_parse_attributes, _bfd_elf_merge_object_attributes): New. + * elf.c (_bfd_elf_copy_private_bfd_data): Copy object attributes. + (bfd_section_from_shdr): Handle attributes sections. + * elflink.c (bfd_elf_final_link): Handle attributes sections. + * elfxx-target.h (elf_backend_obj_attrs_vendor, + elf_backend_obj_attrs_section, elf_backend_obj_attrs_arg_type, + elf_backend_obj_attrs_section_type): New. + (elfNN_bed): Update. + * elf32-arm.c (NUM_KNOWN_ATTRIBUTES, aeabi_attribute, + aeabi_attribute_list): Remove. + (struct elf32_arm_obj_tdata): Remove object attributes fields. + (check_use_blx, bfd_elf32_arm_set_vfp11_fix, using_thumb2, + elf32_arm_copy_private_bfd_data, elf32_arm_merge_eabi_attributes): + Update for new object attributes interfaces. + (uleb128_size, is_default_attr, eabi_attr_size, + elf32_arm_eabi_attr_size, write_uleb128, write_eabi_attribute, + elf32_arm_set_eabi_attr_contents, elf32_arm_bfd_final_link, + elf32_arm_new_eabi_attr, elf32_arm_get_eabi_attr_int, + elf32_arm_add_eabi_attr_int, attr_strdup, + elf32_arm_add_eabi_attr_string, elf32_arm_add_eabi_attr_compat, + copy_eabi_attributes, elf32_arm_parse_attributes): Remove. Moved + to generic code in elf-attrs.c. + (elf32_arm_obj_attrs_arg_type): New. + (elf32_arm_fake_sections): Do not handle .ARM.attributes. + (elf32_arm_section_from_shdr): Do not handle SHT_ARM_ATTRIBUTES. + (bfd_elf32_bfd_final_link): Remove. + (elf_backend_obj_attrs_vendor, elf_backend_obj_attrs_section, + elf_backend_obj_attrs_arg_type, + elf_backend_obj_attrs_section_type): New. + * elf32-bfin.c (bfin_elf_copy_private_bfd_data): Copy object + attributes. + * elf32-frv.c (frv_elf_copy_private_bfd_data): Likewise. + * elf32-iq2000.c (iq2000_elf_copy_private_bfd_data): Likewise. + * elf32-mep.c (mep_elf_copy_private_bfd_data): Likewise. + * elf32-mt.c (mt_elf_copy_private_bfd_data): Likewise. + * elf32-sh.c (sh_elf_copy_private_data): Likewise. + * elf64-sh64.c (sh_elf64_copy_private_data_internal): Likewise. + +2007-06-29 Paul Brook <paul@codesourcery.com> + + * elf32-arm.c (bfd_elf32_arm_process_before_allocation): Suppress + call veneers for call relocations against undefined symbols. + (elf32_arm_final_link_relocate): Turn call to undefined symbol + into a jump to the next instruction. + +2007-06-29 Michael Snyder <msnyder@svkmacdonelllnx> + + * bfd.c (bfd_demangle): Plug memory leak (Coverity). + +2007-06-29 M R Swami Reddy <MR.Swami.Reddy@nsc.com> + + * Makefile.am: Add cr16 related entry + * Makefile.in: Regenerate + * archures.c: Add bfd_cr16_arch + * bfd-in2.h: Regenerate + * config.bfd: Add cr16-elf + * configure.in: Add bfd_elf32_cr16_vec + * configure: Regenerate. + * targets.c: Added cr16 related information + * cpu-cr16.c: New file. + * elf32-cr16.c: New file. + * reloc.c: Added cr16 relocs. + +2007-06-29 Alan Modra <amodra@bigpond.net.au> + + * elflink.c (_bfd_elf_link_assign_sym_version): Improve error + message for undefined version nodes. + (elf_gc_sweep): Don't warn when zero size sections are + removed. + +2007-06-29 Nathan Froyd <froydnj@codesourcery.com> + + * elf32-ppc.c (ppc_elf_info_to_howto): Check for invalid relocation + types. + +2007-06-29 Alan Modra <amodra@bigpond.net.au> + + * elf32-spu.c (spu_elf_fake_sections): New function. + (elf_backend_fake_sections): Define. + +2007-06-29 Alan Modra <amodra@bigpond.net.au> + + * elf.c (assign_file_positions_for_load_sections): Use elf + section header sh_size rather than bfd section size, simplifying + .tbss handling. + +2007-06-29 Alan Modra <amodra@bigpond.net.au> + + PR ld/4701 + * elf.c (assign_file_positions_for_load_sections): Ensure bss + segments meet gABI alignment requirements. Don't allocate + file space for bss sections in a segment also containing file + or program headers. -2006-07-19 Alan Modra <amodra@bigpond.net.au> +2007-06-27 Alan Modra <amodra@bigpond.net.au> - * bfd-in.h (enum notice_asneeded_action): Define. + * bfd.c (struct bfd): Rename "next" to "archive_next". + * archive.c: Rename uses throughout file. + * archive64.c: Likewise. + * coff-rs6000.c: Likewise. + * ecoff.c: Likewise. + * som.c: Likewise. * bfd-in2.h: Regenerate. - * elflink.c (elf_link_add_object_symbols): Call linker "notice" - function with NULL name for as-needed handling. -2006-07-12 Matthew R. Dempsky <mrd@alkemio.org> + * elf32-ppc.c (ppc_elf_select_plt_layout): Properly iterate over + input bfds. + * elf32-spu.c (spu_elf_create_sections): Likewise. + +2007-06-26 H.J. Lu <hongjiu.lu@intel.com> + + * dwarf2.c (find_line): New. Contains the duplicated code from: + (_bfd_dwarf2_find_nearest_line): Use it. + (_bfd_dwarf2_find_line): Use it. + +2007-06-26 Joseph Myers <joseph@codesourcery.com> + + * elf32-arm.c (copy_eabi_attributes): Copy type of attributes. + +2007-06-25 Richard Sandiford <richard@codesourcery.com> + + * elfxx-mips.c (mips_elf_calculate_relocation): Allow local stubs + to be used for calls from MIPS16 code. + +2007-06-23 Andreas Schwab <schwab@suse.de> + + * configure.in (--with-separate-debug-dir): New option. + * configure: Regenerate. + * Makefile.am (dwarf2.lo): Add rule to pass DEBUGDIR. + * Makefile.in: Regenerate. + * dwarf2.c (_bfd_dwarf2_find_nearest_line): Pass DEBUGDIR to + bfd_follow_gnu_debuglink. + (_bfd_dwarf2_find_line): Likewise. + +2007-06-22 Nick Clifton <nickc@redhat.com> + + * dwarf2.c: Add support for reading in debug information via a + .gnu_debuglink section: + (struct dwarf2_debug): Add bfd field to record the bfd containing + the debug info. + (parse_comp_unit): Remove ABFD parameter. Instead use the bfd + field in the dwarf2_debug structure. + (_bfd_dwarf2_find_nearest_line): If a debug info section could not + be found in the current bfd call bfd_follow_gnu_debuglink to see + if another file contains the debug information. If it does, open + it and continue. + (_bfd_dwarf2_find_line): Likewise. + +2007-06-19 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/4590 + * elfxx-ia64.c (sort_dyn_sym_info): Keep the valid got_offset + when removing duplicated entries. + (get_dyn_sym_info): Initialize the got_offset field to -1. + Update call to sort_dyn_sym_info. + (elfNN_ia64_relocate_section): Call sort_dyn_sym_info to sort + array of addend and remove duplicates. + +2007-06-18 H.J. Lu <hongjiu.lu@intel.com> + + * libpei.h (_bfd_XXi_final_link_postscript): Remove + duplication. + (bfd_target_pei_p): New. + (bfd_target_pei_arch): New + (bfd_target_efi_p): Likewise. + (bfd_target_efi_arch): New + (bfd_pe_executable_p): Use bfd_target_pei_p and + bfd_target_efi_p. + + * peicode.h (arch_type): New enum. + (pe_arch): New function. + (pe_bfd_object_p): Don't match PE/EFI target with EFI/PE file + if there is an EFI/PE target. + +2007-06-14 H.J. Lu <hongjiu.lu@intel.com> - * cpu-m68k.c (bfd_m68k_compatible): Handle CPU32. + * Makefile.am (ACLOCAL_AMFLAGS): Add -I . -I ../config. -2006-06-23 Daniel Jacobowitz <dan@codesourcery.com> + * acinclude.m4: Don't include m4 files. Remove libtool + kludge. - * Makefile.am: Clear RELEASE. * Makefile.in: Regenerated. + * aclocal.m4: Likewise. + * configure: Likewise. -2006-06-23 Daniel Jacobowitz <dan@codesourcery.com> +2007-06-11 Sterling Augustine <sterling@tensilica.com> + Bob Wilson <bob.wilson@acm.org> - * configure.in: Update version to 2.17. - * Makefile.am: Set RELEASE. - * configure, Makefile.in: Regenerated. + * elf32-xtensa.c (extend_ebb_bounds_forward): Use renamed + XTENSA_PROP_NO_TRANSFORM flag instead of XTENSA_PROP_INSN_NO_TRANSFORM. + (extend_ebb_bounds_backward, compute_text_actions): Likewise. + (compute_ebb_proposed_actions, coalesce_shared_literal): Likewise. + (xtensa_get_property_predef_flags): Likewise. + (compute_removed_literals): Pass new arguments to is_removable_literal. + (is_removable_literal): Add sec, prop_table and ptblsize arguments. + Do not remove literal if the NO_TRANSFORM property flag is set. -2006-06-12 Daniel Jacobowitz <dan@codesourcery.com> +2007-05-31 Richard Sandiford <rsandifo@nildram.co.uk> - * configure.in: Update version to 2.16.94. - * configure: Regenerated. + * elfxx-mips.c (mips_elf_initialize_tls_index): When processing a + type (3) single-GOT entry, read tls_type from the hash table entry + rather than the GOT entry. -2006-06-11 Richard Sandiford <richard@codesourcery.com> - Thiemo Seufer <ths@mips.com> - - * elfxx-mips.c (mips_elf_link_hash_table): Add function_stub_size. - (STUB_ORI): New macro. - (STUB_LI16U): Fix formatting. - (MIPS_FUNCTION_STUB_SIZE): Delete. - (MIPS_FUNCTION_STUB_MAX_SIZE): Likewise. - (MIPS_FUNCTION_STUB_NORMAL_SIZE): New macro. - (MIPS_FUNCTION_STUB_BIG_SIZE): Likewise. - (_bfd_mips_elf_adjust_dynamic_symbol): Use htab->function_stub_size - instead of MIPS_FUNCTION_STUB_SIZE. - (count_section_dynsyms): New function, split out from - _bfd_mips_elf_final_link. - (_bfd_mips_elf_always_size_sections): Get a worst-case estimate - of the number of dynamic symbols needed and use it to set up - function_stub_size. Use function_stub_size rather than - MIPS_FUNCTION_STUB_SIZE to determine the size of the stub section. - Use 16-byte stubs for 0x10000 dynamic symbols. - (_bfd_mips_elf_size_dynamic_sections): Use htab->function_stub_size - instead of MIPS_FUNCTION_STUB_SIZE. Fix formatting. - (_bfd_mips_elf_finish_dynamic_symbol): Likewise. Change the - size of the stub buffer from MIPS_FUNCTION_STUB_MAX_SIZE to - MIPS_FUNCTION_STUB_BIG_SIZE. Tweak the check for unhandled dynindxes. - Use MIPS_FUNCTION_STUB_BIG_SIZE rather than a hard-coded 20. - Use STUB_ORI rather than STUB_LI16U for big stubs. - (_bfd_mips_elf_link_hash_table_create): Initialize function_stub_size. - (_bfd_mips_elf_final_link): Use count_section_dynsyms. - -2006-06-08 David Daney <ddaney@avtrex.com> - - * elfxx-mips.c (STUB_LI16): Removed. - (STUB_LUI): New macro. - (STUB_LI16U): Ditto. - (STUB_LI16S): Ditto. - (MIPS_FUNCTION_STUB_SIZE): Rewrote to take info parameter. - (_bfd_mips_elf_adjust_dynamic_symbol): Pass info parameter to - MIPS_FUNCTION_STUB_SIZE. - (_bfd_mips_elf_always_size_sections): Ditto. - (_bfd_mips_elf_size_dynamic_sections): Ditto. - (_bfd_mips_elf_finish_dynamic_sections): Ditto. - (_bfd_mips_elf_finish_dynamic_symbol): Rewrote stub generation - to allow larger symbol table indexes. - -2006-06-07 Joseph S. Myers <joseph@codesourcery.com> - - * po/Make-in (pdf, ps): New dummy targets. - -2006-06-01 Daniel Jacobowitz <dan@codesourcery.com> - - Backport: - 2006-05-23 H.J. Lu <hongjiu.lu@intel.com> - PR ld/2655 - PR ld/2657 - * elf-eh-frame.c (_bfd_elf_write_section_eh_frame): Properly - update CIE/FDE length. Don't pad to the section alignment. - -2006-05-30 Nick Clifton <nickc@redhat.com> - - * po/es.po: Updated Spanish translation. - -2006-05-23 Alan Modra <amodra@bigpond.net.au> - - * elf64-ppc.c (compare_symbols): Prefer strong dynamic global - function syms over other syms. - -2006-05-22 Daniel Jacobowitz <dan@codesourcery.com> - - * elflink.c (_bfd_elf_add_dynamic_entry): Remove DT_TEXTREL - check. - (bfd_elf_final_link): Add a late DT_TEXTREL check. - * elfxx-mips.c (MIPS_ELF_READONLY_SECTION): Define. - (mips_elf_create_dynamic_relocation): Set DF_TEXTREL. - (_bfd_mips_elf_check_relocs): Delete MIPS_READONLY_SECTION. - Use MIPS_ELF_READONLY_SECTION. - (_bfd_mips_elf_size_dynamic_sections): Clear DF_TEXTREL after - creating DT_TEXTREL. - (_bfd_mips_elf_finish_dynamic_sections): Clear textrel markers - if no text relocations were generated. - -2006-05-17 Daniel Jacobowitz <dan@codesourcery.com> - - * configure.in: Update version to 2.16.93. - * configure: Regenerated. +2007-06-01 Alan Modra <amodra@bigpond.net.au> -2006-05-17 Alan Modra <amodra@bigpond.net.au> + * simple.c (bfd_simple_get_relocated_section_contents): Init + input_bfds_tail. - * elflink.c (elf_gc_sweep): Don't specially keep non-alloc, - non-load sections if they have relocs. +2007-05-30 Alan Modra <amodra@bigpond.net.au> -2006-05-16 Andreas Schwab <schwab@suse.de> + * elf.c (elf_fake_sections): Adjust test for SHT_NOBITS sections + created by objcopy --only-keep-debug. + (_bfd_elf_init_private_section_data): Only change elf_section_type + if it is SHT_NULL. - * aoutf1.h (struct external_sparc_core): Declare c_regs as struct - regs instead of an array of int. - (struct external_solaris_bcp_core): Likewise. - (swapcore_sun3): Use offsetof instead of computing the offset - manually. - (swapcore_sparc): Likewise. Simplify reference to c_regs. - (swapcore_solaris_bcp): Likewise. + * elf.c (assign_file_positions_for_load_sections): Correct sh_type + to SHT_NOBITS earlier. Base actions in rest of function on sh_type + and sh_flags instead of bfd section flags. Delete voff and code + keeping nobits segments aligned. -2006-05-15 Alan Modra <amodra@bigpond.net.au> +2007-05-25 Eric Christopher <echristo@apple.com> - PR 2658 - * elf32-ppc.c (ppc_elf_relax_section): Don't segfault on non-pic - -shared link. + * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): + Check that sym_sec isn't NULL before accessing. -2006-05-11 Michael Matz <matz@suse.de> +2007-05-24 Steve Ellcey <sje@cup.hp.com> - * elflink.c (match_group_member): Correctly iterate group - members. + * Makefile.in: Regnerate. + * configure: Regenerate. + * aclocal.m4: Regenerate. + * doc/Makefile.in: Regenerate. -2006-05-11 Nick Clifton <nickc@redhat.com> +2007-05-22 Paul Brook <paul@codesourcery.com> - PR ld/2607 - * elfcode.h (valid_section_index_p): New function: Checks for a - valid section index. Allows indicies in the range SHN_LOPROC to - SHN_HIOS. - (elf_object_p): Use valid_section_index_p. + * elf32-arm.c (output_arch_syminfo): Replace plt_shndx and plt_offset + with sec and sec_shndx. + (elf32_arm_ouput_plt_map_sym): Use them. + (elf32_arm_output_arch_local_syms): Output mapping symbols for + interworking glue. -2006-05-11 Nick Clifton <nickc@redhat.com> +2007-05-18 Paul Brook <paul@codesourcery.com> - PR ld/2257 - * elfcode.h (elf_object_p): Allow files with corrupt e_shstrndx - fields to still be handled as ELF files. + * elf32-arm.c (ARM2THUMB_V5_STATIC_GLUE_SIZE): Define. + (a2t1v5_ldr_insn, a2t1v5_ldr_insn): New. + (record_arm_to_thumb_glue): Add v5t non-pic glue. + (elf32_arm_create_thumb_stub): Ditto. -2006-05-10 Alan Modra <amodra@bigpond.net.au> +2007-05-16 H.J. Lu <hongjiu.lu@intel.com> + Alan Modra <amodra@bigpond.net.au> - PR 2342 - * elflink.c (_bfd_elf_default_action_discarded): Revert 2006-02-16. + * elflink.c (_bfd_elf_adjust_dynamic_copy): Align dynamic bss + section to the minimum alignment. -2006-05-10 Alan Modra <amodra@bigpond.net.au> +2007-05-15 H.J. Lu <hongjiu.lu@intel.com> + Alan Modra <amodra@bigpond.net.au> - * elf64-ppc.c (ppc64_elf_tls_optimize): Only optimize - R_PPC64_TPREL64 and R_PPC64_DTPMOD64 relocs when they are in - the .toc and referenced by a TLS code sequence. - (ppc64_elf_edit_toc): Cater for the unlikely situation that - .toc is the first section in a file. + PR ld/4504 + * elf-bfd.h (_bfd_elf_adjust_dynamic_copy): New. + * elflink.c (_bfd_elf_adjust_dynamic_copy): New. + + * elf-m10300.c (_bfd_mn10300_elf_adjust_dynamic_symbol): Call + _bfd_elf_adjust_dynamic_copy to adjust for the copy in dynamic + bss section. + * elf32-arm.c (elf32_arm_adjust_dynamic_symbol): Likewise. + * elf32-cris.c (elf_cris_adjust_dynamic_symbol): Likewise. + * elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Likewise. + * elf32-i370.c (i370_elf_adjust_dynamic_symbol): Likewise. + * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Likewise. + * elf32-m32r.c (m32r_elf_adjust_dynamic_symbol): Likewise. + * elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise. + * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Likewise. + * elf32-s390.c (elf_s390_adjust_dynamic_symbol): Likewise. + * elf32-sh.c (sh_elf_adjust_dynamic_symbol): Likewise. + * elf32-vax.c (elf_vax_adjust_dynamic_symbol): Likewise. + * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise. + * elf64-s390.c (elf_s390_adjust_dynamic_symbol): Likewise. + * elf64-sh64.c (sh64_elf64_adjust_dynamic_symbol): Likewise. + * elf64-x86-64.c (elf64_x86_64_adjust_dynamic_symbol): Likewise. + * elfxx-mips.c (_bfd_mips_vxworks_adjust_dynamic_symbol): Likewise. + * elfxx-sparc.c (_bfd_sparc_elf_adjust_dynamic_symbol): Likewise. + +2007-05-15 Richard Sandiford <richard@codesourcery.com> + + * elfxx-mips.c (mips_elf_create_local_got_entry): Remove + input_section argument. Create .rela.dyn relocations against + symbol 0 rather than the section symbol. + (mips_elf_local_got_index): Remove input_section argument. + Update call to mips_elf_create_local_got_entry. + (mips_elf_got_page, mips_elf_got16_entry): Likewise. + (mips_elf_calculate_relocation): Update calls to + mips_elf_local_got_index, mips_elf_got16_entry and mips_elf_got_page. + +2007-05-15 Mark Shinwell <shinwell@codesourcery.com> + + * elf32-arm.c (elf32_arm_final_link_relocate): Correctly + handle the Thumb-2 JUMP19 relocation. + +2007-05-15 Alan Modra <amodra@bigpond.net.au> + + PR 4479 + * elf.c (elf_fake_sections): Don't allow backend to change + SHT_NOBITS if called for strip/objcopy --only-keep-debug. + * elfxx-mips.c (_bfd_mips_elf_fake_sections): Remove similar + fix from here. + +2007-05-14 Alan Modra <amodra@bigpond.net.au> + + * elf.c (bfd_elf_string_from_elf_section): Return NULL on + invalid shstrndx. + (bfd_elf_get_str_section): Likewise. + +2007-05-12 Alan Modra <amodra@bigpond.net.au> + + PR 4497 + * elf-eh-frame.c (struct cie): Add "local_personality". Make + "personality" a union. + (cie_eq): Compare local_personality too. Adjust personality + comparison. + (_bfd_elf_discard_section_eh_frame): Check binding on personality + reloc sym to allow for bad symtab. Use stashed local syms rather + than reading personality local sym. Handle discarded sections. + +2007-05-12 Alan Modra <amodra@bigpond.net.au> + + * elf32-spu.c (elf_howto_table): Add howto for R_SPU_ADDR16X. + +2007-05-11 Alan Modra <amodra@bigpond.net.au> + + * elf32-ppc.h (ppc_elf_select_plt_layout): Update prototype. + (enum ppc_elf_plt_type): Move from.. + * elf32-ppc.c: ..here. + (struct ppc_elf_obj_tdata): Add makes_plt_call and has_rel16. + (struct ppc_elf_link_hash_table): Reorder. Add old_bfd. Delete + can_use_new_plt. Make is_vxworks a bitfield. + (ppc_elf_link_hash_table_create): Don't clear is_vxworks (again). + (ppc_elf_check_relocs): Update setting of reloc flags. Set old_bfd. + (ppc_elf_select_plt_layout): Modify parameters. Use bfd reloc + flags to better detect object files needing old bss-style plt. + Allow secure plt to be used without rel16 relocs being detected. + Warn if secure plt request cannot be allowed. + +2007-05-11 Alan Modra <amodra@bigpond.net.au> + + * reloc.c (BFD_RELOC_SPU_PPU32, BFD_RELOC_SPU_PPU64): Define. + * elf-bfd.h (struct elf_backend_data): Change return type of + elf_backend_relocate_section to int. + * elf32-spu.c (elf_howto_table): Add howtos for R_SPU_PPU32 and + R_SPU_PPU64. + (spu_elf_bfd_to_reloc_type): Convert new relocs. + (spu_elf_count_relocs): New function. + (elf_backend_count_relocs): Define. + (spu_elf_relocate_section): Arrange to emit R_SPU_PPU32 and + R_SPU_PPU64 relocs. + * elflink.c (elf_link_input_bfd): Emit relocs if relocate_section + returns 2. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. -2006-05-03 Kaz Kojima <kkojima@rr.iij4u.or.jp> +2007-05-10 Richard Sandiford <richard@codesourcery.com> - PR binutils/2584 - * tekhex.c (getvalue): Change return type to bfd_boolean and - add the new parameter. Return false if the unexpected character - is found. - (getsym): Likewise. - (first_phase): Change return type to bfd_boolean and return - false if the unexpected character is found. Replace abort - with returning false. - (pass_over): Change return type to bfd_boolean and the type of - the second argument to bfd_boolean (*) (bfd *, int, char *). - Return false if FUNC returns false. - (tekhex_object_p): Return NULL if pass_over fails. + * elf32-arm.c (elf32_arm_check_relocs): Don't create PLT entries + for R_ARM_ABS12 relocs. + (elf32_arm_finish_dynamic_symbol): Fix the loop that creates + non-shared VxWorks PLT entries. -2006-05-02 Paul Brook <paul@codesourcery.com> +2007-05-11 Alan Modra <amodra@bigpond.net.au> - * elf32-arm.c (elf32_arm_final_link_relocate): Set thumb funciton bit - for R_ARM_REL32. + PR 4454 + * elf-eh-frame.c (struct cie): Make "personality" a bfd_vma. + (_bfd_elf_discard_section_eh_frame): Handle local syms on + personality relocation. -2006-04-27 Alan Modra <amodra@bigpond.net.au> +2007-05-10 Richard Sandiford <richard@codesourcery.com> - * coff-rs6000.c (xcoff_write_archive_contents_old): Warning fix. + * elf.c (assign_file_positions_for_load_sections): Use p_memsz + rather than p_filesz to calculate the LMA of the end of a segment. -2006-04-16 Daniel Jacobowitz <dan@codesourcery.com> +2007-05-10 Jakub Jelinek <jakub@redhat.com> - * configure.in: Update version to 2.16.92. - * configure: Regenerated. + * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Don't do copyreloc + processing if symbol is defined in the executable. + +2007-05-10 Alexandre Oliva <aoliva@redhat.com> + + * elf32-frv.c (_frvfdpic_check_discarded_relocs): New. + (frvfdpic_elf_discard_info): New. + (elf_backend_discard_info): Define for FDPIC. + +2007-05-09 Mark Shinwell <shinwell@codesourcery.com> + + * elf32-arm.c (bfd_elf32_arm_vfp11_erratum_scan): Don't + attempt to scan if the bfd doesn't correspond to an ELF image. + (bfd_elf32_arm_vfp11_fix_veneer_locations): Likewise. + +2007-05-08 Alexandre Oliva <aoliva@redhat.com> + + * elf32-frv.c (elf32_frv_relocate_section): Discard dynamic relocs + for which _bfd_elf_section_offset returns -1. + +2007-05-08 Alan Modra <amodra@bigpond.net.au> + + * elf32-spu.c (spu_elf_size_stubs): Use "void *" for psyms. + (mark_functions_via_relocs): Likewise. + +2007-05-07 Alan Modra <amodra@bigpond.net.au> + + * elflink.c (bfd_elf_final_link): Correct reloc handling for + elf_backend_count_relocs. + (bfd_elf_discard_info): Print an error if we can't read syms. + +2007-05-07 Alan Modra <amodra@bigpond.net.au> + + * elf32-spu.c (spu_elf_reloc_type_lookup): Return NULL on + invalid reloc code. + (spu_elf_gc_mark_hook, spu_elf_section_processing): Delete functions. + (elf_backend_gc_mark_hook, elf_backend_section_processing): Don't + define. + +2007-05-07 Alan Modra <amodra@bigpond.net.au> + + * elf.c (assign_file_positions_for_load_sections): Don't check + core segment. + +2007-05-04 H.J. Lu <hongjiu.lu@intel.com> + + * elflink.c (elf_link_sort_relocs): Return if both .rela.dyn + and .rel.dyn aren't present. + +2007-05-04 Nick Clifton <nickc@redhat.com> + + * elflink.c (elf_link_sort_relocs): If both .rela.dyn and .rel.dyn + sections are present examine the indirect sections in an attempt + to compute the correct relocation size. If there is any + ambiguity, produce an error and refuse to sort. + +2007-05-03 Sandra Loosemore <sandra@codesourcery.com> + + * elf32-arm.c (allocate_dynrelocs): Fix typo in comment. + +2007-05-03 Vincent Riviere <vincent.riviere@freesbee.fr> + Nick Clifton <nickc@redhat.com> + + PR gas/3041 + * aoutx.h (swap_std_reloc_out): Treat relocs against weak symbols + in the same way as relocs against external symbols. + +2007-05-02 Alan Modra <amodra@bigpond.net.au> + + * elf.c (assign_file_positions_for_load_sections): Set sh_offset + here. Set sh_type to SHT_NOBITS if we won't be allocating + file space. Don't bump p_memsz for non-alloc sections. Adjust + section-in-segment check. + (assign_file_positions_for_non_load_sections): Don't set sh_offset + here for sections that have already been handled above. -2006-04-16 Daniel Jacobowitz <dan@codesourcery.com> +2007-04-30 Alan Modra <amodra@bigpond.net.au> - * po/SRC-POTFILES.in: Regenerated. + * elf32-spu.c (struct spu_link_hash_table): Add stack_analysis + and emit_stack_syms bitfields. + (get_sym_h): Read all symbols if stack analysis will be done. + (spu_elf_create_sections): Add stack_analysis and emit_stack_syms + params, and stash in hash table. + (is_hint): Split off from.. + (is_branch): ..here. Adjust callers. + (spu_elf_size_stubs): Add stack_analysis param. Arrange to read + and keep all syms. + (write_one_stub): Fix mem leak. + (find_function_stack_adjust): New function. + (sort_syms_syms, sort_syms_psecs): New vars. + (sort_syms): New function. + (struct call_info, struct function_info): New. + (struct spu_elf_stack_info): New. + (alloc_stack_info, maybe_insert_function, func_name): New functions. + (is_nop, insns_at_end, check_function_ranges): Likewise. + (find_function, insert_callee, mark_functions_via_relocs): Likewise. + (pasted_function, interesting_section, discover_functions): Likewise. + (mark_non_root, call_graph_traverse, build_call_tree): Likewise. + (sum_stack, spu_elf_stack_analysis, spu_elf_final_link): Likewise. + (bfd_elf32_bfd_final_link): Define. + * elf32-spu.h (struct _spu_elf_section_data): Add stack_info field. + (spu_elf_create_sections, spu_elf_size_stubs): Update prototypes. -2006-04-14 David Heine <dlheine@tensilica.com> +2007-04-28 Sergey Rogozhkin <rogozhkin@niisi.msk.ru> - * elf32-xtensa.c (build_reloc_opcodes): New. - (compute_text_actions): Use it to decode opcodes outside inner loop. - (check_section_ebb_pcrels_fit): Add "reloc_opcodes" argument, and if - it is set, use it to get the opcodes for relocations. - (move_shared_literal): Adjust call to check_section_ebb_pcrels_fit. + * elfxx-mips.c (mips_elf_create_dynamic_relocation): Don't access + memory which we might not own. -2006-04-08 H.J. Lu <hongjiu.lu@intel.com> +2007-04-27 Bob Wilson <bob.wilson@acm.org> - PR ld/2513 - * elf32-i386.c (GOT_TLS_MASK): New macro for tls_type. - (GOT_TLS_IE_IE): Likewise. - (GOT_TLS_IE_GD): Likewise. - (GOT_TLS_IE_MASK): Likewise. - (elf_i386_check_relocs): For global symbols, set GOT_TLS_IE_GD - and GOT_TLS_IE_IE for R_386_TLS_GD and R_386_TLS_IE - respectively. - (allocate_dynrelocs): If both GOT_TLS_IE_IE and GOT_TLS_IE_GD - are set, treat tls_type as GOT_TLS_IE_BOTH. - (elf_i386_relocate_section): Likewise. + * elf32-xtensa.c (elf_xtensa_make_sym_local): Restore deleted function. + (elf_xtensa_hide_symbol, elf_backend_hide_symbol): Likewise. + (elf_xtensa_allocate_dynrelocs): Use elf_xtensa_make_sym_local. -2006-04-07 Randolph Chung <tausq@debian.org> +2007-04-27 Bob Wilson <bob.wilson@acm.org> - * elf64-hppa.c (elf64_hppa_grok_prstatus): New function. - (elf64_hppa_grok_psinfo): Likewise. - (elf_backend_grok_pstatus, elf_backend_grok_psinfo): Define. + * elf32-xtensa.c (xtensa_read_table_entries): Step through table + contents and relocs in parallel. -2006-04-06 DJ Delorie <dj@redhat.com> +2007-04-27 Bob Wilson <bob.wilson@acm.org> - * elf32-m32c.c (m32c_elf_relocate_section): Generate a symbol for - each plt entry we create. + * elf32-xtensa.c (relax_property_section): Remove extra irel increment. -2006-04-06 Carlos O'Donell <carlos@codesourcery.com> +2007-04-27 Alan Modra <amodra@bigpond.net.au> - * po/Make-in: Add install-html target. - * Makefile.am: Rename docdir to bfddocdir. Add datarootdir, docdir - htmldir. Add install-html and install-html-recursive targets. + * cpu-rs6000.c: Write Mimi's name in ASCII. + * coff-rs6000.c: Likewise. + * rs6000-core.c: Likewise. + +2007-04-27 Alan Modra <amodra@bigpond.net.au> + + * sysdep.h: Include config.h first. + Many files: Include sysdep.h before bfd.h. + * Makefile.am: Run "make dep-am". * Makefile.in: Regenerate. - * configure.in: AC_SUBST for datarootdir, docdir and htmldir. - * configure: Regenerate. -2006-04-06 H.J. Lu <hongjiu.lu@intel.com> +2007-04-25 Alan Modra <amodra@bigpond.net.au> - * elfxx-ia64.c (elfNN_ia64_relax_section): Skip unneeded passes - with the skip_relax_pass_0 and skip_relax_pass_1 bits in the - section structure. + * sysdep.h: Revert last change. -2006-04-05 Bernd Schmidt <bernd.schmidt@analog.com> +2007-04-24 Nick Clifton <nickc@redhat.com> - * elf32-bfin.c (bfinfdpic_relocs_info_hash): Sprinkle casts to - eliminate warnings. + * coffcode.h (coff_slurp_reloc_table): Initialise dst.r_offset. + * coff-m68k.c (m68kcoff_rtype_to_howto): Initialize relent.howto. -2006-04-05 H.J. Lu <hongjiu.lu@intel.com> - James E Wilson <wilson@specifixinc.com> +2007-04-24 Alan Modra <amodra@bigpond.net.au> - PR ld/2442 - * elfxx-ia64.c (elfNN_ia64_dyn_sym_info): Remove next. - (elfNN_ia64_local_hash_entry): Add count, sorted_count and - size. - (elfNN_ia64_link_hash_entry): Likewise. - (elfNN_ia64_new_elf_hash_entry): Initialize count, sorted_count - and size. - (elfNN_ia64_hash_copy_indirect): Updated elfNN_ia64_dyn_sym_info - processing. - (elfNN_ia64_hash_hide_symbol): Likewise. - (elfNN_ia64_global_dyn_sym_thunk): Likewise. - (elfNN_ia64_local_dyn_sym_thunk): Likewise. - (elfNN_ia64_global_dyn_info_free): New function. - (elfNN_ia64_local_dyn_info_free): Likewise. - (elfNN_ia64_hash_table_free): Free local and global - elfNN_ia64_dyn_sym_info. - (addend_compare): New function. - (sort_dyn_sym_info): Likewise. - (get_dyn_sym_info): Updated to use binary search for addend. - (elfNN_ia64_check_relocs): Scan relocations to create dynamic - relocation arrays first. - -2006-04-05 Bernd Schmidt <bernd.schmidt@analog.com> - - * elf32-bfin.c (_bfin_create_got_section): Don't generate a _gp - symbol. - -2006-04-05 H.J. Lu <hongjiu.lu@intel.com> - - PR ld/2411 - * elflink.c (check_dynsym): New. - (elf_link_output_extsym): Use it. - (bfd_elf_final_link): Likewise. - -2006-04-05 H.J. Lu <hongjiu.lu@intel.com> - - PR ld/2404 - * elflink.c (_bfd_elf_merge_symbol): Skip the default indirect - symbol from the dynamic definition with the default version if - its type and the type of existing regular definition mismatch. - -2006-04-05 Richard Sandiford <richard@codesourcery.com> - Daniel Jacobowitz <dan@codesourcery.com> - - * config.bfd (sparc-*-vxworks*): New stanza. - * configure.in (bfd_elf32_sparc_vxworks_vec): New stanza. - (bfd_elf32_sparc_vec, bfd_elf64_sparc_vec): Add elf-vxworks.lo. + * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Warn if + eh_frame_hdr table won't be created. + +2007-04-24 Alan Modra <amodra@bigpond.net.au> + + * acinclude.m4: Include config/stdint.m4. + * configure.in: Invoke GCC_HEADER_STDINT. + * sysdep.h: Don't include ansidecl.h here. * configure: Regenerate. - * elf32-sparc.c: Include elf-vxworks.h. - (elf32_sparc_vxworks_link_hash_table_create: New. - (elf32_sparc_vxworks_final_write_processing): New. - (TARGET_BIG_SYM): Override for VxWorks. - (TARGET_BIG_NAME, ELF_MINPAGESIZE): Likewise. - (bfd_elf32_bfd_link_hash_table_create): Likewise. - (elf_backend_want_got_plt, elf_backend_plt_readonly): Likewise. - (elf_backend_got_header_size, elf_backend_add_symbol_hook): Likewise. - (elf_backend_link_output_symbol_hook): Likewise. - (elf_backend_emit_relocs): Likewise. - (elf_backend_final_write_processing, elf32_bed): Likewise. - * elfxx-sparc.c: Include libiberty.h and elf-vxworks.h. - (sparc_vxworks_exec_plt0_entry, sparc_vxworks_exec_plt_entry): New. - (sparc_vxworks_shared_plt0_entry, sparc_vxworks_shared_plt_entry): New. - (_bfd_sparc_elf_link_hash_table_create): Don't initialize - build_plt_entry here. - (create_got_section): Initialize sgotplt for VxWorks. - (_bfd_sparc_elf_create_dynamic_sections): Initialize build_plt_entry, - plt_header_size and plt_entry_size, with new VxWorks-specific settings. - Call elf_vxworks_create_dynamic_sections for VxWorks. - (allocate_dynrelocs): Use plt_header_size and plt_entry_size. - Allocate room for .got.plt and .rela.plt.unloaded entries on VxWorks. - (_bfd_sparc_elf_size_dynamic_sections): Don't allocate a nop in .plt - for VxWorks. Check for the .got.plt section. - (sparc_vxworks_build_plt_entry): New function. - (_bfd_sparc_elf_finish_dynamic_symbol): Add handling of VxWorks PLTs. - Don't make _GLOBAL_OFFSET_TABLE_ and _PROCEDURE_LINKAGE_TABLE_ - absolute on VxWorks. - (sparc32_finish_dyn): Add special handling for DT_RELASZ - and DT_PLTGOT on VxWorks. - (sparc_vxworks_finish_exec_plt): New. - (sparc_vxworks_finish_shared_plt): New. - (_bfd_sparc_elf_finish_dynamic_sections): Call them. - Use plt_header_size and plt_entry_size. - * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Add is_vxworks, - srelplt2, sgotplt, plt_header_size and plt_entry_size fields. - * Makefile.am (elfxx-sparc.lo): Depend on elf-vxworks.h. - (elf32-sparc.lo): Likewise. + * config.in: Regenerate. * Makefile.in: Regenerate. - * targets.c (bfd_elf32_sparc_vxworks_vec): Declare. - (_bfd_target_vector): Add a pointer to it. - -2006-03-30 Ben Elliston <bje@au.ibm.com> - - PR ld/2267 - * elflink.c (elf_fixup_link_order): Ensure `elfsec' is not a - special section number that exceeds the number of ELF sections - (eg. SHN_MIPS_SCOMMON). - -2006-03-27 Richard Sandiford <richard@codesourcery.com> - - * elfxx-mips.c (mips_got_entry): Add more commentary. - (mips_elf_local_got_index): Use the hash table entry to record - the GOT index of forced-local symbols. - (mips_elf_initialize_tls_index): Rearrange code. Store the index - in either the hash table entry or the mips_got_entry, not both. - Add more commentary. - (mips_elf_multi_got): Make sure the g->next is nonnull when calling - mips_elf_initialize_tls_index. - -2006-03-25 Bernd Schmidt <bernd.schmidt@analog.com> - - * elf32-bfin.c (bfd_const_reloc, bfd_oper_reloc, bfin_push_reloc, - RELOC_STACK_SIZE, reloc_stack, reloc_stack_tos, is_reloc_stack_empty, - reloc_stack_push, reloc_stack_pop, reloc_stack_operate, - bfin_areloc_howto_table): Delete. All - uses deleted as well. - (bfin_reloc_map): Delete all stack relocs. - (bfin_info_to_howto, bfin_bfd_reloc_type_lookup, - bfin_reloc_type_lookup): Don't support them. - (bfin_relocate_section): Don't try to handle them. - - * config.bfd (bfin-*-*): Add bfd_elf32_bfinfdpic_vec. - * configure.in: Likewise. - * configure: Regenerate. - * elf32-bfin.c: Include "elf/dwarf2.h" and "hashtab.h". - (BFIN_RELOC_MAX): Now 0x21. - (bfin_howto_table, bfin_reloc_map): Add FD-PIC relocs. - (bfd_elf32_bfinfdpic_vec): Declare. - (IS_FDPIC): New macro. - (struct bfinfdpic_elf_link_hash_table): New struct. - (bfinfdpic_hash_table, bfinfdpic_got_section, - bfinfdpic_gotrel_section, bfinfdpic_gotfixup_section, - bfinfdpic_plt_setion, bfinfdpic_pltrel_section, - bfinfdpic_relocs_info, bfinfdpic_got_initial_offset, - bfinfdpic_plt_initial_offset): Accessor macros for it. - (BFINFDPIC_SYM_LOCAL, BFINFDPIC_FUNCDESC_LOCAL): New macros. - (struct bfinfdpic_relocs_info): New struct. - (LZPLT_RESOLVER_EXTRA, LZPLT_NORMAL_SIZE, LZPLT_ENTRIES, - BFINFDPIC_LZPLT_BLOCK_SIZE, BFINFDPIC_LZPLT_RESOLV_LOC, - DEFAULT_STACK_SIZE): New macros. - (bfinfdpic_elf_link_hash_table_create, bfinfdpic_relocs_info_hash, - bfinfdpic_relocs_info_eq, bfinfdpics_relocs_info_find, - bfinfdpic_relocs_info_for_global, bfinfdpic_relocs_info_for_local, - bfinfdpic_pic_merge_early_relocs_info, _bfinfdpic_add_dyn_reloc, - _bfinfdpic_add_rofixup, _bfinfdpic_osec_to_segment, - _bfinfdpic_osec_readonly_p, bfinfdpic_relocate_section, - bfinfdpic_check_relocs, bfinfdpic_gc_sweep_hook, - _bfinfdpic_link_omit_section_dynsym, _bfin_create_got_section, - elf32_bfinfdpic_create_dynamic_sections, _bfinfdpic_get_fd_entry, - _bfinfdpic_compute_got_alloc_data, _bfinfdpic_get_got_entry, - _bfinfdpic_assign_got_entries, _bfinfdpic_assign_plt_entries, - _bfinfdpic_resolve_final_relocs_info, - elf32_bfinfdpic_size_dynamic_sections, - elf32_bfinfdpic_always_size_sections, - elf32_bfinfdpic_modify_segment_map, - _bfinfdpic_count_got_plt_entries, - elf32_bfinfdpic_finish_dynamic_sections, - elf32_bfinfdpic_adjust_dynamic_symbol, - elf32_bfinfdpic_finish_dynamic_symbol, - elf32_bfinfdpic_elf_use_relative_eh_frame, - elf32_bfinfdpic_elf_encode_eh_address, - elf32_bfin_object_p, bfin_elf_copy_private_bfd_data, - elf32_bfinfdpic_copy_private_bfd_data, - (struct _bfinfdpic_dynamic_got_info, - struct _bfinfdpic_dynamic_got_plt_info): New structs. - (elf32_bfin_print_private_bfd_data): Print PIC flags. - (elf32_bfin_merge_private_bfd_data): Extend to support FD-PIC. - (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME, elf32_bed, - elf_backend_got_header_size, bfd_elf32_bfd_link_hash_table_create, - elf_backend_always_size_sectinos, elf_backend_modify_segment_map, - bfd_elf32_bfd_copy_private_bfd_data, - elf_backend_create_dynamic_sections, elf_backend_adjust_dynamic_symbol, - elf_backend_size_dynamic_sections, elf_backend_finish_dynamic_symbol, - elf_backend_finish_dynamic_sections, elf_backend_relocate_section, - elf_backend_can_make_relative_eh_frame, elf_backend_check_relocs, - elf_backend_can_make_ldsa_relative_eh_frame, elf_backend_may_use_rel_p, - elf_backend_may_use_rela_p, elf_backend_default_use_rela_p, - elf_backend_omit_section_dynsym): Redefine these macros and include - "elf32-target.h" again to create the elf32-bfinfdpic target. - * reloc.c (BFD_RELOC_BFIN_GOT17M4, BFD_RELOC_BFIN_GOTHI, - BFD_RELOC_BFIN_GOTLO, BFD_RELOC_BFIN_FUNCDESC, - BFD_RELOC_BFIN_FUNCDESC_GOT17M4, BFD_RELOC_BFIN_FUNCDESC_GOTHI, - BFD_RELOC_BFIN_FUNCDESC_GOTLO, BFD_RELOC_BFIN_FUNCDESC_VALUE, - BFD_RELOC_BFIN_FUNCDESC_GOTOFF17M4, BFD_RELOC_BFIN_FUNCDESC_GOTOFFHI, - BFD_RELOC_BFIN_FUNCDESC_GOTOFFLO, BFD_RELOC_BFIN_GOTOFFHI, - BFD_RELOC_BFIN_GOTOFFLO): New. - * targets.c (bfd_elf32_bfinfdpic_vec): New bfd_target. - (_bfd_target_vector): Add it. - * bfd-in2.h: Regenerate. - * libbfd.h: Regenerate. -2006-03-25 Richard Sandiford <richard@codesourcery.com> +2007-04-23 Nathan Sidwell <nathan@codesourcery.com> - * cpu-m68k.c (bfd_m68k_compatible): Treat ISA A+ and ISA B code as - incompatible. Likewise MAC and EMAC code. - * elf32-m68k.c (elf32_m68k_merge_private_bfd_data): Use - bfd_get_compatible to set the new bfd architecture. Rely on it - to detect incompatibilities. + * archures.c (bfd_mach_mcf_isa_c, bfd_mach_mcf_isa_c_mac, + bfd_mach_mcf_isa_c_emac): New. + * elf32-m68k.c (ISAC_PLT_ENTRY_SIZE, elf_isac_plt0_entry, + elf_isac_plt_entry, elf_isac_plt_info): New. + (elf32_m68k_object_p): Add ISA_C. + (elf32_m68k_print_private_bfd_data): Print ISA_C. + (elf32_m68k_get_plt_info): Detect ISA_C. + * cpu-m68k.c (arch_info): Add ISAC. + (m68k_arch_features): Likewise, + (bfd_m68k_compatible): ISAs B & C are not compatible. -2006-03-22 Bob Wilson <bob.wilson@acm.org> +2007-04-21 Nick Clifton <nickc@redhat.com> - * elf32-xtensa.c (xtensa_read_table_entries): Remove assertion that - rel->r_addend is zero. + * ecoff.c (_bfd_ecoff_write_armap): Initialise rehash. + (ecoff_link_add_archive_symbols): Likewise. + * coff-m68k.c (m68kcoff_common_addend_rtype_to_howto): Initialise + relent.howto. + * ieee.c (parse_int): Initialise x. + (must_parse_int): Initialise result. + (ieee_slurp_external_symbols): Initialise value. -2006-03-22 Richard Sandiford <richard@codesourcery.com> +2007-04-21 Alan Modra <amodra@bigpond.net.au> - * elfxx-mips.c (_bfd_mips_vxworks_finish_dynamic_symbol): Fix type - of "loc". + * config.bfd (spu-*-elf): Delete targ_selvecs. -2006-03-22 Richard Sandiford <richard@codesourcery.com> - Daniel Jacobowitz <dan@codesourcery.com> - Phil Edwards <phil@codesourcery.com> - Zack Weinberg <zack@codesourcery.com> - Mark Mitchell <mark@codesourcery.com> - Nathan Sidwell <nathan@codesourcery.com> +2007-04-19 Nick Clifton <nickc@redhat.com> + + * coffcode.h (coff_rtype_to_howto): Initialise genrel.howto. + +2007-04-19 Alan Modra <amodra@bigpond.net.au> + * bfd.c (bfd_demangle): New function. + * Makefile.am: Run "make dep-am". + * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. - * config.bfd (mips*-*-vxworks*, mips*el-*-vxworks*): New stanzas. - * configure.in (bfd_elf32_bigmips_vxworks_vec): New stanza. - (bfd_elf32_littlemips_vxworks_vec): Likewise. - (bfd_elf32_bigmips_vec): Add elf-vxworks.lo. - (bfd_elf32_littlemips_vec): Likewise. - (bfd_elf32_nbigmips_vec): Likewise. - (bfd_elf32_nlittlemips_vec): Likewise. - (bfd_elf32_ntradbigmips_vec): Likewise. - (bfd_elf32_ntradlittlemips_vec): Likewise. - (bfd_elf32_tradbigmips_vec): Likewise. - (bfd_elf32_tradlittlemips_vec): Likewise. - (bfd_elf64_bigmips_vec): Likewise. - (bfd_elf64_littlemips_vec): Likewise. - (bfd_elf64_tradbigmips_vec): Likewise. - (bfd_elf64_tradlittlemips_vec): Likewise. - * elf32-mips.c: Include elf-vxworks.h. - (mips_info_to_howto_rel): Use elf_backend_mips_rtype_to_howto - instead of calling mips_elf32_rtype_to_howto directly. - (mips_vxworks_copy_howto_rela): New reloc howto. - (mips_vxworks_jump_slot_howto_rela): Likewise. - (mips_vxworks_bfd_reloc_type_lookup): New function. - (mips_vxworks_rtype_to_howto): Likewise. - (mips_vxworks_final_write_processing): Likewise. - (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME): Override for VxWorks. - (TARGET_BIG_SYM, TARGET_BIG_NAME, elf_bed, ELF_MAXPAGESIZE): Likewise. - (elf_backend_want_got_plt): Likewise. - (elf_backend_want_plt_sym): Likewise. - (elf_backend_got_symbol_offset): Likewise. - (elf_backend_want_dynbss): Likewise. - (elf_backend_may_use_rel_p): Likewise. - (elf_backend_may_use_rela_p): Likewise. - (elf_backend_default_use_rela_p): Likewise. - (elf_backend_got_header_size: Likewise. - (elf_backend_plt_readonly): Likewise. - (bfd_elf32_bfd_reloc_type_lookup): Likewise. - (elf_backend_mips_rtype_to_howto): Likewise. - (elf_backend_adjust_dynamic_symbol): Likewise. - (elf_backend_finish_dynamic_symbol): Likewise. - (bfd_elf32_bfd_link_hash_table_create): 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_backend_additional_program_headers): Likewise. - (elf_backend_modify_segment_map): Likewise. - (elf_backend_symbol_processing): Likewise. - * elfxx-mips.c: Include elf-vxworks.h. - (mips_elf_link_hash_entry): Add is_relocation_target and - is_branch_target fields. - (mips_elf_link_hash_table): Add is_vxworks, srelbss, sdynbss, srelplt, - srelplt2, sgotplt, splt, plt_header_size and plt_entry_size fields. - (MIPS_ELF_RELA_SIZE, MIPS_ELF_REL_DYN_NAME): New macros. - (MIPS_RESERVED_GOTNO): Take a mips_elf_link_hash_table argument. - Return 3 for VxWorks. - (ELF_MIPS_GP_OFFSET): Change the argument from a bfd to a - mips_elf_link_hash_table. Return 0 for VxWorks. - (MIPS_ELF_GOT_MAX_SIZE): Change the argument from a bfd to a - mips_elf_link_hash_table. Update the call to ELF_MIPS_GP_OFFSET. - (mips_vxworks_exec_plt0_entry): New variable. - (mips_vxworks_exec_plt_entry): Likewise. - (mips_vxworks_shared_plt0_entry): Likewise. - (mips_vxworks_shared_plt_entry): Likewise. - (mips_elf_link_hash_newfunc): Initialize the new hash_entry fields. - (mips_elf_rel_dyn_section): Change the bfd argument to a - mips_elf_link_hash_table. Use MIPS_ELF_REL_DYN_NAME to get - the name of the section. - (mips_elf_initialize_tls_slots): Update the call to - mips_elf_rel_dyn_section. - (mips_elf_gotplt_index): New function. - (mips_elf_local_got_index): Add an input_section argument. - Update the call to mips_elf_create_local_got_entry. - (mips_elf_got_page): Likewise. - (mips_elf_got16_entry): Likewise. - (mips_elf_create_local_got_entry): Add bfd_link_info and input_section - arguments. Create dynamic relocations for each entry on VxWorks. - (mips_elf_merge_gots): Update the use of MIPS_ELF_GOT_MAX_SIZE. - (mips_elf_multi_got): Update the uses of MIPS_ELF_GOT_MAX_SIZE - and MIPS_RESERVED_GOTNO. - (mips_elf_create_got_section): Update the uses of - MIPS_ELF_GOT_MAX_SIZE. Create .got.plt on VxWorks. - (is_gott_symbol): New function. - (mips_elf_calculate_relocation): Use a dynobj local variable. - Update the calls to mips_elf_local_got_index, mips_elf_got16_entry and - mips_elf_got_page_entry. Set G to the .got.plt entry when calculating - VxWorks R_MIPS_CALL* relocations. Calculate and use G for all GOT - relocations on VxWorks. Add dynamic relocations for references - to the VxWorks __GOTT_BASE__ and __GOTT_INDEX__ symbols. Don't - create dynamic relocations for R_MIPS_32, R_MIPS_REL32 or R_MIPS_64 - in VxWorks executables. - (mips_elf_allocate_dynamic_relocations): Add a bfd_link_info argument. - Use MIPS_ELF_RELA_SIZE to calculate the size of a VxWorks entry. - Don't allocate a null entry on VxWorks. - (mips_elf_create_dynamic_relocation): Update the call to - mips_elf_rel_dyn_section. Use absolute rather than relative - relocations for VxWorks, and make them RELA rather than REL. - (_bfd_mips_elf_create_dynamic_sections): Don't make .dynamic - read-only on VxWorks. Update the call to mips_elf_rel_dyn_section. - Create the .plt, .rela.plt, .dynbss and .rela.bss sections on - VxWorks. Likewise create the _PROCEDURE_LINKAGE_TABLE symbol. - Call elf_vxworks_create_dynamic_sections for VxWorks and - initialize the plt_header_size and plt_entry_size fields. - (_bfd_mips_elf_check_relocs): Don't allow GOT relocations to be - used in VxWorks executables. Don't allocate dynamic relocations - for R_MIPS_32, R_MIPS_REL32 or R_MIPS_64 in VxWorks executables. - Set is_relocation_target for each symbol referenced by a relocation. - Allocate .rela.dyn entries for relocations against the special - VxWorks __GOTT_BASE__ and __GOTT_INDEX__ symbols. Create GOT - entries for all VxWorks R_MIPS_GOT16 relocations. Don't allocate - a global GOT entry for symbols mentioned in VxWorks R_MIPS_CALL*, - R_MIPS_32, R_MIPS_REL32 or R_MIPS_64 relocations. Update the calls - to mips_elf_rel_dyn_section and mips_elf_allocate_dynamic_relocations. - Set is_branch_target for symbols mentioned in R_MIPS_PC16 or R_MIPS_26 - relocations. Don't set no_fn_stub on VxWorks. - (_bfd_mips_elf_adjust_dynamic_symbol): Update the call to - mips_elf_allocate_dynamic_relocations. - (_bfd_mips_vxworks_adjust_dynamic_symbol): New function. - (_bfd_mips_elf_always_size_sections): Do not allocate GOT page - entries for VxWorks, and do not create multiple GOTs. - (_bfd_mips_elf_size_dynamic_sections): Use MIPS_ELF_REL_DYN_NAME. - Handle .got specially for VxWorks. Update the uses of - MIPS_RESERVED_GOTNO and mips_elf_allocate_dynamic_relocations. - Check for sgotplt and splt. Allocate the .rel(a).dyn contents last, - once its final size is known. Set DF_TEXTREL for VxWorks. Add - DT_RELA, DT_RELASZ, DT_RELAENT, DT_PLTREL, DT_PLTRELSZ and DT_JMPREL - tags on VxWorks. Do not add the MIPS-specific tags for VxWorks. - (_bfd_mips_vxworks_finish_dynamic_symbol): New function. - (mips_vxworks_finish_exec_plt): Likewise. - (mips_vxworks_finish_shared_plt): Likewise. - (_bfd_mips_elf_finish_dynamic_sections): Remove an unncessary call - to mips_elf_rel_dyn_section. Use a VxWorks-specific value of - DT_PLTGOT. Handle DT_RELA, DT_RELASZ, DT_RELAENT, DT_PLTREL, - DT_PLTRELSZ and DT_JMPREL. Update the uses of MIPS_RESERVED_GOTNO - and mips_elf_rel_dyn_section. Use a different GOT header for - VxWorks. Don't sort .rela.dyn on VxWorks. Finish the PLT on VxWorks. - (_bfd_mips_elf_link_hash_table_create): Initialize the new - mips_elf_link_hash_table fields. - (_bfd_mips_vxworks_link_hash_table_create): New function. - (_bfd_mips_elf_final_link): Set the GP value to _GLOBAL_OFFSET_TABLE_ - on VxWorks. Update the call to ELF_MIPS_GP_OFFSET. - * elfxx-mips.h (_bfd_mips_vxworks_adjust_dynamic_symbol): Declare. - (_bfd_mips_vxworks_finish_dynamic_symbol): Likewise. - (_bfd_mips_vxworks_link_hash_table_create): Likewise. - * libbfd.h: Regenerate. - * Makefile.am (elfxx-mips.lo): Depend on elf-vxworks.h. - (elf32-mips.lo): Likewise. + +2007-04-18 Matthias Klose <doko@ubuntu.com> + + * Makefile.am (libbfd_la_LDFLAGS): Use bfd soversion. + (bfdver.h): Use the date in non-release builds for the soversion. * Makefile.in: Regenerate. - * reloc.c (BFD_RELOC_MIPS_COPY, BFD_RELOC_MIPS_JUMP_SLOT): Declare. - * targets.c (bfd_elf32_bigmips_vxworks_vec): Declare. - (bfd_elf32_littlemips_vxworks_vec): Likewise. - (_bfd_target_vector): Add entries for them. -2006-03-19 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> +2007-04-17 Paul Brook <paul@codesourcery.com> - * elf64-hppa.c (elf64_hppa_special_sections): Change flags for .tbss - section from SHF_PARISC_WEAKORDER to SHF_HP_TLS. - (elf_backend_special_sections): Remove #undef. + * elf.c (_bfd_elf_is_function_type): New function. + * elflink.c (_bfd_elf_merge_symbol): Use bed->is_function_type. + (_bfd_elf_dynamic_symbol_p, _bfd_elf_symbol_refs_local_p, + is_global_data_symbol_definition, elf_link_add_object_symbols): Ditto. + * elf-bfd.h (elf_backend_data): Add is_function_type. + (_bfd_elf_is_function_type): Add prototype. + * elfxx-target.h (elf_backend_is_function_type): Add default + definition. + (elfNN_bed): Add elf_backend_is_function_type. + * elf32-arm.c (elf32_arm_is_function_type): New function. + (elf_backend_is_function_type): Define. -2006-03-18 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> +2007-04-17 Daniel Jacobowitz <dan@codesourcery.com> - * elf64-hppa.c (allocate_global_data_opd): Don't create an OPD entry - for undefined weak symbols. + * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Put + DT_MIPS_RLD_MAP before DT_DEBUG again. -2006-03-17 Daniel Jacobowitz <dan@codesourcery.com> +2007-04-14 Steve Ellcey <sje@cup.hp.com> - PR ld/2462 - * elflink.c (bfd_elf_final_link): Remove - bed->elf_backend_emit_relocs from emit_relocs. + * Makefile.am: Add ACLOCAL_AMFLAGS. + * configure.in: Change macro call order. + * Makefile.in: Regnerate. + * doc/Makefile.in: Regenerate. + * configure: Regenerate. -2006-03-17 Alexandre Oliva <aoliva@redhat.com> +2007-04-14 Jakub Jelinek <jakub@redhat.com> - * elf32-ppc.c (ppc_elf_relocate_section): Copy addend from - first relocation to the second when relaxing TLS GD to LE; - zero it out when relaxing to IE. + * elflink.c (bfd_elf_final_link): Don't free symbuf for + non-elf input bfds. + (bfd_elf_size_dynamic_sections): Don't access elf_section_data + for non-elf input bfds. -2006-03-17 Alan Modra <amodra@bigpond.net.au> +2007-04-12 Richard Sandiford <richard@codesourcery.com> - PR 2434 - * elflink.c (elf_link_add_object_symbols): Save and restore - warning sym's linked sym. + * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Don't add + DT_MIPS_RTLD_MAP for PIEs. -2006-03-16 Alan Modra <amodra@bigpond.net.au> +2007-04-12 Richard Sandiford <richard@codesourcery.com> - PR 2434 - * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. - (elf_link_add_object_symbols): Delete unnecessary locals. Rename - hash_table -> htab. Formatting. Save entire symbol table - before loading as-needed syms, and restore afterwards if lib not - needed. Use bfd_hash_allocate rather than bfd_alloc for sym - name. Free some buffers earlier. - * bfd-in.h (struct bfd_hash_table): Add entsize. - (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. - * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise - * hash.c (bfd_hash_table_init_n): Add entsize param, save to - hash table. - (bfd_hash_table_init): Add param, adjust calls. - * aoutx.h: Adjust all hash_table_init functions and calls. - * bfd.c: Likewise. - * coff-arm.c: Likewise. - * coff-h8300.c: Likewise. - * coff-ppc.c: Likewise. - * cofflink.c: Likewise. - * ecoff.c: Likewise. - * ecofflink.c: Likewise. - * elf-m10300.c: Likewise. - * elf-strtab.c: Likewise. - * elf.c: Likewise. - * elf32-arm.c: Likewise. - * elf32-bfin.c: Likewise. - * elf32-cris.c: Likewise. - * elf32-frv.c: Likewise. - * elf32-hppa.c: Likewise. - * elf32-i386.c: Likewise. - * elf32-m32r.c: Likewise. - * elf32-m68hc1x.c: Likewise. - * elf32-m68k.c: Likewise. - * elf32-ppc.c: Likewise. - * elf32-s390.c: Likewise. - * elf32-sh.c: Likewise. - * elf32-vax.c: Likewise. - * elf64-alpha.c: Likewise. - * elf64-hppa.c: Likewise. - * elf64-ppc.c: Likewise. - * elf64-s390.c: Likewise. - * elf64-sh64.c: Likewise. - * elf64-x86-64.c: Likewise. - * elfxx-ia64.c: Likewise. - * elfxx-mips.c: Likewise. - * elfxx-sparc.c: Likewise. - * i386linux.c: Likewise. - * libaout.h: Likewise. - * libbfd-in.h: Likewise. - * libcoff-in.h: Likewise. - * linker.c: Likewise. - * m68klinux.c: Likewise. - * merge.c: Likewise. - * opncls.c: Likewise. - * pdp11.c: Likewise. - * sparclinux.c: Likewise. - * stabs.c: Likewise. - * sunos.c: Likewise. - * vms.c: Likewise. - * xcofflink.c: Likewise. - * section.c (struct section_hash_entry): Move to.. - * libbfd-in.h: ..here. - * Makefile.am: Run "make dep-am" - * Makefile.in: Regenerate. - * bfd-in2.h: Regenerate. - * libbfd.h: Regenerate. - * libcoff.h: Regenerate. + * elfxx-mips.c (mips_elf_calculate_relocation): Set DT_TEXTREL + when creating a __GOTT_BASE__ or __GOTT_INDEX__ relocation + in a read-only section. + (_bfd_mips_elf_check_relocs): Likewise. + +2007-04-12 Bob Wilson <bob.wilson@acm.org> + + * elf32-xtensa.c (xtensa_is_insntable_section): New. + (xtensa_is_proptable_section): New. + (elf_xtensa_discard_info_for_section): Handle "full" .xt.prop property + tables with 12-byte entries, as well as tables with 8-byte entries. + Sort the relocations before examining them. + (relax_property_section): Use xtensa_is_proptable_section and + xtensa_is_littable_section. Rewrite code for combining table entries + to be more robust in case of unexpected relocations. Do not set offset + of unused relocations to less than zero. + (xtensa_is_property_section): Use other functions instead of + duplicating section name comparisons. + (xtensa_is_littable_section): Use CONST_STRNEQ for ".gnu.linkonce.p.". + (xtensa_get_property_predef_flags): Use xtensa_is_insntable_section. + +2007-04-12 Bob Wilson <bob.wilson@acm.org> -2006-03-16 Alan Modra <amodra@bigpond.net.au> + * elf32-xtensa.c (elf_xtensa_gc_mark_hook): Don't follow references + from Xtensa property sections. - * elf32-ppc.c (ppc_elf_check_relocs): REL24 and REL14 relocs - against __GLOBAL_OFFSET_TABLE__ need never be dynamic. Tweak - last change to REL32 relocs so that they are counted as - possibly dynamic as per REL24 and REL14. +2007-04-12 Alan Modra <amodra@bigpond.net.au> -2006-03-16 Alan Modra <amodra@bigpond.net.au> + * elf32-spu.c (needs_ovl_stub): Test that spu_elf_section_data + is non-NULL before dereferencing. - * elf32-ppc.c (ppc_elf_check_relocs): Don't fall into REL24 - checks from REL32. +2007-04-11 Nathan Sidwell <nathan@codesourcery.com> -2006-03-15 Ben Elliston <bje@au.ibm.com> + * elf-vxworks.c (elf_vxworks_emit_relocs): Remap weakdef PLT slot + relocs too. - * elf32-arm.c (elf32_arm_merge_eabi_attributes): Iterate over all - in_list elements, not just the first. - -2006-03-14 Richard Sandiford <richard@codesourcery.com> +2007-04-10 Richard Henderson <rth@redhat.com> - * elf32-mips.c (mips_elf_adjust_addend): New function, mostly split - out from... - (_bfd_mips_elf_relocate_section): ...here. Use it to adjust r_addend - for final links too. + * elf64-alpha.c (struct alpha_elf_link_hash_table): Add relax_trip. + (elf64_alpha_size_got_sections): Remove unused something_changed local. + (elf64_alpha_size_plt_section): Return void. + (elf64_alpha_size_rela_got_section): Likewise. + (elf64_alpha_relax_section): Only regenerate got+plt if the + relax_trip counter has changed. -2006-03-13 Richard Sandiford <richard@codesourcery.com> +2007-04-09 Daniel Jacobowitz <dan@codesourcery.com> - * elfxx-mips.c (mips_elf_create_got_section): Initialize hgot. + * Makefile.am (bfdver.h): Do not generate doc/bfdver.texi. + * doc/Makefile.am (DOCFILES): Add bfdver.texi. + (bfdver.texi): New rule. + * Makefile.in, doc/Makefile.in: Regenerated. -2006-03-11 H.J. Lu <hongjiu.lu@intel.com> +2007-04-03 Matt Thomas <matt@netbsd.org> - PR ld/2443 - * dwarf2.c (concat_filename): Don't issue an error if file is - 0. + * elf32-vax.c (elf_vax_relocate_section): Do not emit a PCREL reloc + in a shared object if it is not in a CODE section or if it is against + a section symbol. This allows DWARF2 to use pcrel format. -2006-03-10 Paul Brook <paul@codesourcery.com> +2007-04-05 H.J. Lu <hongjiu.lu@intel.com> - * elf32-arm.c (INTERWORK_FLAG): Handle EABIv5. - (elf32_arm_print_private_bfd_data): Ditto. + PR ld/4304 + * elflink.c (bfd_elf_final_link): Call einfo callback in + bfd_link_info instead of _bfd_error_handler for DT_TEXTREL + warning. -2006-03-09 Paul Brook <paul@codesourcery.com> +2007-04-05 Alan Modra <amodra@bigpond.net.au> - * cpu-arm.c (bfd_is_arm_mapping_symbol_name): Recognise additional - mapping symbols. + * elf32-spu.c (spu_elf_output_symbol_hook): New function. + (elf_backend_link_output_symbol_hook): Define. -2006-03-09 Khem Raj <khem@mvista.com> +2007-04-02 Nick Clifton <nickc@redhat.com> - * elf32-arm.c(elf32_arm_finish_dynamic_sections): Use unsigned - char type. + PR binutils/4292 + * bfd.c (bfd_fprintf_vma): Do not print addresses of 32-bit + targets as 64-bit values, even if running on a 64-bit host. + * coffgen.c (coff_print_symbol): Likewise. -2006-03-08 H.J. Lu <hongjiu.lu@intel.com> +2007-03-29 Nick Clifton <nickc@redhat.com> - * elfxx-ia64.c (elfNN_ia64_choose_gp): Properly choose gp. + PR binutils/4110 + * elf.c (IS_VALID_GROUP_SECTION_HEADER): New macro. + (setup_group): Use it. Report corrupt group section headers. + (bfd_section_from_shdr): Use new macro. Replace constant 4 with + GRP_ENTRY_SIZE. Cope with NULLs in the group section table. + (elf_fake_section): Replace constant 4 with GRP_ENTRY_SIZE. -2006-03-07 Richard Sandiford <richard@codesourcery.com> - Daniel Jacobowitz <dan@codesourcery.com> - Zack Weinberg <zack@codesourcery.com> - Nathan Sidwell <nathan@codesourcery.com> - Paul Brook <paul@codesourcery.com> - Ricardo Anguiano <anguiano@codesourcery.com> +2007-03-29 Alan Modra <amodra@bigpond.net.au> + + PR ld/4267 + * elflink.c (evaluate_complex_relocation_symbols): Use bfd_vma + for rel->r_info values. + (bfd_elf_perform_complex_relocation): Likewise. + * elf32-ppc.c (allocate_dynrelocs): Set plt.offset to -1 for + unused entries. Don't clear plt.plist in loop. + +2007-03-28 Richard Sandiford <richard@codesourcery.com> + + * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Remove append_rela. + * elfxx-sparc.c (sparc_elf_append_rela_64, sparc_elf_append_rela_32): + Merge into... + (sparc_elf_append_rela): ...this new function. + (SPARC_ELF_APPEND_RELA): Delete. + (_bfd_sparc_elf_link_hash_table_create): Don't initialize + the deleted append_rela field. + (_bfd_sparc_elf_relocate_section): Use sparc_elf_append_rela + instead of SPARC_ELF_APPEND_RELA. + (_bfd_sparc_elf_finish_dynamic_symbol): Likewise. Use the + elf_size_info structure to find the size of a RELA entry and + the associated swap-out function. + (sparc64_finish_dyn, sparc64_finish_dyn): Merge into... + (sparc_finish_dyn): ...this new function. + (_bfd_sparc_elf_finish_dynamic_sections): Update calls accordingly. + +2007-03-28 Richard Sandiford <richard@codesourcery.com> Phil Edwards <phil@codesourcery.com> - * configure.in (bfd_elf32_bigarm_vec): Include elf-vxworks.lo. - (bfd_elf32_bigarm_symbian_vec): Likewise. - (bfd_elf32_bigarm_vxworks_vec): Likewise. - (bfd_elf32_littlearm_vec): Likewise. - (bfd_elf32_littlearm_symbian_vec): Likewise. - (bfd_elf32_littlearm_vxworks_vec): Likewise. - * configure: Regenerate. - * elf32-arm.c: Include libiberty.h and elf-vxworks.h. - (RELOC_SECTION, RELOC_SIZE, SWAP_RELOC_IN, SWAP_RELOC_OUT): New macros. - (elf32_arm_vxworks_bed): Add forward declaration. - (elf32_arm_howto_table_1): Fix the masks for R_ASM_ABS12. - (elf32_arm_vxworks_exec_plt0_entry): New table. - (elf32_arm_vxworks_exec_plt_entry): Likewise. - (elf32_arm_vxworks_shared_plt_entry): Likewise. - (elf32_arm_link_hash_table): Add vxworks_p and srelplt2 fields. - (reloc_section_p): New function. - (create_got_section): Use RELOC_SECTION. - (elf32_arm_create_dynamic_sections): Likewise. Call - elf_vxworks_create_dynamic_sections for VxWorks targets. - Choose between the two possible values of plt_header_size - and plt_entry_size. - (elf32_arm_link_hash_table_create): Initialize vxworks_p and srelplt2. - (elf32_arm_abs12_reloc): New function. - (elf32_arm_final_link_relocate): Call it. Allow the creation of - dynamic R_ARM_ABS12 relocs on VxWorks. Use reloc_section_p, - RELOC_SIZE, SWAP_RELOC_OUT and RELOC_SECTION. Initialize the - r_addend fields of relocs. On rela targets, skip any code that - adjusts in-place addends. When using _bfd_link_final_relocate - to perform a final relocation, pass rel->r_addend as the addend - argument. - (elf32_arm_merge_private_bfd_data): If one of the bfds is a VxWorks - object, ignore flags that are not standard on VxWorks. - (elf32_arm_check_relocs): Allow the creation of dynamic R_ARM_ABS12 - relocs on VxWorks. Use reloc_section_p. - (elf32_arm_adjust_dynamic_symbol): Use RELOC_SECTION and RELOC_SIZE. - (allocate_dynrelocs): Use RELOC_SIZE. Account for the size of - .rela.plt.unloaded relocs on VxWorks targets. - (elf32_arm_size_dynamic_sections): Use RELOC_SIZE. Check for - .rela.plt.unloaded as well as .rel(a).plt. Add DT_RELA* tags - instead of DT_REL* tags on RELA targets. - (elf32_arm_finish_dynamic_symbol): Use RELOC_SECTION, RELOC_SIZE - and SWAP_RELOC_OUT. Initialize r_addend fields. Handle VxWorks - PLT entries. Do not make _GLOBAL_OFFSET_TABLE_ absolute on VxWorks. - (elf32_arm_finish_dynamic_sections): Use RELOC_SECTION, RELOC_SIZE - and SWAP_RELOC_OUT. Initialize r_addend fields. Handle DT_RELASZ - like DT_RELSZ. Handle the VxWorks form of initial PLT entry. - Correct the .rela.plt.unreloaded symbol indexes. - (elf32_arm_output_symbol_hook): Call the VxWorks version of this - hook on VxWorks targets. - (elf32_arm_vxworks_link_hash_table_create): Set vxworks_p to true. - Minor formatting tweak. - (elf32_arm_vxworks_final_write_processing): New function. - (elf_backend_add_symbol_hook): Override for VxWorks and reset - for Symbian. - (elf_backend_final_write_processing): Likewise. - (elf_backend_emit_relocs): Likewise. - (elf_backend_want_plt_sym): Likewise. - (ELF_MAXPAGESIZE): Likewise. - (elf_backend_may_use_rel_p): Minor formatting tweak. - (elf_backend_may_use_rela_p): Likewise. - (elf_backend_default_use_rela_p): Likewise. - (elf_backend_rela_normal): Likewise. - * Makefile.in (elf32-arm.lo): Depend on elf-vxworks.h. - -2006-03-06 Nathan Sidwell <nathan@codesourcery.com> - - * archures.c (bfd_mach_mcf_isa_a_nodiv, bfd_mach_mcf_isa_b_nousp): - New. Adjust other variants. - (bfd_default_scan): Update. - * bfd-in2.h: Rebuilt. - * cpu-m68k.c: Adjust. - (bfd_m68k_compatible): New. Use it for architectures. - * elf32-m68k.c (elf32_m68k_object_p): Adjust. - (elf32_m68k_merge_private_bfd_data): Adjust. Correct isa-a/b - mismatch. - (elf32_m68k_print_private_bfd_data): Adjust. - * ieee.c (ieee_write_processor): Adjust. - -2006-03-06 Alan Modra <amodra@bigpond.net.au> - - * dwarf2.c: Formatting. - (add_line_info): Remove outer loop. - -2006-03-05 H.J. Lu <hongjiu.lu@intel.com> - Alan Modra <amodra@bigpond.net.au> + * doc/bfd.texinfo: Put the contents after the title page rather + than at the end of the document. - PR binutils/2338 - * dwarf2.c (loadable_section): New struct. - (dwarf2_debug): Add loadable_section_count and - loadable_sections. - (new_line_sorts_after): New. - (add_line_info): Use new_line_sorts_after to compare line - addresses. - (check_function_name): Removed. - (unset_sections): New. - (place_sections): New. - (_bfd_dwarf2_find_nearest_line): Updated. Call place_sections - and unset_sections on relocatable files. - (_bfd_dwarf2_find_line): Likewise. +2007-03-27 Andreas Schwab <schwab@suse.de> -2006-03-03 Nick Clifton <nickc@redhat.com> + * elfxx-ia64.c (elf_backend_default_execstack): Define to 0. - * cpu-avr.c: Update to ISO-C90 formatting. - * elf32-avr.c: Likewise. +2007-03-26 H.J. Lu <hongjiu.lu@intel.com> -2006-03-03 Bjoern Haase <bjoern.m.haase@web.de> + * configure: Regenerated. - * elf32-avr.c (avr_reloc_map): Insert BFD_RELOC_AVR_MS8_LDI - and R_AVR_MS8_LDI - (bfd_elf_avr_final_write_processing): Set - EF_AVR_LINKRELAX_PREPARED in e_flags field. - (elf32_avr_relax_section): New function. - (elf32_avr_relax_delete_bytes): New function. - (elf32_avr_get_relocated_section_contents): New function. - (avr_pc_wrap_around): New function. - (avr_relative_distance_considering_wrap_around): New function. - (avr_final_link_relocate): Handle negative int8t_t immediate for R_AVR_LDI. - * reloc.c: Add BFD_RELOC_AVR_MS8_LDI and BFD_RELOC_AVR_LDI_NEG +2007-03-26 Alan Modra <amodra@bigpond.net.au> + + * elf32-spu.c (struct stubarr): Add stub_hash_table and err fields. + (allocate_spuear_stubs): New function. + (spu_elf_size_stubs): Call allocate_spuear_stubs. + +2007-03-26 Alan Modra <amodra@bigpond.net.au> + + * aout-adobe.c (aout_32_bfd_reloc_name_lookup): Define. + * aout-arm.c (MY_bfd_reloc_name_lookup): Define. + (MY (bfd_reloc_name_lookup)): New function. + * aout-ns32k.c (MY (bfd_reloc_name_lookup)): New function. + * aout-target.h (NAME (aout, reloc_name_lookup)): Declare. + (MY_bfd_reloc_name_lookup): Define. + * aout-tic30.c (tic30_aout_reloc_name_lookup): New function. + (MY_bfd_reloc_name_lookup): Define. + * aoutx.h (NAME (aout, reloc_type_lookup)): Don't declare. + (NAME (aout, reloc_name_lookup)): New function. + * bout.c (b_out_bfd_reloc_name_lookup): New function. + * coff-alpha.c (alpha_bfd_reloc_name_lookup): New function. + (_bfd_ecoff_bfd_reloc_name_lookup): Define. + * coff-arm.c (coff_arm_reloc_name_lookup): New function. + (coff_bfd_reloc_name_lookup): Define. + * coff-i386.c (coff_bfd_reloc_name_lookup): Define. + (coff_i386_reloc_name_lookup): New function. + * coff-i860.c (coff_i860_reloc_name_lookup): New function. + (coff_bfd_reloc_name_lookup): Define. + * coff-i960.c (coff_i960_reloc_name_lookup): New function. + (coff_bfd_reloc_name_lookup): Define. + * coff-m68k.c (m68k_reloc_name_lookup): New function. + (coff_bfd_reloc_name_lookup): Define. + * coff-maxq.c (maxq_reloc_name_lookup): New function. + (coff_bfd_reloc_name_lookup): Define. + * coff-mcore.c (mcore_coff_reloc_name_lookup): New function. + (coff_bfd_reloc_name_lookup): Define. + * coff-mips.c (mips_bfd_reloc_name_lookup): New function. + (_bfd_ecoff_bfd_reloc_name_lookup): Define. + * coff-ppc.c (ppc_coff_reloc_name_lookup): New function. + (coff_bfd_reloc_name_lookup): Define. + * coff-rs6000.c (coff_bfd_reloc_name_lookup): Define. + (_bfd_xcoff_reloc_name_lookup): New function. + (rs6000coff_vec, pmac_xcoff_vec): Init new field. + * coff-sh.c (coff_bfd_reloc_name_lookup): Define. + (sh_coff_reloc_name_lookup): New function. + * coff-sparc.c (coff_sparc_reloc_name_lookup): New function. + (coff_bfd_reloc_name_lookup): Define. + * coff-tic30.c (coff_bfd_reloc_name_lookup): Define. + (tic30_coff_reloc_name_lookup): New function. + * coff-tic4x.c (coff_bfd_reloc_name_lookup): Define. + (tic4x_coff_reloc_name_lookup): New function. + * coff-tic54x.c (coff_bfd_reloc_name_lookup): Define. + (tic54x_coff_reloc_name_lookup): New function. + * coff-x86_64.c (coff_bfd_reloc_name_lookup): Define. + (coff_amd64_reloc_name_lookup): New function. + * coff-z80.c (coff_z80_reloc_name_lookup): New function. + (coff_bfd_reloc_name_lookup): Define. + * coff-z8k.c (coff_z8k_reloc_name_lookup): New function. + (coff_bfd_reloc_name_lookup): Define. + * coff64-rs6000.c (coff_bfd_reloc_name_lookup): Define. + (xcoff64_reloc_name_lookup): New function. + (rs6000coff64_vec, aix5coff64_vec): Init new field. + * coffcode.h (coff_bfd_reloc_name_lookup): Define. + * elf-hppa.h (elf_hppa_reloc_name_lookup): New function. + * elf-m10200.c (bfd_elf32_bfd_reloc_name_lookup): New function. + * elf-m10300.c (bfd_elf32_bfd_reloc_name_lookup): New function. + * elf32-arc.c (bfd_elf32_bfd_reloc_name_lookup): New function. + * elf32-arm.c (elf32_arm_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-avr.c (bfd_elf32_bfd_reloc_name_lookup): New function. + * elf32-bfin.c (bfin_bfd_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-cr16c.c (elf_cr16c_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-cris.c (cris_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-crx.c (elf_crx_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-d10v.c (bfd_elf32_bfd_reloc_name_lookup): New function. + * elf32-d30v.c (bfd_elf32_bfd_reloc_name_lookup): New function. + * elf32-dlx.c (elf32_dlx_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-fr30.c (fr30_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-frv.c (frv_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-gen.c (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-h8300.c (elf32_h8_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-hppa.c (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-i370.c (i370_elf_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-i386.c (elf_i386_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-i860.c (elf32_i860_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-i960.c (elf32_i960_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-ip2k.c (ip2k_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-iq2000.c (iq2000_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-m32c.c (m32c_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-m32r.c (bfd_elf32_bfd_reloc_name_lookup): New function. + * elf32-m68hc11.c (bfd_elf32_bfd_reloc_name_lookup): New function. + * elf32-m68hc12.c (bfd_elf32_bfd_reloc_name_lookup): New function. + * elf32-m68k.c (reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-m88k.c (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-mcore.c (mcore_elf_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-mep.c (mep_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-mips.c (bfd_elf32_bfd_reloc_name_lookup): New function. + (mips_vxworks_bfd_reloc_name_lookup): Likewise. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-msp430.c (bfd_elf32_bfd_reloc_name_lookup): New function. + * elf32-mt.c (mt_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-openrisc.c (openrisc_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-or32.c (bfd_elf32_bfd_reloc_name_lookup): New function. + * elf32-pj.c (pj_elf_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-ppc.c (ppc_elf_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-s390.c (elf_s390_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-score.c (elf32_score_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-sh.c (sh_elf_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-sparc.c (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-spu.c (spu_elf_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-v850.c (v850_elf_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-vax.c (reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-xc16x.c (xc16x_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-xstormy16.c (xstormy16_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-xtensa.c (elf_xtensa_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf64-alpha.c (elf64_alpha_bfd_reloc_name_lookup): New function. + (bfd_elf64_bfd_reloc_name_lookup): Define. + * elf64-gen.c (bfd_elf64_bfd_reloc_name_lookup): Define. + * elf64-hppa.c (bfd_elf64_bfd_reloc_name_lookup): Define. + * elf64-mips.c (bfd_elf64_bfd_reloc_name_lookup): New function. + * elf64-mmix.c (bfd_elf64_bfd_reloc_name_lookup): New function. + * elf64-ppc.c (ppc64_elf_reloc_name_lookup): New function. + (bfd_elf64_bfd_reloc_name_lookup): Define. + * elf64-s390.c (elf_s390_reloc_name_lookup): New function. + (bfd_elf64_bfd_reloc_name_lookup): Define. + * elf64-sh64.c (sh_elf64_reloc_name_lookup): New function. + (bfd_elf64_bfd_reloc_name_lookup): Define. + * elf64-sparc.c (bfd_elf64_bfd_reloc_name_lookup): Define. + * elf64-x86-64.c (elf64_x86_64_reloc_name_lookup): New function. + (bfd_elf64_bfd_reloc_name_lookup): Define. + * elfn32-mips.c (bfd_elf32_bfd_reloc_name_lookup): New function. + * elfxx-ia64.c (elfNN_ia64_reloc_name_lookup): New function. + (bfd_elfNN_bfd_reloc_name_lookup): Define. + * elfxx-sparc.c (_bfd_sparc_elf_reloc_name_lookup): New function. + * elfxx-sparc.h (_bfd_sparc_elf_reloc_name_lookup): Declare. + * i386msdos.c (msdos_bfd_reloc_name_lookup): Define. + * i386os9k.c (aout_32_bfd_reloc_name_lookup): Define. + * ieee.c (ieee_bfd_reloc_name_lookup): Define. + * libaout.h (NAME (aout, reloc_name_lookup)): Declare. + * libbfd-in.h (_bfd_norelocs_bfd_reloc_name_lookup): Declare. + * mipsbsd.c (MY_bfd_reloc_name_lookup): Define. + (MY(reloc_type_lookup)): Rename from MY(reloc_howto_type_lookup). + (MY(reloc_name_lookup)): New function. + * nlm-target.h (nlm_bfd_reloc_name_lookup): Define. + * oasys.c (oasys_bfd_reloc_name_lookup): Define. + * pdp11.c (NAME (aout, reloc_name_lookup)): New function. + * pe-mips.c (coff_mips_reloc_name_lookup): New function. + (coff_bfd_reloc_name_lookup): Define. + * reloc.c (bfd_reloc_name_lookup): New function. + * riscix.c (riscix_reloc_name_lookup): New function. + (MY_bfd_reloc_name_lookup): Define. + * som.c (som_bfd_reloc_name_lookup): New function. + * targets.c (struct bfd_target): Add reloc_name_lookup. + (BFD_JUMP_TABLE_RELOCS): Add NAME##_bfd_reloc_name_lookup. + * versados.c (versados_bfd_reloc_name_lookup): Define. + * vms.c (vms_bfd_reloc_name_lookup): New function. + * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. + +2007-03-26 Thiemo Seufer <ths@mips.com> + + PR ld/4208 + * elfxx-mips.c (mips_elf_next_relocation): Don't signal an error if no + matching relocation is found. + (_bfd_mips_elf_relocate_section): Only warn about missing relocations. + +2007-03-23 H.J. Lu <hongjiu.lu@intel.com> + + * configure: Regenerated. + +2007-03-23 Joseph Myers <joseph@codesourcery.com> + + * configure.in: Use ACX_PKGVERSION and ACX_BUGURL. + * configure: Regenerate. + +2007-03-23 Alan Modra <amodra@bigpond.net.au> + + * elf32-spu.c (spu_stub_name): Don't put input section in stub name. + Remove input_sec param. Adjust all calls. + (write_one_stub): Adjust stub symbol. + (needs_ovl_stub): New function, extracted from.. + (spu_elf_size_stubs): ..here. + (spu_elf_relocate_section): Use needs_ovl_stub. + +2007-03-22 Joseph Myers <joseph@codesourcery.com> + + * Makefile.am (bfdver.h): Only set VERSION_PACKAGE in bfdver.texi + if nonempty. + * configure.in (REPORT_BUGS_TO): Do not use "URL:" prefix. + * Makefile.in, configure, doc/Makefile.in: Regenerate. + +2007-03-22 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/4210 + * peXXigen.c (_bfd_XXi_swap_aouthdr_out): Use the virtual + address and virtual size of the last section for the image + size. + +2007-03-22 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/4007 + * elf.c (assign_file_positions_for_load_sections): Check if + all sections are in the segment. + +2007-03-20 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/4208 + * elfxx-mips.c (_bfd_mips_elf_relocate_section): Report missing + matching LO16 relocation for HI16 relocation. + +2007-03-20 Paul Brook <paul@codesourcery.com> + + * bfd-in.h (bfd_elf32_arm_set_target_relocs): Update prototype. * bfd-in2.h: Regenerate. + * elf32-arm.c (elf32_arm_link_hash_table): Add pic_veneer. + (record_arm_to_thumb_glue): Use globals->pic_veneer. + (elf32_arm_create_thumb_stub): Ditto. + (bfd_elf32_arm_set_target_relocs): Set globals->pic_veneer. -2006-03-02 DJ Delorie <dj@redhat.com> - - * elf32-m32c.c (m32c_offset_for_reloc): Fix local symbol - calculations. - -2006-03-02 Richard Sandiford <richard@codesourcery.com> - - * elf32-ppc.c (is_ppc_elf_target): Return true if the target is - bfd_elf32_powerpc_vxworks_vec. - -2006-03-02 Nick Clifton <nickc@redhat.com> - - * elf32-m32c.c (m32c_elf_relax_section): Initialise 'gap'. - -2006-03-02 Richard Sandiford <richard@codesourcery.com> - - * elf32-i386.c (elf_i386_create_dynamic_sections): Use - elf_vxworks_create_dynamic_sections. - (elf_i386_size_dynamic_sections): Remove VxWorks GOT and PLT - symbol handling. - * elf32-ppc.c (ppc_elf_create_dynamic_sections): Use - elf_vxworks_create_dynamic_sections. - (ppc_elf_size_dynamic_sections): Remove VxWorks GOT and PLT - symbol handling. - * elf-vxworks.c (elf_vxworks_create_dynamic_sections): New function. - * elf-vxworks.h (elf_vxworks_create_dynamic_sections): Declare. - -2006-03-02 Richard Sandiford <richard@codesourcery.com> - - * elf32-i386.c (elf_i386_vxworks_link_output_symbol_hook): Delete. - (elf_backend_link_output_symbol_hook): Use - elf_vxworks_link_output_symbol_hook instead. - * elf32-ppc.c (elf_i386_vxworks_link_output_symbol_hook): Delete. - (elf_backend_link_output_symbol_hook): Use - elf_vxworks_link_output_symbol_hook instead. - * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Provide the - same interface as elf_backend_link_output_symbol_hook. - * elf-vxworks.h (elf_vxworks_link_output_symbol_hook): Update - prototype accordingly. - -2006-03-02 Richard Sandiford <richard@codesourcery.com> - - * elf32-ppc.c (ppc_elf_plt_type): New enumeration. - (ppc_elf_link_hash_table): Replace old_got and new_got with - plt_type and can_use_new_plt. - (ppc_elf_create_dynamic_sections): Add SEC_HAS_CONTENTS, - SEC_LOAD and SEC_READONLY to the VxWorks .plt flags. - (ppc_elf_check_relocs): Set can_use_new_plt instead of new_plt. - Move from plt_type == PLT_UNSET to PLT_OLD instead of setting old_plt. - (ppc_elf_select_plt_layout): Move from plt_type == PLT_UNSET to - either plt_type == PLT_OLD or plt_type == PLT_NEW. Assert that - this function should not be called for VxWorks targets. - (ppc_elf_tls_setup): Use plt_type instead of old_got. - (allocate_got): Likewise. Rearrange so that max_before_header - is only used for PLT_OLD and PLT_NEW. - (allocate_dynrelocs): Use plt_type instead of old_got and is_vxworks. - (ppc_elf_size_dynamic_sections): Likewise. - (ppc_elf_relax_section): Likewise. - (ppc_elf_relocate_section): Likewise. - (ppc_elf_finish_dynamic_symbol): Likewise. - (ppc_elf_vxworks_link_hash_table_create): Initialize plt_type. - -2006-02-28 Richard Sandiford <richard@codesourcery.com> - - * elf32-i386.c (elf_i386_link_hash_table): Add next_tls_desc_index. - (elf_i386_link_hash_table_create): Initialize it. - (elf_i386_compute_jump_table_size): Use it instead of - srelplt->reloc_count. - (allocate_dynrelocs): Likewise. - (elf_i386_size_dynamic_sections): Likewise. - (elf_i386_relocate_section): Likewise. - -2006-02-27 Jakub Jelinek <jakub@redhat.com> - - * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Handle S flag. - (_bfd_elf_write_section_eh_frame): Likewise. - -2006-02-27 Carlos O'Donell <carlos@codesourcery.com> - - * po/Make-in: Add html target. - -2006-02-27 Richard Sandiford <richard@codesourcery.com> - - * elf-m10300.c (_bfd_mn10300_elf_finish_dynamic_symbol): Use the - cached hgot entry to check for _GLOBAL_OFFSET_TABLE_. - * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Likewise. - * elf32-bfin.c (bfin_finish_dynamic_symbol): Likewise. - * elf32-cris.c (elf_cris_finish_dynamic_symbol): Likewise. - * elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Likewise. - * elf32-i386.c (elf_i386_finish_dynamic_symbol): Likewise. - * elf32-m32r.c (m32r_elf_finish_dynamic_symbol): Likewise. - * elf32-m68k.c (elf_m68k_finish_dynamic_symbol): Likewise. - * elf32-sh.c (sh_elf_finish_dynamic_symbol): Likewise. - * elf32-vax.c (elf_vax_finish_dynamic_symbol): Likewise. - * elf32-xtensa.c (elf_xtensa_finish_dynamic_symbol): Likewise. - * elf64-sh64.c (sh64_elf64_finish_dynamic_symbol): Likewise. - * elf64-x86-64.c (elf64_x86_64_finish_dynamic_symbol): Likewise. - * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Likewise. - * elf32-s390.c (elf_s390_finish_dynamic_symbol): Likewise. Also use - the cached hplt entry to check for _PROCEDURE_LINKAGE_TABLE_. - * elf64-alpha.c (elf64_alpha_finish_dynamic_symbol): Likewise. - * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise. - * elfxx-ia64.c (elfNN_ia64_finish_dynamic_symbol): Likewise. - * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Likewise. - -2006-02-25 Richard Sandiford <richard@codesourcery.com> - - * elf-bfd.h (elf_link_hash_table): Add hplt field. - * elflink.c (_bfd_elf_create_dynamic_sections): Initialize it. - * elf-m10300.c (_bfd_mn10300_elf_create_got_section): Likewise. - * elf32-frv.c (_frv_create_got_section): Likewise. - * elf32-m32r.c (m32r_elf_create_dynamic_sections): Likewise. - * elf32-sh.c (sh_elf_create_dynamic_sections): Likewise. - * elf64-alpha.c (elf64_alpha_create_dynamic_sections): Likewise. - * elf64-sh64.c (sh64_elf64_create_dynamic_sections): Likewise. - * elf32-i386.c (elf_i386_link_hash_table): Remove hgot and hplt. - (elf_i386_link_hash_table_create): Don't initialize them. - (elf_i386_size_dynamic_sections): Use the generic ELF hplt and - hgot fields. - (elf_i386_finish_dynamic_symbol): Likewise. - * elf32-ppc.c (ppc_elf_link_hash_table): Remove hplt. - (ppc_elf_size_dynamic_sections): Use the generic ELF hplt fields. - (ppc_elf_finish_dynamic_symbol): Likewise. - -2006-02-24 DJ Delorie <dj@redhat.com> - - * elf32-m32c.c (m32c_elf_howto_table): Add relaxation relocs. - (m32c_elf_relocate_section): Don't relocate them. - (compare_reloc): New. - (relax_reloc): Remove. - (m32c_offset_for_reloc): New. - (m16c_addr_encodings): New. - (m16c_jmpaddr_encodings): New. - (m32c_addr_encodings): New. - (m32c_elf_relax_section): Relax jumps and address displacements. - (m32c_elf_relax_delete_bytes): Adjust for internal syms. Fix up - short jumps. - - * reloc.c: Add m32c relax relocs. - * libbfd.h: Regenerate. +2007-03-18 Mark Shinwell <shinwell@codesourcery.com> + + * bfd-in.h (bfd_elf32_arm_set_target_relocs): Add "bfd *" + argument and extra last argument. * bfd-in2.h: Regenerate. - -2006-02-24 H.J. Lu <hongjiu.lu@intel.com> + * elf32-arm.c (elf32_arm_obj_tdata): Add no_enum_size_warning + member. + (bfd_elf32_arm_set_target_relocs): Add "bfd *" argument and + extra last argument. Set no_enum_size_warning appropriately. + (elf32_arm_merge_eabi_attributes): Improve enum sizes + diagnostic, suppressing it when no_enum_size_warning dictates. - PR ld/2218 - * elf-bfd.h (elf_backend_data): Add elf_backend_fixup_symbol. - (_bfd_elf_link_hash_fixup_symbol): New. +2007-03-20 Nick Clifton <nickc@redhat.com> - * elflink.c (_bfd_elf_link_hash_fixup_symbol): New. - (_bfd_elf_fix_symbol_flags): Call elf_backend_fixup_symbol if - it isn't NULL. + PR binutils/3535 + * elf.c (copy_private_bfd_data): Widen the scope of Solaris + specific conditions that need the program headers to be + rewritten. - * elfxx-ia64.c (elf_backend_fixup_symbol): Defined. +2007-03-19 H.J. Lu <hongjiu.lu@intel.com> - * elfxx-target.h (elf_backend_fixup_symbol): New. - (elfNN_bed): Initialize elf_backend_fixup_symbol. + * peXXigen.c (_bfd_XXi_swap_aouthdr_in): Store Magic, + MajorLinkerVersion, MinorLinkerVersion, SizeOfCode, + SizeOfInitializedData, SizeOfUninitializedData, + AddressOfEntryPoint, BaseOfCode and BaseOfData in internal + extra PE a.out header. + (IMAGE_NT_OPTIONAL_HDR_MAGIC): Defined as 0x10b if not defined. + (IMAGE_NT_OPTIONAL_HDR64_MAGIC): Defined as 0x20b if not + defined. + (IMAGE_NT_OPTIONAL_HDRROM_MAGIC): Defined as 0x107 if not + defined. + (_bfd_XX_print_private_bfd_data_common): Also print Magic, + MajorLinkerVersion, MinorLinkerVersion, SizeOfCode, + SizeOfInitializedData, SizeOfUninitializedData, + AddressOfEntryPoint, BaseOfCode and BaseOfData from internal + extra PE a.out header. -2006-02-23 H.J. Lu <hongjiu.lu@intel.com> +2007-03-18 H.J. Lu <hongjiu.lu@intel.com> - * cpu-ia64-opc.c (ins_immu5b): New. - (ext_immu5b): Likewise. - (elf64_ia64_operands): Add IMMU5b. + * targets.c (_bfd_target_vector): Add bfd_efi_app_x86_64_vec + only if BFD64 is defined. -2006-02-21 Alan Modra <amodra@bigpond.net.au> +2007-03-17 Alan Modra <amodra@bigpond.net.au> - PR ld/2218 - * elf32-arm.c (allocate_dynrelocs): Ensure undef weak sym in pie - is dynamic. - * elf32-hppa.c (allocate_dynrelocs): Likewise. - * elf32-i386.c (allocate_dynrelocs): Likewise. - * elf32-s390.c (allocate_dynrelocs): Likewise. - * elf32-sh.c (allocate_dynrelocs): Likewise. - * elf64-s390.c (allocate_dynrelocs): Likewise. - * elf64-x86-64.c (allocate_dynrelocs): Likewise. - * elf32-m32r.c (allocate_dynrelocs): Likewise. Discard relocs - on undef weak with non-default visibility too. - * elfxx-sparc.c (allocate_dynrelocs): Ditto. + * elf32-spu.c (spu_elf_size_stubs): Always use an overlay stub + on setjmp calls. -2006-02-21 Alan Modra <amodra@bigpond.net.au> +2007-03-15 H.J. Lu <hongjiu.lu@intel.com> - * bfd.c: (_bfd_default_error_handler): Don't call abort on - error, instead call _exit. - (_bfd_abort): Call _exit not xexit. + * doc/Makefile.in: Regenerated. -2006-02-17 Kevin Buettner <kevinb@redhat.com> +2007-03-15 H.J. Lu <hongjiu.lu@intel.com> - * elf32-frv.c (elf32_frv_grok_prstatus, elf32_frv_grok_psinfo): - New functions. - * elf_backend_grok_prstatus, elf_backend_grok_psinfo): Define. + * Makefile.am (bfdver.h): Substitute report_bugs_to. Also + create doc/bfdver.texi. + * Makefile.in: Regenerated. -2006-02-17 Shrirang Khisti <shrirangk@kpitcummins.com> - Anil Paranjape <anilp1@kpitcummins.com> - Shilin Shakti <shilins@kpitcummins.com> + * configure.in (--with-bugurl): New option. + * configure: Regenerated. - * Makefile.am: Add xc16x related entry - * Makefile.in: Regenerate - * archures.c: Add bfd_xc16x_arch - * bfd-in2.h: Regenerate - * config.bfd: Add xc16x-*-elf - * configure.in: Add bfd_elf32_xc16x_vec + * version.h (REPORT_BUGS_TO): New. + +2007-03-13 H.J. Lu <hongjiu.lu@intel.com> + + PR binutils/3826 + * elf-bfd.h (elf_backend_data): Add elf_osabi. + (_bfd_elf_set_osabi): New. + + * elf.c (_bfd_elf_set_osabi): New. + + * elf32-hppa.c (elf32_hppa_post_process_headers): Removed. + (elf_backend_post_process_headers): Defined with + _bfd_elf_set_osabi. + (ELF_OSABI): Properly defined for each target. + + * elf32-i370.c (i370_elf_post_process_headers): Removed. + (ELF_OSABI): Defined. + (elf_backend_post_process_headers): Defined with + _bfd_elf_set_osabi. + + * elf32-i386.c (ELF_OSABI): Defined to ELFOSABI_FREEBSD for + freebsd. + (elf_i386_post_process_headers): Set EI_OSABI with elf_osabi. + + * elf32-msp430.c (elf32_msp430_post_process_headers): Removed. + (ELF_OSABI): Defined. + (elf_backend_post_process_headers): Defined with + _bfd_elf_set_osabi. + + * elf64-alpha.c (ELF_OSABI): Defined to ELFOSABI_FREEBSD for + freebsd. + (elf64_alpha_fbsd_post_process_headers): Set EI_OSABI with + elf_osabi. + + * elf64-hppa.c (elf64_hppa_post_process_headers): Set EI_OSABI + with elf_osabi. + (ELF_OSABI): Properly defined for each target. + (elf_backend_post_process_headers): Defined with + _bfd_elf_set_osabi for Linux. + + * elf64-sparc.c (elf64_sparc_fbsd_post_process_headers): Removed. + (ELF_OSABI): Defined to ELFOSABI_FREEBSD for freebsd. + (elf_backend_post_process_headers): Defined with + _bfd_elf_set_osabi. + + * elf64-x86-64.c (elf64_x86_64_fbsd_post_process_headers): Removed. + (ELF_OSABI): Defined to ELFOSABI_FREEBSD for freebsd. + (elf_backend_post_process_headers): Defined with + _bfd_elf_set_osabi. + + * elfcode.h (elf_object_p): Match the ELFOSABI_NONE ELF target + with any ELF target of the compatible machine for which we do not + have a specific backend. + + * elfxx-ia64.c (elfNN_hpux_post_process_headers): Set EI_OSABI + with elf_osabi. + + * elfxx-target.h (ELF_OSABI): Default to ELFOSABI_NONE. + (elfNN_bed): Initialize elf_osabi with ELF_OSABI. + +2007-03-08 Alan Modra <amodra@bigpond.net.au> + + * elf32-v850.c (v850_elf_link_output_symbol_hook): Clean out + V850_OTHER_* bits. + +2007-03-08 Alan Modra <amodra@bigpond.net.au> + + * Makefile.am (BFD64_BACKENDS): Add efi-app-x86_64.lo. + (BFD64_BACKENDS_CFILES): Add efi-app-x86_64.c. + Run "make dep-am". + * Makefile.in: Regenerate. + * po/SRC-POTFILES.in: Regenerate. + +2007-03-07 H.J. Lu <hongjiu.lu@intel.com> + + * config.bfd (x86_64-*-freebsd*): Add bfd_efi_app_x86_64_vec. + (x86_64-*-kfreebsd*-gnu): Likewise. + (x86_64-*-netbsd*): Likewise. + (x86_64-*-openbsd*): Likewise. + (x86_64-*-linux-*): Likewise. + + * configure.in: Support bfd_efi_app_x86_64_vec. + * configure: Regenerated. + + * efi-app-x86_64.c: New file. + + * targets.c (bfd_efi_app_x86_64_vec): New. + (_bfd_target_vector): Add bfd_efi_app_x86_64_vec. + +2007-03-07 Kai Tietz <kai.tietz@onevision.com> + + * reloc.c (bfd_generic_get_relocated_section_contents): Remove + const for type reloc_howto_type. + +2007-03-07 Alan Modra <amodra@bigpond.net.au> + + PR 3958 + * elf-bfd.h (RELOC_FOR_GLOBAL_SYMBOL): No error on relocatable link. + (elf_discarded_section): Move.. + * bfd-in.h: ..to here. + * bfd-in2.h: Regenerate. + * elflink.c (elf_link_input_bfd): Don't zap relocs against symbols + from discarded sections before relocate_section has done its job. + * reloc.c (bfd_generic_get_relocated_section_contents): Handle + relocs against symbols from discarded sections. + * elf-hppa.h (elf_hppa_howto_table): Set size. Set dst_mask on + SECREL32. + (elf_hppa_relocate_section): Handle relocatable link after setting + sec, sym, h etc. for final link. Squash error messages for + relocatable link. Clear section contents for relocs against + symbols in discarded sections, and zero reloc. Remove existing + zero r_symndx code. + * elf-m10200.c (mn10200_elf_relocate_section): Likewise. + * elf-m10300.c (mn10300_elf_relocate_section): Likewise. + * elf32-arm.c (elf32_arm_relocate_section): Likewise. + * elf32-avr.c (elf32_avr_relocate_section): Likewise. + * elf32-bfin.c (bfinfdpic_relocate_section): Likewise. + (bfin_relocate_section): Likewise. + * elf32-cr16c.c (elf32_cr16c_relocate_section): Likewise. + * elf32-cris.c (cris_elf_relocate_section): Likewise. + * elf32-crx.c (elf32_crx_relocate_section): Likewise. + * elf32-d10v.c (elf32_d10v_relocate_section): Likewise. + * elf32-fr30.c (fr30_elf_relocate_section): Likewise. + * elf32-frv.c (elf32_frv_relocate_section): Likewise. + * elf32-h8300.c (elf32_h8_relocate_section): Likewise. + * elf32-hppa.c (elf32_hppa_relocate_section): Likewise. + * elf32-i370.c (i370_elf_relocate_section): Likewise. + * elf32-i386.c (elf_i386_relocate_section): Likewise. + * elf32-i860.c (elf32_i860_relocate_section): Likewise. + * elf32-ip2k.c (ip2k_elf_relocate_section): Likewise. + * elf32-iq2000.c (iq2000_elf_relocate_section): Likewise. + * elf32-m32c.c (m32c_elf_relocate_section): Likewise. + * elf32-m32r.c (m32r_elf_relocate_section): Likewise. + * elf32-m68hc1x.c (elf32_m68hc11_check_relocs): Likewise. + * elf32-m68k.c (elf_m68k_relocate_section): Likewise. + * elf32-mcore.c (mcore_elf_relocate_section): Likewise. + * elf32-mep.c (mep_elf_relocate_section): Likewise. + * elf32-msp430.c (elf32_msp430_relocate_section): Likewise. + * elf32-mt.c (mt_elf_relocate_section): Likewise. + * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise. + * elf32-ppc.c (ppc_elf_relocate_section): Likewise. + * elf32-s390.c (elf_s390_relocate_section): Likewise. + * elf32-score.c (_bfd_score_elf_relocate_section): Likewise. + * elf32-sh.c (sh_elf_relocate_section): Likewise. + * elf32-spu.c (spu_elf_relocate_section): Likewise. + * elf32-v850.c (v850_elf_relocate_section): Likewise. + * elf32-vax.c (elf_vax_relocate_section): Likewise. + * elf32-xc16x.c (elf32_xc16x_relocate_section): Likewise. + * elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise. + * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise. + * elf64-alpha.c (elf64_alpha_relocate_section_r): Likewise. + (elf64_alpha_relocate_section): Likewise. + * elf64-mmix.c (mmix_elf_relocate_section): Likewise. + * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. + * elf64-s390.c (elf_s390_relocate_section): Likewise. + * elf64-sh64.c (sh_elf64_relocate_section): Likewise. + * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. + * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. + * elfxx-mips.c (_bfd_mips_elf_relocate_section): Likewise. + * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise. + + * elf32-arm.c (elf32_arm_relocate_section): Always adjust section + symbols for relocatable link. Don't use always-zero st_value. + (elf_backend_rela_normal): Don't define. + * elf32-bfin.c (bfinfdpic_relocate_section): Use + RELOC_FOR_GLOBAL_SYMBOL. + * elf32-frv.c (elf32_frv_relocate_section): Likewise. + * elf32-d10v.c (elf32_d10v_relocate_section): Combine SEC_MERGE + section symbol adjustments with same for relocatable link. + * elf32-i386.c (elf_i386_relocate_section): Likewise. + * elf32-m68hc1x.c (m68hc11_get_relocation_value): Move.. + (elf32_m68hc11_check_relocs): ..to here. + * elf32-score.c (score_elf_final_link_relocate): Remove zero + r_symndx code. + * elfxx-mips.c (mips_elf_calculate_relocation): Likewise. + +2007-03-07 Alan Modra <amodra@bigpond.net.au> + + PR 4144 + * elf.c (assign_file_positions_for_load_sections): Don't + adjust p_memsz for !SEC_LOAD section vma modulo page size. + Instead, use the same lma based adjustment for SEC_LOAD + sections. + +2007-03-01 Bob Wilson <bob.wilson@acm.org> + + * elf32-xtensa.c (analyze_relocations): Zero src_count if not relaxing. + (find_relaxable_sections): Do not increment src_count for unknown + opcodes. Decode only once instead of calling is_l32r_relocation. + (compute_text_actions): Remove unused no_insn_move flag. Assert that + src_next matches src_count in relax_info. + +2007-03-01 Joseph Myers <joseph@codesourcery.com> + + * Makefile.am (bfdver.h): Use "." not " " between version number + and date. + * Makefile.in: Regenerate. + * configure.in (PKGVERSION): Default to "(GNU Binutils) ". * configure: Regenerate. - * targets.c: Added xc16x related information - * cpu-xc16x.c: New file - * reloc.c: Add new relocations specific to xc16x: - BFD_RELOC_XC16X_PAG, BFD_RELOC_XC16X_POF, BFD_RELOC_XC16X_SEG, - BFD_RELOC_XC16X_SOF - * elf32-xc16x.c: New file. - -2006-02-17 Alan Modra <amodra@bigpond.net.au> - - * elf32-ppc.c (allocate_dynrelocs): Tweak undef weak handling. - * elf64-ppc.c (allocate_dynrelocs): Likewise. - -2006-02-17 Alan Modra <amodra@bigpond.net.au> - PR ld/2218 - * elf64-ppc.c (allocate_dynrelocs): Ensure undef weak sym is - dynamic. - (ppc64_elf_relocate_section): Check output reloc section size. - * elf32-ppc.c (allocate_dynrelocs): Simplify undef weak test. +2007-02-28 Nathan Sidwell <nathan@codesourcery.com> + + * config.bfd (sh-*-uclinux, sh[12]-*-uclinux): New stanza. + +2007-02-27 Alan Modra <amodra@bigpond.net.au> + + * elf32-spu.h (struct _ovl_stream): Make "start" and "end" const. + * elf32-spu.c (ovl_mgr_pread): Add const to casts. + +2007-02-23 Carlos O'Donell <carlos@codesourcery.com> + + * dwarf2.c (_bfd_dwarf2_find_nearest_line): Assume 32-bit + DWARF even with 64-bit addresses. + (_bfd_dwarf2_find_nearest_line): Likewise. + +2007-02-23 Nick Clifton <nickc@redhat.com> + + PR binutils/3535 + * elf.c (copy_private_bfd_data): Always rewrite the program + headers when a Solaris interpreter segment is involved. + +2007-02-22 Paul Brook <paul@codesourcery.com> + + * elflink.c (gc_mark_hook_fn): Remove. + (_bfd_elf_gc_mark): Rename gc_mark_hook_fn to elf_gc_mark_hook_fn. + (bfd_elf_gc_sections): Ditto. Call gc_mark_extra_sections. + * elf-bfd.h (elf_gc_mark_hook_fn): Define. + (elf_backend_data): Add gc_mark_extra_sections. + * elfxx-target.h (elf_backend_gc_mark_extra_sections): Provide default + definition. + (elfNN_bed): Add elf_backend_gc_mark_extra_sections. + * elf32-arm.c (elf32_arm_gc_mark_extra_sections): New function. + (elf_backend_gc_mark_extra_sections): Define. + +2007-02-21 Nick Clifton <nickc@redhat.com> + + * elf.c (_bfd_elf_map_sections_to_segments): If the + override_segment_assignment callback is defined then call it. + +2007-02-21 Alan Modra <amodra@bigpond.net.au> -2006-02-16 H.J. Lu <hongjiu.lu@intel.com> + * elf32-spu.c (spu_elf_size_stubs): Correct order of warning args. - PR ld/2322 - * elf.c (get_segment_type): New function. - (_bfd_elf_print_private_bfd_data): Use it. - (print_segment_map): New function. - (assign_file_positions_for_segments): Call print_segment_map - when there are not enough room for program headers. +2007-02-19 Thiemo Seufer <ths@mips.com> -2006-02-16 Nick Hudson <nick.hudson@dsl.pipex.com> + * elfxx-mips.c (_bfd_mips_elf_print_private_bfd_data): Remove + translation marker from untranslatable strings. - * config.bfd (mips*el-*-netbsd*, mips*-*-netbsd*): Use - traditional MIPS ELF targets. - -2006-02-15 H.J. Lu <hongjiu.lu@intel.com> - - PR binutils/2338 - * dwarf2.c (check_function_name): New function. - (_bfd_dwarf2_find_nearest_line): Use check_function_name to - check if function is correct. - -2006-02-16 Alan Modra <amodra@bigpond.net.au> - - * elflink.c (_bfd_elf_default_action_discarded): Return 0 for - debug sections. - (elf_link_input_bfd): Adjust comments. - -2006-02-10 H.J. Lu <hongjiu.lu@intel.com> - - * elf.c (copy_private_bfd_data): Minor update. - -2006-02-10 H.J. Lu <hongjiu.lu@intel.com> - - PR binutils/2258 - * elf.c (copy_private_bfd_data): Renamed to ... - (rewrite_elf_program_header): This. - (copy_elf_program_header): New function. - (copy_private_bfd_data): Likewise. - -2006-02-07 Nathan Sidwell <nathan@codesourcery.com> - - * archures.c (bfd_mach_mcf5200, bfd_mach_mcf5206e, - bfd_mach_mcf5307, bfd_mach_mcf5407, bfd_mach_mcf528x, - bfd_mach_mcfv4e, bfd_mach_mcf521x, bfd_mach_mcf5249, - bfd_mach_mcf547x, bfd_mach_mcf548x): Remove. - (bfd_mach_mcf_isa_a, bfd_mach_mcf_isa_a_div, - bfd_mach_mcf_isa_a_div_mac, bfd_mach_mcf_isa_a_div_emac, - bfd_mach_mcf_isa_aplus, bfd_mach_mcf_isa_aplus_mac, - bfd_mach_mcf_isa_aplus_emac, bfd_mach_mcf_isa_aplus_usp, - bfd_mach_mcf_isa_aplus_usp_mac, bfd_mach_mcf_isa_aplus_usp_emac, - bfd_mach_mcf_isa_b, bfd_mach_mcf_isa_b_mac, bfd_mach_mcf_isa_b_emac, - bfd_mach_mcf_isa_b_usp_float, bfd_mach_mcf_isa_b_usp_float_mac, - bfd_mach_mcf_isa_b_usp_float_emac): New. - (bfd_default_scan): Update coldfire mapping. - * bfd-in.h (bfd_m68k_mach_to_features, - bfd_m68k_features_to_mach): Declare. - * bfd-in2.h: Rebuilt. - * cpu-m68k.c (arch_info_struct): Add new coldfire machines, - adjust legacy names. - (m68k_arch_features): New. - (bfd_m68k_mach_to_features, - bfd_m68k_features_to_mach): Define. - * elf32-m68k.c (elf32_m68k_object_p): New. - (elf32_m68k_merge_private_bfd_data): Merge the CF EF flags. - (elf32_m68k_print_private_bfd_data): Print the CF EF flags. - (elf_backend_object_p): Define. - * ieee.c (ieee_write_processor): Update coldfire machines. - * libbfd.h: Rebuilt. - -2006-02-06 Steve Ellcey <sje@cup.hp.com> - - * elfxx-ia64.c (elfNN_ia64_fake_sections): Set SHF_IA_64_HP_TLS - if SHF_TLS is set. - -2006-02-05 Arnold Metselaar <arnold.metselaar@planet.nl> - - * coff-z80.c (r_imm24): New howto. - (rtype2howto): New case R_IMM24. - (coff_z80_reloc_type_lookup): New case BFD_RELOC_24. - (extra_case): Use bfd_get_8 for R_IMM8, new case R_IMM24. - -2006-02-04 Richard Sandiford <richard@codesourcery.com> - - * elfxx-mips.c (mips_elf_initialize_tls_index): If a TLS symbol - has already been assigned a GOT index, copy that index to the - current hash table entry. - -2006-02-01 Eric Botcazou <ebotcazou@libertysurf.fr> - - * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Reinstate bypass - for call-to-undefweak reloc overflow. - -2006-01-31 Eric Botcazou <ebotcazou@libertysurf.fr> - - * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Reinstate bypass - for 32-bit relocs overflow. - -2006-01-27 Paul Brook <paul@codesourcery.com> - - * elf32-arm.c (elf32_arm_get_symbol_type): Allow STT_TLS thumb - objects. - -2006-01-18 Alexandre Oliva <aoliva@redhat.com> - - Introduce TLS descriptors for i386 and x86_64. - * reloc.c (BFD_RELOC_386_TLS_GOTDESC, BFD_RELOC_386_TLS_DESC, - BFD_RELOC_386_TLS_DESC_CALL, BFD_RELOC_X86_64_GOTPC32_TLSDESC, - BFD_RELOC_X86_64_TLSDESC, BFD_RELOC_X86_64_TLSDESC_CALL): New. - * libbfd.h, bfd-in2.h: Rebuilt. - * elf32-i386.c (elf_howto_table): New relocations. - (R_386_tls): Adjust. - (elf_i386_reloc_type_lookup): Map new relocations. - (GOT_TLS_GDESC, GOT_TLS_GD_BOTH_P): New macros. - (GOT_TLS_GD_P, GOT_TLS_GDESC_P, GOT_TLS_GD_ANY_P): New macros. - (struct elf_i386_link_hash_entry): Add tlsdesc_got field. - (struct elf_i386_obj_tdata): Add local_tlsdesc_gotent field. - (elf_i386_local_tlsdesc_gotent): New macro. - (struct elf_i386_link_hash_table): Add sgotplt_jump_table_size. - (elf_i386_compute_jump_table_size): New macro. - (link_hash_newfunc): Initialize tlsdesc_got. - (elf_i386_link_hash_table_create): Set sgotplt_jump_table_size. - (elf_i386_tls_transition): Handle R_386_TLS_GOTDESC and - R_386_TLS_DESC_CALL. - (elf_i386_check_relocs): Likewise. Allocate space for - local_tlsdesc_gotent. - (elf_i386_gc_sweep_hook): Handle R_386_TLS_GOTDESC and - R_386_TLS_DESC_CALL. - (allocate_dynrelocs): Count function PLT relocations. Reserve - space for TLS descriptors and relocations. - (elf_i386_size_dynamic_sections): Reserve space for TLS - descriptors and relocations. Set up sgotplt_jump_table_size. - Don't zero reloc_count in srelplt. - (elf_i386_always_size_sections): New. Set up _TLS_MODULE_BASE_. - (elf_i386_relocate_section): Handle R_386_TLS_GOTDESC and - R_386_TLS_DESC_CALL. - (elf_i386_finish_dynamic_symbol): Use GOT_TLS_GD_ANY_P. - (elf_backend_always_size_sections): Define. - * elf64-x86-64.c (x86_64_elf_howto): Add R_X86_64_GOTPC32_TLSDESC, - R_X86_64_TLSDESC, R_X86_64_TLSDESC_CALL. - (R_X86_64_standard): Adjust. - (x86_64_reloc_map): Map new relocs. - (elf64_x86_64_rtype_to_howto): New, split out of... - (elf64_x86_64_info_to_howto): ... this function, and... - (elf64_x86_64_reloc_type_lookup): ... use it to map elf_reloc_val. - (GOT_TLS_GDESC, GOT_TLS_GD_BOTH_P): New macros. - (GOT_TLS_GD_P, GOT_TLS_GDESC_P, GOT_TLS_GD_ANY_P): New macros. - (struct elf64_x86_64_link_hash_entry): Add tlsdesc_got field. - (struct elf64_x86_64_obj_tdata): Add local_tlsdesc_gotent field. - (elf64_x86_64_local_tlsdesc_gotent): New macro. - (struct elf64_x86_64_link_hash_table): Add tlsdesc_plt, - tlsdesc_got and sgotplt_jump_table_size fields. - (elf64_x86_64_compute_jump_table_size): New macro. - (link_hash_newfunc): Initialize tlsdesc_got. - (elf64_x86_64_link_hash_table_create): Initialize new fields. - (elf64_x86_64_tls_transition): Handle R_X86_64_GOTPC32_TLSDESC and - R_X86_64_TLSDESC_CALL. - (elf64_x86_64_check_relocs): Likewise. Allocate space for - local_tlsdesc_gotent. - (elf64_x86_64_gc_sweep_hook): Handle R_X86_64_GOTPC32_TLSDESC and - R_X86_64_TLSDESC_CALL. - (allocate_dynrelocs): Count function PLT relocations. Reserve - space for TLS descriptors and relocations. - (elf64_x86_64_size_dynamic_sections): Reserve space for TLS - descriptors and relocations. Set up sgotplt_jump_table_size, - tlsdesc_plt and tlsdesc_got. Make room for them. Don't zero - reloc_count in srelplt. Add dynamic entries for DT_TLSDESC_PLT - and DT_TLSDESC_GOT. - (elf64_x86_64_always_size_sections): New. Set up - _TLS_MODULE_BASE_. - (elf64_x86_64_relocate_section): Handle R_386_TLS_GOTDESC and - R_386_TLS_DESC_CALL. - (elf64_x86_64_finish_dynamic_symbol): Use GOT_TLS_GD_ANY_P. - (elf64_x86_64_finish_dynamic_sections): Set DT_TLSDESC_PLT and - DT_TLSDESC_GOT. Set up TLS descriptor lazy resolver PLT entry. - (elf_backend_always_size_sections): Define. - -2006-01-17 H.J. Lu <hongjiu.lu@intel.com> - - PR binutils/2096 - * dwarf2.c (comp_unit_contains_address): Update comment. - (_bfd_dwarf2_find_nearest_line): Use section's vma, instead of - lma. Return TRUE only if both comp_unit_contains_address and - comp_unit_find_nearest_line return TRUE. - (_bfd_dwarf2_find_line): Use section's vma, instead of lma. - -2006-01-18 Alan Modra <amodra@bigpond.net.au> - - * elf-bfd.h (struct elf_backend_data): Add gc_mark_dynamic_ref. - (bfd_elf_gc_mark_dynamic_ref_symbol): Declare. - * elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Rename from - elf_gc_mark_dynamic_ref_symbol. Make global. - (bfd_elf_gc_sections): Call bed->gc_mark_dynamic_ref. - * elfxx-target.h (elf_backend_gc_mark_dynamic_ref): Define. +2007-02-19 Alan Modra <amodra@bigpond.net.au> + + * elf-bfd.h (struct elf_backend_data): Add default_execstack. + * elflink.c (bfd_elf_size_dynamic_sections): Heed default_execstack. + * elfxx-target.h (elf_backend_default_execstack): Define to 1. (elfNN_bed): Init new field. - * elf64-ppc.c (elf_backend_gc_mark_dynamic_ref): Define. - (ppc64_elf_gc_mark_dynamic_ref): New function. + * elf64-ppc.c (elf_backend_default_execstack): Define to 0. + +2007-02-17 Mark Mitchell <mark@codesourcery.com> + Nathan Sidwell <nathan@codesourcery.com> + Vladimir Prus <vladimir@codesourcery.com + Joseph Myers <joseph@codesourcery.com> + + * configure.in (--with-pkgversion): New option. + * configure: Regenerate. + * Makefile.am (bfdver.h): Substitute for @bfd_version_package@. + * Makefile.in: Regenerate. + * version.h (BFD_VERSION_STRING): Define using + @bfd_version_package@. + +2007-02-16 Carlos O'Donell <carlos@codesourcery.com> + + * elfxx-mips.c (_bfd_mips_elf_print_private_bfd_data): + Print EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_XGOT + and EF_MIPS_UCODE. + +2007-02-15 Alan Modra <amodra@bigpond.net.au> + + * libbfd-in.h (_bfd_norelocs_get_reloc_upper_bound): Don't define, + declare. + (_bfd_norelocs_canonicalize_reloc): Likewise. + * libbfd.h: Regenerate. + * libbfd.c (_bfd_norelocs_get_reloc_upper_bound): New function. + (_bfd_norelocs_canonicalize_reloc): Likewise. + * binary.c (binary_bfd_reloc_type_lookup): Don't define. + (binary_get_reloc_upper_bound, binary_canonicalize_reloc): Likewise. + (binary_vec): Use _bfd_norelocs in BFD_JUMP_TABLE_RELOCS. + * ihex.c: Similarly. + * mach-o-target.c: Similarly. + * mach-o.c: Similarly. + * mmo.c: Similarly. + * pef.c: Similarly. + * ppcboot.c: Similarly. + * srec.c: Similarly. + * xsym.c: Similarly. + +2007-02-14 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/3953 + * elflink.c (_bfd_elf_add_default_symbol): Check warning symbol + when adding default symbol. + +2007-02-13 Alan Modra <amodra@bigpond.net.au> + + * elf64-ppc.c (create_linkage_sections): Use section ".branch_lt" + for branch lookup table. + +2007-02-12 Alan Modra <amodra@bigpond.net.au> + + * elf64-ppc.c (create_linkage_sections): Don't create + .rela.rodata.brlt for --emit-relocs. + (ppc_build_one_stub): Create relocs for brlt --emit-relocs here. + (ppc_size_one_stub): Count them. Simplify test of stub type + when counting stub relocs. Set SEC_RELOC too. + (ppc64_elf_size_stubs): Clear reloc_count and SEC_RELOC. + (ppc64_elf_finish_dynamic_sections): Output brlt relocs. + +2007-02-12 Alan Modra <amodra@bigpond.net.au> + + * elflink.c (evaluate_complex_relocation_symbols): Ignore relocs + with a zero symbol index. + +2007-02-12 Alan Modra <amodra@bigpond.net.au> + + * elflink.c (bfd_elf_discard_info): Tidy setting of "eh". + +2007-02-05 Dave Brolley <brolley@redhat.com> + Stan Cox <scox@redhat.com> + + PR ld/3972 + * elflink.c (elf_link_input_bfd): Always setup finfo->internal_syms. + +2007-02-05 Dave Brolley <brolley@redhat.com> + Richard Sandiford <rsandifo@redhat.com> + Stan Cox <scox@redhat.com> + Nick Clifton <nickc@redhat.com> + DJ Delorie <dj@redhat.com> + Frank Ch. Eigler <fche@redhat.com> + Ben Elliston <bje@redhat.com> + Richard Henderson <rth@redhat.com> + + * Makefile.am (ALL_MACHINES): Add cpu-mep.lo. + (ALL_MACHINES_CFILES): Add CPU_MEP.c. + (BFD32_BACKENDS): Add elf32-mep.lo. + (BFD32_BACKENDS_CFILES): Add elf32-mep.c. + (cpu-mep.lo,elf32-mep.lo): New targets. + * archures.c (bfd_arch_mep): New enumerator. + (bfd_mach_mep, bfd_mach_mep_h1): New macros. + (bfd_mep_arch): New external variable. + (bfd_archures_list): Add bfd_mep_arch. + * config.bfd: Support mep-*-elf. + * configure.in: Support bfd_elf32_mep_vec and bfd_elf32_mep_little_vec. + * reloc.c (BFD_RELOC_MEP_*): New relocation numbers. + * targets.c (bfd_elf32_mep_vec,bfd_elf32_mep_little_vec): New extern + declarations. + (_bfd_target_vector): Add bfd_elf32_mep_vec and + bfd_elf32_mep_little_vec. + * mep-relocs.pl: New file. + * cpu-mep.c: New file. + * elf32-mep.c: New file. + * bfd-in2.h: Regenerate. + * po/POTFILES.in: Regenerate. + * libbfd.h: Regenerate. + * Makefile.in: Regenerate. + * configure: Regenerate. -2006-01-17 Alan Modra <amodra@bigpond.net.au> +2007-02-05 Dave Brolley <brolley@redhat.com> + + * elflink.c (evaluate_complex_relocation_symbols): Check for + STT_SRELC for global symbols. + (perform_complex_relocations): Renamed to + perform_complex_relocation and now examines only one relocation. + (elf_link_input_bfd): Don't call perform_complex_relocations. + * elf-bfd.h (bfd_elf_perform_complex_relocation_: New prototype. + * elf32-mep.c (mep_elf_howto_table): Add R_RELC. + (OD,OS,OU): #undefs corrected to N, S and U repectively. + (mep_reloc_type_lookup): Handle BFD_RELOC_RELC. + (complex_reloc_installation_howto): Removed. + (mep_info_to_howto_rela): Remove special case for r_type==0xff. + (mep_elf_relocate_section): Call bfd_elf_perform_complex_relocation. + +2007-02-05 Dave Brolley <brolley@redhat.com> + Richard Sandiford <rsandifo@redhat.com> + DJ Delorie <dj@redhat.com> + Graydon Hoare <graydon@redhat.com> + Nick Clifton <nickc@cambridge.redhat.com> + Jeff Holcomb <jeffh@redhat.com> + Frank Ch. Eigler <fche@redhat.com> + + * elf-bfd.h (bfd_elf_perform_complex_relocations): New prototype. + * elf.c (swap_out_syms): Handle BSF_RELC and BSF_SRELC. + * elfcode.h (elf_slurp_symbol_table): Handle STT_RELC and STT_SRELC. + * elflink.c (set_symbolValue): New static function. + (resolve_symbol): Likewise. + (resolve_section): Likewise. + (undefined_reference): Likewise. + (eval_symbol): Likewise. + (evaluate_complex_relocation_symbols): Likewise. + (put_value): Likewise. + (get_value): Likewise. + (decode_complex_addend): + (bfd_elf_perform_complex_relocation): New function. + (elf_link_input_bfd): Call evaluate_complex_relocation_symbols. + * reloc.c (BFD_RELOC_RELC): New relocation number. + * syms.c (BSF_RELC,BSF_SRELC): New macros. + +2007-02-05 Bob Wilson <bob.wilson@acm.org> + + * elf32-xtensa.c (elf_xtensa_make_sym_local): Delete. + (elf_xtensa_hide_symbol, elf_backend_hide_symbol): Delete. + (elf_xtensa_fix_refcounts, elf_xtensa_allocate_plt_size) + (elf_xtensa_allocate_got_size): Replace these with... + (elf_xtensa_allocate_dynrelocs): ...this new function. + (elf_xtensa_size_dynamic_sections): Use it. + +2007-02-05 Bob Wilson <bob.wilson@acm.org> + + * elf32-xtensa.c (elf_howto_table) <R_XTENSA_GLOB_DAT> + <R_XTENSA_JMP_SLOT, R_XTENSA_RELATIVE, R_XTENSA_PLT, R_XTENSA_DIFF32>: + Set src_mask to zero. + <R_XTENSA_DIFF8, R_XTENSA_DIFF16>: Likewise. Also fix dst_mask. + <R_XTENSA_ASM_EXPAND>: Set pcrel_offset to TRUE. + +2007-02-02 Bob Wilson <bob.wilson@acm.org> + + * elf32-xtensa.c (xtensa_elf_dynamic_symbol_p): Renamed to... + (elf_xtensa_dynamic_symbol_p): ...this. + +2007-02-02 Bob Wilson <bob.wilson@acm.org> + + * elf32-xtensa.c (plt_reloc_count): Move into link hash table. + (struct elf_xtensa_link_hash_table): New. + (elf_xtensa_hash_table): New. + (elf_xtensa_link_hash_table_create): New. + (elf_xtensa_check_relocs): Update plt_reloc_count references. + Update arguments to add_extra_plt_sections. + (elf_xtensa_create_dynamic_sections): Record new sections in the hash + table. Update for plt_reloc_count and add_extra_plt_sections. + (add_extra_plt_sections, elf_xtensa_create_plt_entry): Replace dynobj + argument with link info. Update calls to elf_xtensa_get_plt_section + and elf_xtensa_get_gotplt_section. + (elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections) + (elf_xtensa_relocate_section, elf_xtensa_finish_dynamic_sections) + (elf_xtensa_discard_info_for_section, shrink_dynamic_reloc_sections) + (relax_property_section): Get sections from the hash table and update + function calls. + (elf_xtensa_get_plt_section, elf_xtensa_get_gotplt_section): Replace + dynobj argument with link info. Get sections for first plt chunk from + the hash table. + (bfd_elf32_bfd_link_hash_table_create): Define. + +2007-02-02 Jakub Jelinek <jakub@redhat.com> + + * elf-bfd.h (struct elf_obj_tdata): Change symbuf type to void *. + * elf.c (struct elf_symbuf_symbol, struct elf_symbuf_head): New types. + (struct elf_symbol): Change first member into union. + (elf_sort_elf_symbol): Compare pointers to internal syms rather than + internal syms. Only compare st_shndx fields. + (elf_create_symbuf): New function. + (bfd_elf_match_symbols_in_sections): Use it. If symbufs are available + for bfds, use a binary search, otherwise don't qsort symbols + unnecessarily only to select which symbols are for the particular + shndx. + +2007-02-01 Nick Clifton <nickc@redhat.com> + + PR ld/3852 + * elf.c (_bfd_elf_link_hash_table_init): Initialize all the fields + in the elf_link_hash_table structure. + +2007-02-01 Alan Modra <amodra@bigpond.net.au> + + * elf-bfd.h (struct elf_backend_data): Add elf_backend_write_core_note. + * elfxx-target.h (elf_backend_write_core_note): Define and use. + * elf.c (elfcore_write_prpsinfo): Call the above. Add support for + 32-bit core note on 64-bit target. + (elfcore_write_prstatus): Likewise. + (elfcore_write_lwpstatus): Make note_name const. + (elfcore_write_prfpreg): Likewise. + (elfcore_write_pstatus): Add support for 32-bit core note on 64-bit + target. + * elf32-ppc.c (ppc_elf_write_core_note): New function. + (elf_backend_write_core_note): Define. + * elf64-ppc.c (ppc64_elf_write_core_note): New function. + (elf_backend_write_core_note): Define. + +2007-01-31 H.J. Lu <hongjiu.lu@intel.com> + + * elf32-cris.c (INCLUDED_TARGET_FILE): Removed. + (elf32_bed): Defined for elf32-us-cris. + + * elf64-sh64.c (elf64_bed): Defined for Linux. + (INCLUDED_TARGET_FILE): Removed. + + * elfxx-target.h (elfNN_bed): Always define. Don't check + INCLUDED_TARGET_FILE. + +2007-01-31 DJ Delorie <dj@redhat.com> + + * elf-m10300.c (mn10300_elf_relocate_section): Clarify the warning + message for dangerous relocs, special case the common user error. + +2007-01-30 H.J. Lu <hongjiu.lu@intel.com> + + * elf.c (copy_elf_program_header): Start from the first section + in a segment and stop when all sections in a segment are + accounted for. + +2007-01-29 Julian Brown <julian@codesourcery.com> - * elf64-ppc.c (ppc64_elf_gc_mark_hook): Don't hang forever in loop. + * bfd-in2.h: Regenerate. + * bfd-in.h (bfd_arm_vfp11_fix): New enum. Specify how VFP11 + instruction scanning should be done. + (bfd_elf32_arm_init_maps, bfd_elf32_arm_vfp11_erratum_scan) + (bfd_elf32_arm_vfp11_fix_veneer_locations): Add prototypes. + (bfd_elf32_arm_set_target_relocs): Add vfp11 fix type argument to + prototype. + * elf-bfd.h (elf_backend_write_section): Add struct bfd_link_info + argument. + * elf32-arm.c (VFP11_ERRATUM_VENEER_SECTION_NAME) + (VFP11_ERRATUM_VENEER_ENTRY_NAME): Define macros. + (elf32_vfp11_erratum_type): New enum. + (elf32_vfp11_erratum_list): New struct. List of veneers or jumps to + veneers. + (_arm_elf_section_data): Add mapsize, erratumcount, erratumlist. + (elf32_arm_link_hash_table): Add vfp11_erratum_glue_size, + vfp11_fix and num_vfp11_fixes fields. + (elf32_arm_link_hash_table_create): Initialise vfp11_fix, + vfp11_erratum_glue_size, num_vfp11_fixes fields. + (VFP11_ERRATUM_VENEER_SIZE): Define. Size of an (ARM) veneer. + (bfd_elf32_arm_allocate_interworking_sections): Initialise erratum + glue section. + (elf32_arm_section_map_add): Add an code/data mapping symbol entry + to a section's map. + (record_vfp11_erratum_veneer): Create a single veneer, and its + associated symbols. + (bfd_elf32_arm_add_glue_sections_to_bfd): Add vfp11 erratum glue. + (bfd_elf32_arm_init_maps): Initialise mapping symbol table for input + BFDs. + (bfd_elf32_arm_set_vfp11_fix): Set the type of erratum workaround + required. + (bfd_arm_vfp11_pipe): Define VFP11 instruction pipes. + (bfd_arm_vfp11_regno): Recode a register number from a VFP11 insn. + (bfd_arm_vfp11_write_mask): Update write mask according to coded + register number. + (bfd_arm_vfp11_antidependency): New function. + (bfd_arm_vfp11_insn_decode): Decode a VFP11 insn. + (elf32_arm_compare_mapping): Declare. + (bfd_elf32_arm_vfp11_erratum_scan): Scan the sections of an input + BFD for potential erratum-triggering insns. Record results. + (bfd_elf32_arm_vfp11_fix_veneer_locations): Find out where veneers + and branches to veneers have been placed in virtual memory after + layout. + (bfd_elf32_arm_set_target_relocs): Set vfp11_fix field in global + hash table. + (elf32_arm_output_symbol_hook): Remove. + (elf32_arm_write_section): Output veneers, and branches to veneers. + Use maps from input sections, not output sections, for code + byte-swapping. + * elf32-ppc.c (ppc_elf_write_section): Add dummy link_info argument. + * elf32-score.c (_bfd_score_elf_write_section): Likewise. + * elfxx-mips.c (_bfd_mips_elf_write_section): Likewise. + * elfxx-mips.h (_bfd_mips_elf_write_section): Likewise. + +2007-01-27 H.J. Lu <hongjiu.lu@intel.com> + + * elf64-hppa.c (elf64_bed): Defined for HPUX and Linux. + (INCLUDED_TARGET_FILE): Removed. + +2007-01-27 Mike Frysinger <vapier@gentoo.org> + + * elf32-hppa.c (elf32_bed): Define for hpux, linux and netbsd. + (INCLUDED_TARGET_FILE): Remove. + +2007-01-25 DJ Delorie <dj@redhat.com> + + * elf32-m32c.c (m32c_elf_howto_table): Don't complain about + R_M32C_16 or R_M32C_24 relocs. + +2007-01-25 Nick Clifton <nickc@redhat.com> + + PR binutils/3874 + * elf32-avr.c (avr_link_hash_table): Check to make sure that the + hash table was created by elf32_avr_link_hash_table_create before + using it. + (elf32_avr_link_hash_newfunc): New function. Just pass the call + through to _bfd_elf_link_hash_newfunc. + (elf32_avr_link_hash_table_create): Use + elf32_avr_link_hash_newfunc instead of + _bfd_elf_link_hash_newfunc. + (elf32_avr_relocate_section): Check for the hash table pointer + being NULL. + (elf32_avr_relax_section, avr_build_one_stub, + elf32_avr_setup_params, get_local_syms, elf32_avr_size_stubs, + elf32_avr_build_stubs): Likewise. + +2007-01-16 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/3831 + * elf-bfd.h (bfd_elf_link_mark_dynamic_symbol): Add an + argument, Elf_Internal_Sym *. + + * elflink.c (bfd_elf_link_mark_dynamic_symbol): Mark a data + symbol dynamic if info->dynamic_data is TRUE. + (bfd_elf_record_link_assignment): Updated call to + bfd_elf_record_link_assignment. + (_bfd_elf_merge_symbol): Likewise. Always call + bfd_elf_link_mark_dynamic_symbol. + +2007-01-12 H.J. Lu <hongjiu.lu@intel.com> + + * Makefile.am (BFD_LIBS): Removed. + * Makefile.in: Regenerated. + +2007-01-11 H.J. Lu <hongjiu.lu@intel.com> -2006-01-17 Nick Clifton <nickc@redhat.com> + PR binutils/3631 + * Makefile.am (OFILES): Add @bfd64_libs@. + (libbfd_la_SOURCES): Remove $(BFD64_LIBS_CFILES). + * Makefile.in: Regenerated. - PR binutils/2159 - * elf.c (elfcore_write_pstatus): Add ATTRIBUTE_UNUSED to unused - parameters. + * configure.in (bfd_libs): Replaced by ... + (bfd64_libs): This. + * configure: Regenerated. + +2007-01-11 Nathan Sidwell <nathan@codesourcery.com> + + * elf.c (assign_file_positions_for_load_sections): We can + require fewer phdrs than expected. + +2007-01-08 Kazu Hirata <kazu@codesourcery.com> + + * archures.c (bfd_mach_cpu32_fido): Rename to bfd_mach_fido. + * bfd-in2.h: Regenerate. + * cpu-m68k.c (arch_info_struct): Use bfd_mach_fido instead of + bfd_mach_cpu32_fido. + (m68k_arch_features): Use fido_a instead of cpu32. + (bfd_m68k_compatible): Reject the combination of Fido and + ColdFire. Accept the combination of CPU32 and Fido with a + warning. + * elf32-m68k.c (elf32_m68k_object_p, + elf32_m68k_merge_private_bfd_data, + elf32_m68k_print_private_bfd_data): Treat Fido as an + architecture by itself. -2006-01-11 Nick Clifton <nickc@redhat.com> +2007-01-08 Kai Tietz <kai.tietz@onevision.com> - * elf32-arm.c (elf32_arm_output_symbol_hook): Install new entry - into the newly (re)allocated map array. + * config.bfd: Renamed target x86_64-*-mingw64 to x86_64-*-mingw*. -2006-01-09 Alexis Wilke <alexis_wilke@yahoo.com> +2007-01-05 Jakub Jelinek <jakub@redhat.com> - * peXXigen.c (tbl): Add comma after "HIGH3ADJ". + * texhex.c (first_phase): Don't fall through into the default + case. + (pass_over): Replace abort () calls with return FALSE. Fix + buffer overflow. -2006-01-01 Jakub Jelinek <jakub@redhat.com> +2007-01-04 Jie Zhang <jie.zhang@analog.com> - * elf64-ppc.c (ppc64_elf_action_discarded): Return 0 - for .toc1 section. + * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't set + SEC_EXCLUDE on zero size .eh_frame. -For older changes see ChangeLog-2005 +For older changes see ChangeLog-2006 Local Variables: mode: change-log diff --git a/contrib/binutils/bfd/ChangeLog-0203 b/contrib/binutils/bfd/ChangeLog-0203 index f99029a87ae2..1b1abb149da3 100644 --- a/contrib/binutils/bfd/ChangeLog-0203 +++ b/contrib/binutils/bfd/ChangeLog-0203 @@ -858,7 +858,7 @@ Bernardo Innocenti <bernie@develer.com> * archures.c: Add MCF528x (MCFv4) support. - * bfd/cpu-m68k.c (arch_info_struct): Likewise. + * cpu-m68k.c (arch_info_struct): Likewise. * bfd-in2.h: Regenerate. 2003-10-20 Andrew Cagney <cagney@redhat.com> @@ -1953,10 +1953,10 @@ 2003-07-12 Jeff Baker <jbaker@qnx.com> - * bfd/config.bfd (__QNXTARGET__): Define for Neutrino architectures. - * bfd/elf32-arm.h (ELF_MAXPAGESIZE): Set to 4k for Neutrino. - * bfd/elf32-sh.c (ELF_MAXPAGESIZE): Set to 4k for Neutrino. - * bfd/elf32-ppc.c (ELF_MAXPAGESIZE): Set to 4k for Neutrino. + * config.bfd (__QNXTARGET__): Define for Neutrino architectures. + * elf32-arm.h (ELF_MAXPAGESIZE): Set to 4k for Neutrino. + * elf32-sh.c (ELF_MAXPAGESIZE): Set to 4k for Neutrino. + * elf32-ppc.c (ELF_MAXPAGESIZE): Set to 4k for Neutrino. 2003-07-12 Jeff Muizelaar <muizelaar@rogers.com> @@ -2196,13 +2196,13 @@ 2003-07-09 Richard Sandiford <rsandifo@redhat.com> - * bfd/elfxx-mips.c (mips_elf_create_dynamic_relocation): Treat + * elfxx-mips.c (mips_elf_create_dynamic_relocation): Treat forced-local symbols like other locals. Don't create relocations against STN_UNDEF in irix objects. 2003-07-09 Richard Sandiford <rsandifo@redhat.com> - * bfd/elfxx-mips.c (mips_elf_create_dynamic_relocation): In SGI- + * elfxx-mips.c (mips_elf_create_dynamic_relocation): In SGI- compatible objects, add the values of defined external symbols to the addend. diff --git a/contrib/binutils/bfd/ChangeLog-2006 b/contrib/binutils/bfd/ChangeLog-2006 new file mode 100644 index 000000000000..82216d69382b --- /dev/null +++ b/contrib/binutils/bfd/ChangeLog-2006 @@ -0,0 +1,3601 @@ +2006-12-31 H.J. Lu <hongjiu.lu@intel.com> + + * bfd.c (bfd_record_phdr): Call bfd_zalloc instead of bfd_alloc + to allocate elf_segment_map. + +2006-12-29 H.J. Lu <hongjiu.lu@intel.com> + + * elflink.c (elf_link_add_object_symbols): Remember the symbol + size only if it is defined. + +2006-12-25 Kazu Hirata <kazu@codesourcery.com> + + * archures.c (bfd_mach_cpu32_fido): New. + (bfd_mach_mcf_isa_a_nodiv, bfd_mach_mcf_isa_a, + bfd_mach_mcf_isa_a_mac, bfd_mach_mcf_isa_a_emac, + bfd_mach_mcf_isa_aplus, bfd_mach_mcf_isa_aplus_mac, + bfd_mach_mcf_isa_aplus_emac, bfd_mach_mcf_isa_b_nousp, + bfd_mach_mcf_isa_b_nousp_mac, bfd_mach_mcf_isa_b_nousp_emac, + bfd_mach_mcf_isa_b, bfd_mach_mcf_isa_b_mac, + bfd_mach_mcf_isa_b_emac, bfd_mach_mcf_isa_b_float, + bfd_mach_mcf_isa_b_float_mac, bfd_mach_mcf_isa_b_float_emac): + Increment the defined values. + * bfd-in2.h: Regenerate. + * cpu-m68k.c (arch_info_struct): Add en entry for + bfd_mach_cpu32_fido. + * elf32-m68k.c (elf32_m68k_object_p): Handle + EF_M68K_CPU32_FIDO_A. + (elf32_m68k_merge_private_bfd_data): Use EF_M68K_CPU32_MASK. + (elf32_m68k_print_private_bfd_data): Handle + EF_M68K_CPU32_FIDO_A. + +2006-12-25 Mei Ligang <ligang@sunnorth.com.cn> + + * elf32-score.c (score_elf_got_lo16_reloc): Change some variables + type from unsigned to signed. + (score_elf_final_link_relocate): Fix bugs of handling relocation + type R_SCORE_GOT15, R_SCORE_GOT_LO16, and R_SCORE_REL32. + (_bfd_score_elf_relocate_section): Handle R_SCORE_GOT_LO16 + specially. + +2006-12-23 Jakub Jelinek <jakub@redhat.com> + + * elf-bfd.h (struct elf_backend_data): Add as_needed_cleanup hook. + * elfxx-target.h (elf_backend_as_needed_cleanup): Define. + (elfNN_bed): Add as_needed_cleanup hook. + * elflink.c (elf_link_add_object_symbols): Call it when reverting + hash table changes for unneeded --as-needed input. + * elf64-ppc64.c (elf_backend_as_needed_cleanup): Define. + (ppc64_elf_as_needed_cleanup): New function. + +2006-12-19 Kazu Hirata <kazu@codesourcery.com> + + * elf32-m68k.c (elf32_m68k_object_p, + elf32_m68k_print_private_bfd_data): Use EF_M68K_ARCH_MASK to + extract architecture mask. + +2006-12-19 Nathan Sidwell <nathan@codesourcery.com> + + * elf.c (assign_file_positions_for_load_sections): Adjust p_vaddr + by p_vaddr_offset. Copy alignment & use if it is valid. + (rewrite_elf_program_headers): Cope with leading padding in a + segment that does not contain file or program headers. + (copy_elf_program_header): Likewise. + +2006-12-15 Mark Kettenis <kettenis@gnu.org> + + * config.bfd: (sh*-*-openbsd*): Add target. + * configure.in (sh*-*-openbsd*): Set COREFILE to netbsd-core.lo. + * configure: Regenerate. + +2006-12-15 Alan Modra <amodra@bigpond.net.au> + + * opncls.c (bfd_openr_iovec): Add "stat" parameter. + (struct opncls): Add "stat" field. + (opncls_bstat): Call vec->stat. + * bfd-in2.h: Regenerate. + * elf32-spu.c (spu_elf_open_builtin_lib): Adjust. + +2006-12-14 Alan Modra <amodra@bigpond.net.au> + + * elf-bfd.h (struct bfd_elf_section_data): Clarify sec_group + and next_in_group usage. + +2006-12-14 Alan Modra <amodra@bigpond.net.au> + + PR 3704 + * bfdio.c (bfd_bread): Don't read past end of archive elements. + +2006-12-12 Daniel Jacobowitz <dan@codesourcery.com> + + * doc/Makefile.am (bfd_TEXINFOS): Set. + (bfd.info bfd.dvi bfd.html): Delete rule. + * doc/Makefile.in: Regenerated. + +2006-12-11 Daniel Jacobowitz <dan@codesourcery.com> + + * configure.in: Define GENINSRC_NEVER. + * doc/Makefile.am (bfd.info): Remove srcdir prefix. + (MAINTAINERCLEANFILES): Add info file. + (DISTCLEANFILES): Pretend to add info file. + * po/Make-in (.po.gmo): Put gmo files in objdir. + * configure, Makefile.in, doc/Makefile.in: Regenerated. + +2006-12-11 Eric Botcazou <ebotcazou@adacore.com> + + * elflink.c (bfd_elf_gc_sections): Also search for corresponding + sections with .gnu.linkonce.t. prefix. + +2006-12-07 Kazu Hirata <kazu@codesourcery.com> + + * elf32-m68k.c: Update uses of EF_M68K_*. + +2006-12-07 H.J. Lu <hjl@gnu.org> + + PR ld/3666 + * elflink.c (elf_link_add_object_symbols): Keep symbol + visibility for symbols from discarded section. + +2006-12-06 Alan Modra <amodra@bigpond.net.au> + + * elf64-alpha.c (elf64_alpha_merge_symbol_attribute): New function. + (elf_backend_merge_symbol_attribute): Define. + +2006-12-04 Jan Beulich <jbeulich@novell.com> + + * elflink.c (_bfd_elf_link_create_dynamic_sections): Don't create + .eh_frame_hdr section from here anymore. + (bfd_elf_size_dynamic_sections): Call _bfd_elf_maybe_strip_eh_frame_hdr + a little earlier. + +2006-12-01 H.J. Lu <hongjiu.lu@intel.com> + + PR binutils/3609 + * elf.c (rewrite_elf_program_header): Preserve segment physical + address in the output segment if the first section in the + corresponding input segment is null. + +2006-12-01 Nick Clifton <nickc@redhat.com> + + PR 3609 + * elf.c (rewrite_elf_program_header): Do not use the first_section + pointer if it is null. + +2006-11-29 Paul Brook <paul@codesourcery.com> + + * elf32-arm.c (elf32_arm_to_thumb_export_stub): Assert that output + section is present. + (allocate_dynrelocs): Only add export stub for symbols defined in + this object. + +2006-11-29 Paul Brook <paul@codesourcery.com> + + * elf32-arm.c (elf32_arm_to_thumb_export_stub): Assert that output + section is present. + (allocate_dynrelocs): Only add export stub for symbols defined in + this object. + +2006-11-29 Paul Brook <paul@codesourcery.com> + Julian Brown <julian@codesourcery.com> + + * elf32-arm.c (copy_eabi_attributes): Correct starting offset. + (elf32_arm_merge_eabi_attributes): Mark output as initialized. + Only set Tag_CPU_name and Tag_ABI_PCS_R9_use if input attribute + is present. + +2006-11-27 Bob Wilson <bob.wilson@acm.org> + + * elf32-xtensa.c (elf_xtensa_special_sections): Add .xtensa.info. + +2006-11-24 H.J. Lu <hongjiu.lu@intel.com> + + * elf.c (IS_SECTION_IN_INPUT_SEGMENT): New. + (INCLUDE_SECTION_IN_SEGMENT): Use IS_SECTION_IN_INPUT_SEGMENT. + (rewrite_elf_program_header): Don't preserve segment physical + address in the output segment if the first section in the + corresponding input segment is removed. + +2006-11-22 Alan Modra <amodra@bigpond.net.au> + + * pef.c (bfd_pef_make_empty_symbol): Delete function. Define instead. + * xsym.c (bfd_sym_make_empty_symbol): Likewise. + * xsym.h (bfd_sym_make_empty_symbol): Delete. + +2006-11-21 Greg McGary <greg@mcgary.org> + + * elf32-ppc.c (ppc_elf_relocate_section): Fixup D field + at proper offset in little-endian mode. + * elf64-ppc.c (ppc_elf_relocate_section): Likewise. + +2006-11-21 Jakub Jelinek <jakub@redhat.com> + + * elf-eh-frame.c (struct cie): New type. + (cie_compare): Removed. + (cie_eq, cie_hash, cie_compute_hash): New functions. + (_bfd_elf_discard_section_eh_frame): Rewrite not to rely on FDEs + pointing only to last CIE and allow merging of any duplicate CIEs, + not just duplicate consecutive CIEs. + (_bfd_elf_discard_section_eh_frame_hdr): Delete cies hash table. + * elf-bfd.h (struct cie_header, struct cie): Removed. + (struct eh_frame_sec_info): Remove alloced field. + (struct eh_frame_hdr_info): Remove last_cie, last_cie_sec + and last_cie_inf fields. Add cies field. + +2006-11-20 Alan Modra <amodra@bigpond.net.au> + + * bfd-in.h (struct stat): Don't typedef. + * bfdio.c (bfd_get_size): Return a file_ptr. + * cisco-core.c (cisco_core_file_validate): Use bfd_size_type for nread. + * mmo.c (mmo_scan): Use file_ptr for curpos. + * trad-core.c (trad_unix_core): Don't cast statbuf.st_size to + unsigned long. + * bfd-in2.h: Regenerate. + +2006-11-20 Alan Modra <amodra@bigpond.net.au> + + PR 3532 + * bfd-in.h (struct bfd_hash_table): Reorganize. Add "frozen". + * hash.c (bfd_hash_table_init_n): Init frozen. + (bfd_hash_lookup): Don't grow if frozen. + (bfd_hash_traverse): Freeze hash table during traversal. + * bfd-in2.h: Regenerate. + +2006-11-18 Alan Modra <amodra@bigpond.net.au> + + * elflink.c (_bfd_elf_check_kept_section): Test for kept group + section. Save result of checks in kept_section. + (_bfd_elf_section_already_linked): Tidy. Correct comments. + Ignore all group member sections. Handle special matching of + single-member groups against linkonce sections via their group + section. When such a match is found, set kept_section to the + group member section rather than to the group. + +2006-11-14 Phil Lello <phil.lello@homecall.co.uk> + + * peXXigen.c: Updates for PE/COFF V8.0, and clarification + (dir_names): Added CLR Runtime Header to dir_names[]. + (_bfd_XX_print_private_bfd_data_common): Added EFI_ROM and XBOX + subsystem names + (_bfd_XXi_swap_aouthdr_in, _bfd_XXi_swap_aouthdr_out) + (pe_print_idata, pe_print_edata) + (_bfd_XX_bfd_copy_private_bfd_data_common) + (_bfd_XXi_final_link_postscript): Use #DEFINEs for index into + DataDirectory. + +2006-11-13 Daniel Jacobowitz <dan@codesourcery.com> + + * bfd-in.h (bfd_elf32_arm_process_before_allocation): Update + prototype. + (bfd_elf32_arm_set_byteswap_code): New prototype. + * bfd-in2.h: Regenerate. + * elf32-arm.c (bfd_elf32_arm_process_before_allocation): Don't take + byteswap_code as an argument. Revert 2006-11-01 change. + (bfd_elf32_arm_set_byteswap_code): New. + (elf32_arm_size_dynamic_sections): Call + bfd_elf32_arm_process_before_allocation. + +2006-11-10 Thiemo Seufer <ths@mips.com> + + * config.bfd (mips*el-sde-elf*, mips*-sde-elf*): Drop ECOFF support + for SDE configs. + +2006-11-10 Nick Clifton <nickc@redhat.com> + + * config.bfd: Move previously obsoleted targets to the REMOVED + list. + Add maxq-*-coff to the obsolete list. + +2006-11-10 Pedro Alves <pedro_alves@portugalmail.pt> + + * pe-arm-wince.c (LOCAL_LABEL_PREFIX): Define as ".". + * pei-arm-wince.c (LOCAL_LABEL_PREFIX): Likewise. + * coff-arm.c (LOCAL_LABEL_PREFIX): Only define if not defined before. + +2006-11-07 Daniel Jacobowitz <dan@codesourcery.com> + + * elf32-arm.c (find_thumb_glue): Add ERROR_MESSAGE argument; set it + on error. + (find_arm_glue): Likewise. + (elf32_thumb_to_arm_stub, elf32_arm_create_thumb_stub) + (elf32_arm_to_thumb_stub, elf32_arm_final_link_relocate): Add + ERROR_MESSAGE argument and pass it through. + (elf32_arm_to_thumb_export_stub): Update. + (elf32_arm_relocate_section): Use ERROR_MESSAGE and reloc_dangerous. + +2006-11-07 Alan Modra <amodra@bigpond.net.au> + + * elf64-ppc.c (enum _ppc64_sec_type): New. + (struct _ppc64_elf_section_data): Move "t_symndx" into opd union, + and rename fields. Add sec_type and has_14bit_branch. + (struct ppc_link_hash_table): Remove has_14bit_branch. + (get_opd_info, get_tls_mask, ppc64_elf_edit_opd): Adjust. + (ppc64_elf_relocate_section): Likewise. + (ppc64_elf_check_relocs): Likewise. Set per-section has_14bit_branch. + (ppc64_elf_size_stubs): Don't set default group size here. + (group_sections): Instead do so here, and group sections using + their individual requirements. + +2006-11-07 Alan Modra <amodra@bigpond.net.au> + + * elf64-ppc.c (struct ppc64_elf_obj_tdata): Remove "has_dotsym" + and union. + (struct ppc_link_hash_entry): Add "next_dot_sym". + (struct ppc_link_hash_table): Add "dot_syms". + (link_hash_newfunc): Make list of syms starting with a dot. + (ppc_get_stub_entry, adjust_opd_syms): Adjust. + (ppc64_elf_add_symbol_hook): Don't set has_dotsym. + (struct add_symbol_adjust_data): Delete. + (add_symbol_adjust): Simplify params and return. + (ppc64_elf_check_directives): Just process the "dot_syms" lists, + not all syms. + +2006-11-02 Daniel Jacobowitz <dan@codesourcery.com> + + * libbfd-in.h (_bfd_clear_contents): New prototype. + * reloc.c (_bfd_clear_contents): New. + * libbfd.h: Regenerated. + + * elf32-arm.c (elf32_arm_final_link_relocate): Use + _bfd_clear_contents. + * elf32-d10v.c (elf32_d10v_relocate_section): Likewise. + * elf32-hppa.c (elf32_hppa_relocate_section): Likewise. + * elf32-i386.c (elf_i386_relocate_section): Likewise. + * elf32-ppc.c (ppc_elf_relocate_section): Likewise. + * elf32-s390.c (elf_s390_relocate_section): Likewise. + * elf32-sh.c (sh_elf_relocate_section): Likewise. + * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise. + * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. + * elf64-s390.c (elf_s390_relocate_section): Likewise. + * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. + * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise. + + * elfxx-ia64.c (elfNN_ia64_relocate_section): Set value to + zero for discarded symbols. + * elfxx-mips.c (mips_elf_calculate_relocation): Likewise. + +2006-11-01 Thiemo Seufer <ths@mips.com> + David Ung <davidu@mips.com> + + * elf-bfd.h (local_call_stubs): New member. + * elfxx-mips.c (FN_STUB_P, CALL_STUB_P, CALL_FP_STUB_P): New macros. + (mips_elf_calculate_relocation): Handle local mips16 call stubs. + (mips16_stub_section_p): Rename from mips_elf_stub_section_p, use + the new stub macros. + (_bfd_mips_elf_check_relocs): Handle call stubs for code which + mixes mips16 and mips32 functions. Use mips16_stub_section_p. Mark + used stubs with SEC_KEEP. Use the new stub macros. + +2006-11-01 Alan Modra <amodra@bigpond.net.au> + + * elf32-arm.c (bfd_elf32_arm_process_before_allocation): Correct + check for PLT usage. + +2006-11-01 Daniel Jacobowitz <dan@codesourcery.com> + + * elfxx-mips.c (mips_elf_merge_gots): Always use maxcnt. + +2006-10-31 Alan Modra <amodra@bigpond.net.au> + + * elf.c (elfcore_write_note): Pad note descriptor to 4-byte + boundary. Tidy. Comment. + +2006-10-30 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/3111 + * elf-bfd.h (elf_obj_tdata): Add symbuf. + (_bfd_elf_section_already_linked): Add struct bfd_link_info *. + (_bfd_elf_check_kept_section): Likewise. + (bfd_elf_match_symbols_in_sections): Likewise. + + * elf.c (assign_section_numbers): Updated to add + struct bfd_link_info *. + (bfd_elf_match_symbols_in_sections): Updated. Cache symbol + buffer if info->reduce_memory_overheads is false. + + * elflink.c (match_group_member): Updated to add + struct bfd_link_info *. + (_bfd_elf_check_kept_section): Likewise. + (elf_link_input_bfd): Likewise. + (_bfd_elf_section_already_linked): Likewise. + (bfd_elf_final_link): Free symbol buffer if + info->reduce_memory_overheads is false. + + * libbfd-in.h (_bfd_nolink_section_already_linked): Add + struct bfd_link_info *. + (_bfd_generic_section_already_linked): Likewise. + * libbfd.h: Regenerated. + + * linker.c (bfd_section_already_linked): Add + struct bfd_link_info *. + (_bfd_generic_section_already_linked): Likewise. + * targets.c (bfd_target): Add struct bfd_link_info * to + _section_already_linked. + * bfd-in2.h: Regenerated. + +2006-10-30 Alan Modra <amodra@bigpond.net.au> + + * bfd.c (bfd_error_type): Add bfd_error_on_input. + (input_bfd, input_error): New static vars. + (bfd_set_error): Handle bfd_error_on_input. + (bfd_errmsg): Likewise. + (bfd_perror): Simplify. + * archive.c (_bfd_write_archive_contents): Report errors on input. + * bfd-in2.h: Regenerate. + +2006-10-30 Alan Modra <amodra@bigpond.net.au> + + * elf.c (elfcore_write_note): Pad to 4-byte boundary. + +2006-10-28 Richard Sandiford <richard@codesourcery.com> + + * elf32-mips.c (elf_mips_howto_table_rel): Add R_MIPS_GLOB_DAT. + * elfn32-mips.c (elf_mips_howto_table_rel): Likewise. + (elf_mips_howto_table_rela): Likewise. + * elf64-mips.c (mips_elf64_howto_table_rel): Likewise. + (mips_elf64_howto_table_rela): Likewise. + +2006-10-26 H.J. Lu <hongjiu.lu@intel.com> + + * elf.c (_bfd_elf_init_private_section_data): Assert output + section ELF type instead of check if it is SHT_NULL. Copy + OS/PROC specific flags from input section to output section. + +2006-10-27 Alan Modra <amodra@bigpond.net.au> + + * section.c (SEC_KEEP): Update comment. + * bfd-in2.h: Regenerate. + * elflink.c (bfd_elf_gc_sections): Ignore SEC_EXCLUDE sections. + * merge.c (_bfd_merge_sections): Set SEC_KEEP on excluded sections. + * stabs.c (_bfd_discard_section_stabs): Likewise. + (_bfd_link_section_stabs): Likewise. Simplify abs_section check. + +2006-10-26 Ben Elliston <bje@au.ibm.com> + + * reloc.c (_bfd_relocate_contents): Remove explicit case 0. + + * elf.c (bfd_section_from_shdr): Remove extraneous breaks. + * targets.c (find_target): Remove extraneous break. + +2006-10-26 Ben Elliston <bje@au.ibm.com> + + * coff-maxq.c (coff_maxq20_reloc): Remove unused variable `howto'. + (struct maxq_reloc_map): Unused; remove. + (maxq_reloc_map): Likewise. + (maxq_reloc_type_lookup): Remove loop over maxq_reloc_map. + +2006-10-26 Ben Elliston <bje@au.ibm.com> + + * elf.c (bfd_elf_set_dyn_lib_class): Change second argument type + from int to enum dynamic_lib_link_class lib_class. + * bfd-in.h (bfd_elf_set_dyn_lib_class): Likewise. + * bfd-in2.h: Regenerate. + +2006-10-25 Alan Modra <amodra@bigpond.net.au> + Trevor Smigiel <Trevor_Smigiel@playstation.sony.com> + Yukishige Shibata <shibata@rd.scei.sony.co.jp> + Nobuhisa Fujinami <fnami@rd.scei.sony.co.jp> + Takeaki Fukuoka <fukuoka@rd.scei.sony.co.jp> + + * cpu-spu.c: New file. + * elf32-spu.c: New file. + * elf32-spu.h: New file. + * archures.c: Add SPU support. + * config.bfd: Likewise. + * configure.in: Likewise. + * reloc.c: Likewise. + * targets.c: Likewise. + * Makefile.am: Likewise. Run "make dep-am". + * libbfd.h: Regenerate. + * bfd-in2.h: Regenerate. + * Makefile.in: Regenerate. + * configure: Regenerate. + * po/SRC-POTFILES.in: Regenerate. + +2006-10-23 Alan Modra <amodra@bigpond.net.au> + + * elf64-ppc.c (ppc64_elf_edit_opd): Clarify comment. + +2006-10-23 Alan Modra <amodra@bigpond.net.au> + + * elf32-score.c: Formatting. + (elf_backend_omit_section_dynsym): Define. + (score_elf_create_dynamic_relocation): Remove code copied from mips. + Don't use section syms in dynamic relocs. Remove unused param. + (score_elf_final_link_relocate): Remove unused param. + +2006-10-23 Alan Modra <amodra@bigpond.net.au> + + * linker.c (fix_syms): Choose best of previous and next + section based on section flags and vma. + +2006-10-21 Kaz Kojima <kkojima@rr.iij4u.or.jp> + + * elf32-sh64.c (sh64_elf_merge_symbol_attribute): Do merging + only when the non visibility part of st_other is non-zero. + * elf64-sh64.c (sh64_elf64_merge_symbol_attribute): Likewise. + +2006-10-20 Richard Sandiford <richard@codesourcery.com> + + * elfxx-mips.c (_bfd_mips_elf_modify_segment_map): Don't extend + PT_DYNAMIC on GNU/Linux targets. + +2006-10-20 Richard Sandiford <richard@codesourcery.com> + + * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_sections): Make the + size of .rel.dyn reflect the value of DT_RELSZ. + +2006-10-20 Richard Sandiford <richard@codesourcery.com> + + * elfxx-mips.c (_bfd_mips_elf_additional_program_headers): Allocate + a PT_NULL header for dynamic objects. + (_bfd_mips_elf_modify_segment_map): Add it. + +2006-10-19 Mei Ligang <ligang@sunnorth.com.cn> + + * elf32-score.c (score_elf_rel_dyn_section): Replace + bfd_make_section with bfd_make_section_with_flags. + (_bfd_score_elf_create_dynamic_sections): Ditto. + (score_elf_create_got_section): Ditto. + (score_elf_final_link_relocate): Delete referrence to + EF_SCORE_HASENTRY. + +2006-10-19 Richard Sandiford <richard@codesourcery.com> + + * elfxx-mips.c (sort_dynamic_relocs): Sort relocations against the + same symbol by increasing r_offset. + (sort_dynamic_relocs_64): Likewise. Fix comparisons between very + large and very small symbol indexes. + +2006-10-19 Richard Sandiford <richard@codesourcery.com> + + * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Add DT_DEBUG + and DT_MIPS_RLD_MAP tags for position-independent executables. + Do not add DT_DEBUG to shared libraries for any MIPS target. + +2006-10-18 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/3290 + * elflink.c (elf_link_add_object_symbols): Hide definitions in + debug sections. + +2006-10-19 Alan Modra <amodra@bigpond.net.au> + + * elf32-arm.c (bfd_elf32_arm_allocate_interworking_sect): Check, + don't set, glue section size. + (record_arm_to_thumb_glue): Set glue section size here. + (record_thumb_to_arm_glue): Likewise. + (bfd_elf32_arm_add_glue_sections_to_bfd): Formatting. + (bfd_elf32_arm_process_before_allocation): Ignore exluded sections. + +2006-10-18 Roy Marples <uberlord@gentoo.org> + + * elf64-sparc.c: Add FreeBSD support. + (elf64_sparc_fbsd_post_process_headers): New function. + * targets.c (_bfd_target_vector): Add bfd_elf64_sparc_freebsd_vec. + * config.bfd (sparc64-*-freebsd*): Set targ_defvec to bfd_elf64_sparc_freebsd_vec. + * configure.in: Add entry for bfd_elf64_sparc_freebsd_vec. + * configure: Regenerate. + +2006-10-17 Mark Shinwell <shinwell@codesourcery.com> + + * elf32-arm.c (elf32_arm_final_link_relocate): Add support for + R_ARM_MOVW_BREL_NC, R_ARM_MOVW_BREL, R_ARM_MOVT_BREL, + R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVW_BREL and + R_ARM_THM_MOVT_BREL relocations. + +2006-10-17 Mark Shinwell <shinwell@codesourcery.com> + + * elf32-arm.c (elf32_arm_howto_table_1): Change offset for + R_THM_CALL to 25 and remove FIXME comment. + (using_thumb2): New function. + (elf32_arm_final_link_relocate): Cope with Thumb-2 BL encoding. + +2006-10-17 Mark Shinwell <shinwell@codesourcery.com> + + * elf32-arm.c (elf32_arm_final_link_relocate): Add cases + for R_ARM_ABS32_NOI and R_ARM_REL32_NOI. + (elf32_arm_gc_sweep_hook): Likewise. + (elf32_arm_check_relocs): Likewise. + (allocate_dynrelocs): Likewise. + +2006-10-17 Alan Modra <amodra@bigpond.net.au> + + * elf-bfd.h (struct elf_link_hash_table): Reorder. Add + text_index_section and data_index_section. + (struct elf_backend_data): Add elf_backend_init_index_section. + (_bfd_elf_init_1_index_section): Declare. + (_bfd_elf_init_2_index_sections): Declare. + * elfxx-target.h (elf_backend_init_index_section): Define. + (elfNN_bed): Init new field. + * elflink.c (_bfd_elf_link_omit_section_dynsym): Keep first tls + section and text_index_section plus data_index_section. + (_bfd_elf_link_renumber_dynsyms): Clear dynindx on omitted sections. + (_bfd_elf_init_1_index_section): New function. + (_bfd_elf_init_2_index_sections): New function. + (bfd_elf_size_dynsym_hash_dynstr): Call elf_backend_init_index_section. + (elf_link_input_bfd): When emitting relocs, use text_index_section + and data_index_section for removed sections. + * elf-m10300.c (elf_backend_omit_section_dynsym): Define. + * elf32-i386.c: Likewise. + * elf32-m32r.c: Likewise. + * elf32-sh.c: Likewise. + * elf32-xstormy16.c: Likewise. + * elf32-xtensa.c: Likewise. + * elf64-alpha.c: Likewise. + * elf64-hppa.c: Likewise. + * elf64-mmix.c: Likewise. + * elf64-sh64.c: Likewise. + * elfxx-ia64.c: Likewise. + * elf32-arm.c (elf32_arm_final_link_relocate): Use text_index_section + and data_index_section sym for relocs against sections with no dynamic + section sym. + (elf_backend_init_index_section): Define. + * elf32-cris.c: Similarly. + * elf32-hppa.c: Similarly. + * elf32-i370.c: Similarly. + * elf32-m68k.c: Similarly. + * elf32-mips.c: Similarly. + * elf32-ppc.c: Similarly. + * elf32-s390.c: Similarly. + * elf32-sparc.c: Similarly. + * elf32-vax.c: Similarly. + * elf64-mips.c: Similarly. + * elf64-ppc.c: Similarly. + * elf64-s390.c: Similarly. + * elf64-sparc.c: Similarly. + * elf64-x86-64.c: Similarly. + * elfn32-mips.c: Similarly. + * elfxx-mips.c: Similarly. + * elfxx-sparc.c: Similarly. + * linker.c (fix_syms): Base symbols in removed sections on + previous section in preference to using absolute section. + +2006-10-16 Andreas Schwab <schwab@suse.de> + + * elfxx-ia64.c (addend_compare): Properly compute return value. + +2006-10-15 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/3314 + * elf.c (assign_file_positions_for_non_load_sections): Don't + page align empty SHF_ALLOC sections. + +2006-10-13 Jakub Jelinek <jakub@redhat.com> + + * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_sections): Set + .plt sh_entsize to 0 if plt header size isn't multiple of + plt entry size or for 32-bit which adds a nop insn at the + end of the .plt section. + +2006-10-12 Bob Wilson <bob.wilson@acm.org> + + * elf32-xtensa.c (elf_xtensa_action_discarded): New. + (elf_backend_action_discarded): Define. + +2006-10-11 Bob Wilson <bob.wilson@acm.org> + + * elf32-xtensa.c (elf_xtensa_relocate_section): Return after + unresolvable relocation error. + (elf_xtensa_finish_dynamic_symbol): Set value of undefined, weak + symbols to zero. + +2006-10-10 Bob Wilson <bob.wilson@acm.org> + + * elf32-xtensa.c (elf_xtensa_size_dynamic_sections): Add DT_DEBUG + for PIE executables. + +2006-10-03 Jakub Jelinek <jakub@redhat.com> + + * elf-bfd.h (struct eh_cie_fde): Add set_loc pointer. + * elf-eh-frame.c (skip_cfa_op): Fix handling of DW_CFA_advance_loc. + Handle DW_CFA_{remember,restore}_state, DW_CFA_GNU_window_save, + DW_CFA_val_{offset{,_sf},expression}. + (skip_non_nops): Record number of DW_CFA_set_loc ops. + (_bfd_elf_discard_section_eh_frame): Require skip_non_nops recognizes + all ops. If there are any DW_CFA_set_loc ops and they are pcrel + or going to be pcrel, compute set_loc array. + (_bfd_elf_eh_frame_section_offset): If make_relative, kill relocations + against DW_CFA_set_loc operands. + (_bfd_elf_write_section_eh_frame): Handle DW_CFA_set_loc adjusting. + +2006-10-02 Daniel Jacobowitz <dan@codesourcery.com> + + * elflink.c (_bfd_elf_merge_symbol): Discard references to TLS + symbols from the --just-syms file. + +2006-10-01 Alan Modra <amodra@bigpond.net.au> + + * elf64-ppc.c (ppc64_elf_build_stubs): Test glink size for + existence of PLT. + +2006-09-29 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/3283 + * elf64-x86-64.c (elf64_x86_64_relocate_section): Don't ignore + relocation overflow on branches to undefweaks. + +2006-09-29 Alan Modra <amodra@bigpond.net.au> + + * po/BLD-POTFILES.in: Regenerate. + * po/SRC-POTFILES.in: Regenerate. + +2006-09-29 Danny Smith <dannysmith@users.sourceforge.net> + + PR 3276 + * pei-i386.c (COFF_SECTION_ALIGNMENT_ENTRIES): Enable 16 byte + alignment for .data$, .rdata$ and .text$ sections so that sse + and sse2 code will work for linkonce sections too. + * pe-i386.c (COFF_SECTION_ALIGNMENT_ENTRIES): Likewise. + +2006-09-28 Alan Modra <amodra@bigpond.net.au> + + * elflink.c (_bfd_elf_gc_mark_hook): New function. + * elf-bfd.h (_bfd_elf_gc_mark_hook): Declare. + * elfxx-target.h (elf_backend_gc_mark_hook): Default to above. + * elf-m10300.c (mn10300_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook. + * elf32-arm.c (elf32_arm_gc_mark_hook): Likewise. + * elf32-cris.c (cris_elf_gc_mark_hook): Likewise. + * elf32-hppa.c (elf32_hppa_gc_mark_hook): Likewise. + * elf32-i386.c (elf_i386_gc_mark_hook): Likewise. + * elf32-m32r.c (m32r_elf_gc_mark_hook): Likewise. + * elf32-m68k.c (elf_m68k_gc_mark_hook): Likewise. + * elf32-mcore.c (mcore_elf_gc_mark_hook): Likewise. + * elf32-ppc.c (ppc_elf_gc_mark_hook): Likewise. + * elf32-s390.c (elf_s390_gc_mark_hook): Likewise. + * elf32-score.c (_bfd_score_elf_gc_mark_hook): Likewise. + * elf32-sh.c (sh_elf_gc_mark_hook): Likewise. + * elf32-vax.c (elf_vax_gc_mark_hook): Likewise. + * elf32-xtensa.c (elf_xtensa_gc_mark_hook): Likewise. + * elf64-mmix.c (mmix_elf_gc_mark_hook): Likewise. + * elf64-s390.c (elf_s390_gc_mark_hook): Likewise. + * elf64-x86-64.c (elf64_x86_64_gc_mark_hook): Likewise. + * elfxx-mips.c (_bfd_mips_elf_gc_mark_hook): Likewise. + * elfxx-sparc.c (_bfd_sparc_elf_gc_mark_hook): Likewise. + * elf32-bfin.c (bfin_gc_mark_hook): Likewise. + (bfinfdpic_gc_sweep_hook): Delete. + (elf_backend_gc_sweep_hook): Don't define for elf32-bfinfdpic. + * elf32-d10v.c (elf32_d10v_gc_mark_hook): Use _bfd_elf_gc_mark_hook. + (elf32_d10v_gc_sweep_hook): Delete. + (elf_backend_gc_sweep_hook): Don't define. + * elf32-fr30.c (fr30_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook. + (fr30_elf_gc_sweep_hook): Delete. + (elf_backend_gc_sweep_hook): Don't define. + * elf32-frv.c (elf32_frv_gc_mark_hook): Use _bfd_elf_gc_mark_hook. + (elf32_frv_gc_sweep_hook): Delete. + (elf_backend_gc_sweep_hook): Don't define. + * elf32-iq2000.c (iq2000_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook. + (iq2000_elf_gc_sweep_hook): Delete. + (elf_backend_gc_sweep_hook): Don't define. + * elf32-openrisc.c (openrisc_elf_gc_mark_hook): Use + _bfd_elf_gc_mark_hook. + (openrisc_elf_gc_sweep_hook): Delete. + (elf_backend_gc_sweep_hook): Don't define. + * elf32-v850.c (v850_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook. + (v850_elf_gc_sweep_hook): Delete. + (elf_backend_gc_sweep_hook): Don't define. + * elf32-xstormy16.c (xstormy16_elf_gc_mark_hook): Use + _bfd_elf_gc_mark_hook. + (xstormy16_elf_gc_sweep_hook): Delete. + (elf_backend_gc_sweep_hook): Don't define. + * elf64-sh64.c (sh_elf64_gc_mark_hook): Use _bfd_elf_gc_mark_hook. + (sh_elf64_gc_sweep_hook): Delete. + (elf_backend_gc_sweep_hook): Don't define. + * elf32-avr.c (elf32_avr_gc_mark_hook): Delete. + (elf32_avr_gc_sweep_hook): Delete. + (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define. + * elf32-cr16c.c (elf32_cr16c_gc_mark_hook): Delete. + (elf32_cr16c_gc_sweep_hook): Delete. + (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define. + * elf32-crx.c (elf32_crx_gc_mark_hook): Delete. + (elf32_crx_gc_sweep_hook): Delete. + (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define. + * elf32-h8300.c (elf32_h8_gc_mark_hook): Delete. + (elf32_h8_gc_sweep_hook): Delete. + (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define. + * elf32-ip2k.c (ip2k_elf_gc_mark_hook): Delete. + (ip2k_elf_gc_sweep_hook): Delete. + (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define. + * elf32-m32c.c (m32c_elf_gc_mark_hook, m32c_elf_gc_sweep_hook): Delete. + (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define. + * elf32-m68hc11.c (elf_backend_gc_mark_hook): Don't define. + (elf_backend_gc_sweep_hook): Don't define. + * elf32-m68hc12.c (elf_backend_gc_mark_hook): Don't define. + (elf_backend_gc_sweep_hook): Don't define. + * elf32-m68hc1x.c (elf32_m68hc11_gc_mark_hook): Delete. + (elf32_m68hc11_gc_sweep_hook): Delete. + * elf32-m68hc1x.h (elf32_m68hc11_gc_mark_hook): Delete. + (elf32_m68hc11_gc_sweep_hook): Delete. + * elf32-msp430.c (elf32_msp430_gc_mark_hook): Delete. + (elf32_msp430_gc_sweep_hook): Delete. + (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define. + * elf32-mt.c (mt_elf_gc_mark_hook, mt_elf_gc_sweep_hook): Delete. + (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define. + +2006-09-25 Pedro Alves <pedro_alves@portugalmail.pt> + + * bfd-in.h (CONST_STRNCPY) : Delete. + (LITSTRCPY) : New. + (LITMEMCPY) : New. + * bfd-in2.h : Regenerate. + * elflink.c (bfd_elf_gc_sections) : Use LITMEMCPY. Don't manually + calculate string lengths. + * nlmcode.h (nlm_swap_auxiliary_headers_in) : Use LITMEMCPY. + +2006-09-26 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/3223 + PR ld/3267 + * elf.c (assign_file_positions_for_non_load_sections): Don't + warn zero size allocated sections. + +2006-09-27 Alan Modra <amodra@bigpond.net.au> + + * elf32-score.c (_bfd_score_elf_relocate_section): Move assignment + to "name" so that compiler realizes it is never uninitialized. + Use bfd_elf_sym_name. + +2006-09-26 H.J. Lu <hongjiu.lu@intel.com> + + PR binutils/3262 + * elf.c (rewrite_elf_program_header): Use bfd_zalloc instead of + bfd_alloc to allocate segment map. + (copy_elf_program_header): Likewise. + +2006-09-26 Mark Shinwell <shinwell@codesourcery.com> + Joseph Myers <joseph@codesourcery.com> + Ian Lance Taylor <ian@wasabisystems.com> + Ben Elliston <bje@wasabisystems.com> + + * archures.c: Add definition for bfd_mach_arm_iWMMXt2. + * cpu-arm.c (processors): Add bfd_mach_arm_iWMMXt2. + (arch_info_struct, bfd_arm_update_notes): Likewise. + (architectures): Likewise. + (bfd_arm_merge_machines): Check for iWMMXt2. + * bfd-in2.h: Rebuild. + +2006-09-24 H.J. Lu <hongjiu.lu@intel.com> + + * configure: Regenerated. + +2006-09-22 Alan Modra <amodra@bigpond.net.au> + + * elfcode.h (elf_swap_symbol_in): Return bfd_boolean. Don't abort + on error. + * elf-bfd.h (elf_size_info <swap_symbol_in>): Adjust decl. + (bfd_elf32_swap_symbol_in, bfd_elf64_swap_symbol_in): Likewise. + * elf.c (bfd_elf_get_elf_syms): Test return of swap_symbol_in, + and report error. + * elf32-arm.c (elf32_arm_swap_symbol_in): Return bfd_boolean. + +2006-09-20 Martin Schwidefsky <schwidefsky@de.ibm.com> + + * elf32-s390.c (elf_s390_relocate_section): Remove check for code + section in LD to LE linker relaxation for R_390_TLS_LDO32. + * elf64-s390.c (elf_s390_relocate_section): Likewise for + R_390_TLS_LDO64. + +2006-09-20 Kai Tietz <Kai.Tietz@onevision.com> + + * configure.in: Added new target-vectors x86_64coff_vec, + x86_64pe_vec, and x86_64pei_vec. + * configure: Regenerate. + * config.bfd: Adjusted x86_64 target architecture detection. + * bfd.c: Add for new target "coff-x86-64" + (bfd_get_sign_extend): Add target vector idents for pe-x86-64. and pei-x86-64. + * coff-x86_64.c: Add new file for x86_64 (AMD64) coff support. + * libpei.h: Adjustments for COFF_WITH_pex64. + * coffcode.h: Add for new target machine, architecture, signature, and internal + signature handler. + * Makefile.am: Add new files to target-all and define make-rule for pex64igen.c + * Makefile.in: Regenerate. + * pe-x86_64.c: Add for new target "pe-x86-64". + * pei-x86_64.c: Add for new target "pei-x86-64". + * peicode.h: Adjusts for new targets. + (coff_swap_filehdr_out): Set for this target to + _bfd_pex64_only_swap_filehdr_out. + (SIZEOF_IDATA4): Define it as 8 byte size for this target. + (SIZEOF_IDATA5): Define it as 8 byte size for this target. + (jump_table jtab): Add for AMD64MAGIC. + (pe_ILF_build_a_bfd): Adjusts for new size of SIZEOF_IDATA4 and SIZE_IDATA5. + (pe_ILF_object_p): Add coff image-file signature to internal + signature translation. + * peXXigen.c: Adjust proper include of target coff-header and + introduced target specific code + (COFF_WITH_pex64): New macro for this target. + (pe_print_idata): New dumping method for import section of PE+ files. + * targets.c: Add new target vectors declarations for x86_64 coff targets. + * coffcode.h: Support code to support the x86_64 PE magic number. + * coff-x86_64.c: New file. + +2006-09-17 Hans-Peter Nilsson <hp@axis.com> + + * elf.c (special_sections_s): Revert last STRING_COMMA_LEN change + for .stabstr entry, explain why. + +2006-09-17 Anton Blanchard <anton@samba.org> + Alan Modra <amodra@bigpond.net.au> + + * dwarf2.c (concat_filename): Apply DW_AT_comp_dir if dir table + entry isn't absolute. + +2006-09-17 Mei Ligang <ligang@sunnorth.com.cn> + + * cpu-score.c: New file. + * elf32-score.c: New file. + * config.bfd: Add Score target. + * Makefile.am: Add Score files. + * Makefile.in: Regenerate. + * archures.c: Add Score architecture. + * reloc.c: Add Score relocs. + * targets.c: Add Score target vectors. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + * configure.in: Add Score target. + * configure: Regenerate. + +2006-09-16 Nick Clifton <nickc@redhat.com> + Pedro Alves <pedro_alves@portugalmail.pt> + + * bfd-in.h (STRING_COMMA_LEN): New macro. Takes one constant + string as its argument and emits the string followed by a comma + and then the length of the string. + (CONST_STRNEQ): New macro. Checks to see if a variable string + has a constant string as its initial characters. + (CONST_STRNCPY): New macro. Copies a constant string to the start + of a variable string. + * bfd-in2.h: Regenerate. + * archive.c: Make use of the new macros. + * archive64.c: Likewise. + * bfd.c: Likewise. + * coff-ppc.c: Likewise. + * coff-stgo32.c: Likewise. + * coffcode.h: Likewise. + * cofflink.c: Likewise. + * cpu-i960.c: Likewise. + * dwarf2.c: Likewise. + * ecoff.c: Likewise. + * elf-m10300.c: Likewise. + * elf.c: Likewise. + * elf32-arm.c: Likewise. + * elf32-bfin.c: Likewise. + * elf32-cris.c: Likewise. + * elf32-hppa.c: Likewise. + * elf32-i370.c: Likewise. + * elf32-i386.c: Likewise. + * elf32-iq2000.c: Likewise. + * elf32-m32r.c: Likewise. + * elf32-m68hc11.c: Likewise. + * elf32-m68hc12.c: Likewise. + * elf32-m68k.c: Likewise. + * elf32-mcore.c: Likewise. + * elf32-ppc.c: Likewise. + * elf32-s390.c: Likewise. + * elf32-sh-symbian.c: Likewise. + * elf32-sh.c: Likewise. + * elf32-sh64.c: Likewise. + * elf32-v850.c: Likewise. + * elf32-vax.c: Likewise. + * elf32-xtensa.c: Likewise. + * elf64-alpha.c: Likewise. + * elf64-hppa.c: Likewise. + * elf64-mmix.c: Likewise. + * elf64-ppc.c: Likewise. + * elf64-s390.c: Likewise. + * elf64-sh64.c: Likewise. + * elf64-x86-64.c: Likewise. + * elflink.c: Likewise. + * elfxx-ia64.c: Likewise. + * elfxx-mips.c: Likewise. + * elfxx-sparc.c: Likewise. + * hpux-core.c: Likewise. + * i386linux.c: Likewise. + * ieee.c: Likewise. + * libpei.h: Likewise. + * linker.c: Likewise. + * m68klinux.c: Likewise. + * mmo.c: Likewise. + * nlmcode.h: Likewise. + * osf-core.c: Likewise. + * pef.c: Likewise. + * som.c: Likewise. + * sparclinux.c: Likewise. + * vms-hdr.c: Likewise. + +2006-09-14 Alan Modra <amodra@bigpond.net.au> + + PR 3181 + * elf.c (_bfd_elf_copy_private_header_data): Fix group members + that have had their SHT_GROUP section removed. + +2006-09-12 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/3197 + * elflink.c (elf_link_output_extsym): Compute bucket only if + needed. + +2006-09-10 H.J. Lu <hongjiu.lu@intel.com> + + PR binutils/3186 + * elf.c (_bfd_elf_make_section_from_shdr): Correct length of + "gnu.linkonce.wi.". + +2006-09-08 Vladimir Prus <vladimir@codesourcery.com> + + * elf32-arm.c (elf32_arm_swap_symbol_out): Remove + unconditional setting of low bit for Thumb symbol + mistakenly left behind after check for external + symbols was added. Fix comment typo. + +2006-09-07 H.J. Lu <hongjiu.lu@intel.com> + + * elf-bfd.h (elf_link_hash_entry): Add a dynamic field. + (bfd_elf_link_mark_dynamic_symbol): New. + (SYMBOLIC_BIND): New. + + * elf32-i386.c (elf_i386_check_relocs): Replace info->symbolic + with SYMBOLIC_BIND (info, h). + (elf_i386_relocate_section): Likewise. + * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise. + (elf64_x86_64_relocate_section): Likewise. + * elfxx-ia64.c (elfNN_ia64_check_relocs): Likewise. + + * elflink.c (bfd_elf_link_mark_dynamic_symbol): New. + (bfd_elf_record_link_assignment): Call + bfd_elf_link_mark_dynamic_symbol on new entry. + (_bfd_elf_merge_symbol): Likewise. + (_bfd_elf_export_symbol): Return if the symbol isn't exported. + (_bfd_elf_fix_symbol_flags): Replace info->symbolic with + SYMBOLIC_BIND (info, h). + (_bfd_elf_dynamic_symbol_p): Likewise. + (_bfd_elf_symbol_refs_local_p): Likewise. + (bfd_elf_size_dynamic_sections): Updated. + +2006-09-05 Bibo Mao <bibo.mao@intel.com> + + PR binutils/3171 + * coffcode.h (coff_write_object_contents): Set the optional + header magic number to PE32PMAGIC instead of ZMAGIC for ia64. + +2006-09-04 Mark Shinwell <shinwell@codesourcery.com> + + * elf32-arm.c (elf32_arm_howto_table_1): Adjust entries for + R_ARM_THM_ALU_PREL_11_0 and R_ARM_THM_PC12 relocations. + (elf32_arm_final_link_relocate): Handle R_ARM_THM_ALU_PREL_11_0 + and R_ARM_THM_PC12 relocations. + +2006-08-24 Bob Wilson <bob.wilson@acm.org> + + * elf32-xtensa.c (xtensa_get_property_section_name): Delete. + (xtensa_get_property_section): New. + (xtensa_read_table_entries): Use xtensa_get_property_section. + (relax_property_section, xtensa_get_property_predef_flags): Handle + group name suffixes in property section names. + (match_section_group): New. + +2006-08-23 Frediano Ziglio <Frediano.Ziglio@vodafone.com> + + * archive.c (hpux_uid_gid_encode): Fix thinko decrementing "cnt" + variable. + +2006-08-22 Daniel Jacobowitz <dan@codesourcery.com> + + * elf32-arm.c (elf32_arm_copy_indirect_symbol): Only copy + plt_thumb_refcount from indirect symbols. + +2006-08-22 Alan Modra <amodra@bigpond.net.au> + + * elf32-ppc.c (ppc_elf_relocate_section): Correct GOT and PLT HA + reloc handling. + * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. + +2006-08-21 Mark Shinwell <shinwell@codesourcery.com> + + * elf32-arm.c (elf32_arm_link_hash_table): Correct typo in + comment for target1_is_rel. + +2006-08-21 Pedro Alves <pedro_alves@portugalmail.pt> + + * Makefile.am: Add rules to build pe-arm-wince.lo + and pei-arm-wince.lo objects. + * Makefile.in: Regenerate. + * pe-arm-wince.c: New file. + * pei-arm-wince.c: New file. + * pei-arm.c: Remove ARM_WINCE block. + * pe-arm.c: Remove ARM_WINCE block. Rename + bfd_arm_pe_allocate_interworking_sections, + bfd_arm_pe_get_bfd_for_interworking, and + bfd_arm_pe_process_before_allocation to + bfd_armpe_allocate_interworking_sections, + bfd_armpe_get_bfd_for_interworking, and + bfd_armpe_process_before_allocation. Move them before + including bfd.h. + * bfd.c: ARM wince bfd format names were renamed. Adjust. + * coff-arm.c [ARM_WINCE]: Adjust so Windows CE doesn't end up + with unexpected/conflicting relocs. + * targets.c: The arm-wince-pe target got its own new vector. + Adjust. + * config.bfd: Likewise. + * configure.in: Likewise. + * configure: Regenerate. + +2006-08-18 Paul Brook <paul@codesourcery.com> + + * elf32-arm.c (elf32_arm_link_hash_entry): Add export_glue. + (elf32_arm_link_hash_newfunc): Initialize export_glue. + (record_arm_to_thumb_glue): Return stub symbol. + (elf32_arm_create_thumb_stub): New function. + (elf32_arm_to_thumb_stub): Use it. + (elf32_arm_to_thumb_export_stub): New function. + (elf32_arm_begin_write_processing): New function. + (allocate_dynrelocs): Allocate Arm stubs. + (elf_backend_begin_write_processing): Define. + (elf32_arm_symbian_begin_write_processing): Remove ATTRIBUTE_UNUSED. + Call elf32_arm_begin_write_processing. + +2006-08-17 Alan Modra <amodra@bigpond.net.au> + + * elf64-ppc.c (create_linkage_sections): Align .glink to 8 bytes. + (ppc64_elf_build_stubs): Use new lazy linking stub. + +2006-08-17 Alan Modra <amodra@bigpond.net.au> + + * elf64-ppc.c (ppc64_elf_size_stubs): Ignore non-code sections. + +2006-08-16 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/3015 + * elf.c (get_program_header_size): Add a PT_GNU_RELRO segment + only if there is a PT_DYNAMIC segment. + (_bfd_elf_map_sections_to_segments): Likewise. + (assign_file_positions_for_load_sections): Set PT_GNU_RELRO + segment alignment to 1. + +2006-08-15 Thiemo Seufer <ths@mips.com> + Nigel Stephens <nigel@mips.com> + + * elf32-mips.c, elf64-mips.c, elfn32-mips.c + (elf_backend_merge_symbol_attribute): Define. + * elflink.c (elf_link_add_object_symbols): Merge only the ELF + visibility flags. + * elfxx-mips.c (_bfd_mips_elf_merge_symbol_attribute): New function. + +2006-08-15 Thiemo Seufer <ths@mips.com> + Nigel Stephens <nigel@mips.com> + David Ung <davidu@mips.com> + + * config.bfd: Add configurations for mips*el-sde-elf* and + mips*-sde-elf*. + +2006-08-14 DJ Delorie <dj@redhat.com> + + * elf-m10300.c (elf32_mn10300_link_hash_entry): Add value. + (elf32_mn10300_count_hash_table_entries): New. + (elf32_mn10300_list_hash_table_entries): New. + (sort_by_value): New. + (mn10300_elf_relax_section): Don't skip data sections; restrict + code-specific tests to code-specific areas so that potential + indirect calls can be detected. Check for multiple local symbols + at the same address and merge their flags. + (elf32_mn10300_link_hash_newfunc): Initialize value. + +2006-08-14 Thiemo Seufer <ths@mips.com> + + * elfxx-mips.c (_bfd_mips_elf_symbol_processing, + _bfd_mips_elf_add_symbol_hook): Don't try to place small common TLS + symbols in .scommon. + +2006-08-11 Thiemo Seufer <ths@mips.com> + + * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_sections): Set + sh_entsize only when sgot was already initialized. + +2006-08-08 DJ Delorie <dj@redhat.com> + + * elf32-sh.c (sh_elf_relax_section): Allow for branches across + non-moving .align directives. Preserve any DIR32 offset when + converting bsr's to jsr's. + +2006-08-08 Alan Modra <amodra@bigpond.net.au> + + * elf64-ppc.c (ppc64_elf_build_stubs): Clear relbrlt reloc_count + after stubs have been built. + +2006-08-07 Nick Clifton <nickc@redhat.com> + + * elf32-sh.c (vxworks_object_p): Only check for vxworks target + vectors if they are going to be created. + +2006-08-07 Nick Clifton <nickc@redhat.com> + + * configure.in (bfd_elf32_shnbsd_vec): Fix typo. + * configure: Regenerate. + +2006-08-07 Nick Clifton <nickc@redhat.com> + + * coff-arm.c (coff_arm_rtype_to_howto): Only check for ARM_SECREL + relocation types if the target is ARM_WINCE. + +2006-08-05 Pedro Alves <pedro_alves@portugalmail.pt> + + * bfd.c (bfd_get_sign_extend_vma): Add cases for pe-arm-little + and pei-arm-little. + * coff-arm.c (coff_arm_rtype_to_howto) [COFF_WITH_PE]: Handle + ARM_SECREL. + (coff_arm_reloc_type_lookup): Map BFD_RELOC_32_SECREL to + ARM_SECREL. + * pe-arm.c [COFF_SECTION_ALIGNMENT_ENTRIES]: Define. + * pei-arm.c [TARGET_UNDERSCORE]: Define for ARM_WINCE like in + pe-arm.c. + [COFF_SECTION_ALIGNMENT_ENTRIES]: Define. + +2006-08-04 Marcelo Tosatti <marcelo@kvack.org> + + * elflink.c (elf_gc_sweep): If info.print_gc_sections is true, + list removed sections to stderr. + +2006-08-04 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. + +2006-08-02 Mark Kettenis <kettenis@gnu.org> + + * configure.in (arm-*-openbsd*): Set COREFILE to netbsd-core.lo. + * configure: Regenerate. + +2006-08-02 Petr Salinger <Petr.Salinger@seznam.cz> + + PR binutils/2983 + * elf64-x86-64.c: Add FreeBSD support. + (elf64_x86_64_fbsd_post_process_headers): New function. + * targets.c (_bfd_target_vector): Add bfd_elf64_x86_64_freebsd_vec. + * config.bfd (x64_64-*-freebsd*): Add bfd_elf64_x86_64_freebsd_vec + to the targ_selvecs. + * configure.in: Add entry for bfd_elf64_x86_64_freebsd_vec. + * configure: Regenerate. + +2006-07-26 Andreas Schwab <schwab@suse.de> + + * elfxx-ia64.c (elfNN_ia64_choose_gp): Use rawsize if set. + +2006-07-26 Alan Modra <amodra@bigpond.net.au> + + * elf.c (elf_modify_segment_map): Delete empty PT_LOAD segments. + * elf32-xtensa.c (elf_xtensa_modify_segment_map): Delete. + (define elf_backend_modify_segment_map): Don't define. + +2006-07-25 Thiemo Seufer <ths@networkno.de> + + * elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Allow + linking of objects for compatible machine types. + +2006-07-25 Thiemo Seufer <ths@networkno.de> + + * elfxx-mips.c (mips_elf_next_relocation): Tighten check to test + also for same symbol. + +2006-07-25 Thiemo Seufer <ths@mips.com> + + * elfxx-mips.c (mips_elf_calculate_relocation): Remove magic constant. + +2006-07-24 Michael Wetherell <mike.wetherell@ntlworld.com> + + * elf.c (bfd_section_from_shdr): Reject unrecognised OS-specific + sections only if the SHF_OS_NONCONFORMING flag is present. + +2006-07-24 Nick Clifton <nickc@redhat.com> + + PR ld/2729 + * peXXigen.c (_bfd_XXi_final_link_postscript): Check for the + existance of output sections before putting their entries into the + DataDictionary. + +2006-07-20 Thiemo Seufer <ths@mips.com> + + * elf32-mips.c (mips16_jump_reloc): Remove function. + (elf_mips16_howto_table_rel): Use _bfd_mips_elf_generic_reloc + instead of mips16_jump_reloc. + * elf64_mips.c, wlfn32-mips.c (mips16_jump_reloc): Remove function. + (elf_mips16_howto_table_rel, elf_mips16_howto_table_rela): Use + _bfd_mips_elf_generic_reloc instead of mips16_jump_reloc. + +2006-07-19 Alan Modra <amodra@bigpond.net.au> + + * bfd-in.h (enum notice_asneeded_action): Define. + * bfd-in2.h: Regenerate. + * elflink.c (elf_link_add_object_symbols): Call linker "notice" + function with NULL name for as-needed handling. + +2006-07-18 Paul Brook <paul@codesourcery.com> + + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + * reloc.c: Add BFD_RELOC_ARM_T32_ADD_IMM. + +2006-07-18 Nick Clifton <nickc@redhat.com> + + * elfxx-mips.c (_bfd_mips_elf_common_definition): New function. + Consider SHN_MIPS_ACOMMON and SHN_MIPS_SCOMMON as being common + sections. + * elfxx-mips.h (_bfd_mips_elf_common_definition): Prototype. + +2006-07-14 Jakub Jelinek <jakub@redhat.com> + + * elflink.c (bfd_elf_size_dynsym_hash_dynstr): Fix cinfo.shift2 value. + +2006-07-14 Mark Kettenis <kettenis@gnu.org> + + * elflink.c (bfd_elf_size_dynsym_hash_dynstr): Move declarations + to the start of a block. + +2006-07-13 Nick Clifton <nickc@redhat.com> + + * coff-sh.c (_bfd_sh_align_load_span): Catch sh_insn_info() + returning a NULL value. + +2006-07-12 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/2884 + * elflink.c (_bfd_elf_merge_symbol): Copy the symbol info from + the old versioned dynamic definition to the new one with + non-default visibility. Hide the symbol if it is hidden or + internal. + +2006-07-12 Matthew R. Dempsky <mrd@alkemio.org> + + * cpu-m68k.c (bfd_m68k_compatible): Handle CPU32. + +2006-07-10 Jakub Jelinek <jakub@redhat.com> + + * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. + (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): + Handle SHT_GNU_HASH. + (special_sections_g): Include .gnu.hash section. + (bfd_elf_gnu_hash): New function. + * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. + (struct elf_backend_data): Add elf_hash_symbol method. + * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash + only if info->emit_hash, create .gnu.hash section if + info->emit_gnu_hash. + (struct collect_gnu_hash_codes): New type. + (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, + _bfd_elf_hash_symbol): New functions. + (compute_bucket_count): Don't compute HASHCODES array, instead add + that and NSYMS as arguments. Use bed->s->sizeof_hash_entry + instead of bed->s->arch_size / 8. Fix .hash size estimation. + When not optimizing, use the number of hashed symbols rather than + dynsymcount. + (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, + and ADD DT_GNU_HASH if info->emit_gnu_hash. + (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, + adjust compute_bucket_count caller. Create and populate .gnu.hash + section if info->emit_gnu_hash. + (elf_link_output_extsym): Only populate .hash section if + finfo->hash_sec != NULL. + (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. + * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. + (elfNN_bed): Add elf_backend_hash_symbol. + * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. + (elf_backend_hash_symbol): Define. + * elf32-i386.c (elf_i386_hash_symbol): New function. + (elf_backend_hash_symbol): Define. + +2006-07-05 Nick Clifton <nickc@redhat.com> + + PR ld/2659 + * cofflink.c (_bfd_coff_link_input_bfd): Fix selection of aux + entry when multiple definitions of a symbol are encountered. + +2006-06-30 H.J. Lu <hongjiu.lu@intel.com> + + * elf32-i386.c (elf_i386_relocate_section): Use xchg %ax,%ax + instead of 2 nops. + * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. + (elf64_x86_64_plt0_entry): Use nopl 0(%rax) instead of 4 nops. + +2006-06-29 Jakub Jelinek <jakub@redhat.com> + + PR ld/2513 + * elf32-i386.c (GOT_TLS_MASK, GOT_TLS_IE_IE, GOT_TLS_IE_GD, + GOT_TLS_IE_MASK, elf_i386_check_relocs, allocate_dynrelocs): Revert + 2006-04-08 changes. + (elf_i386_relocate_section): Likewise. For GD->IE transition + change subl into addl whenever tls_type is GOT_TLS_IE_POS. + +2006-06-23 Alan Modra <amodra@bigpond.net.au> + + PR ld/2754 + * elf.c (bfd_elf_mkobject): Don't alloc if already done. Set + program_header_size to -1. + (_bfd_elf_map_sections_to_segments): Adjust program_header_size check. + (assign_file_positions_for_load_sections ): Likewise. + (_bfd_elf_sizeof_headers): Use saved program_header_size if + available. + * elf32-arm.c (elf32_arm_mkobject): Call bfd_elf_mkobject, don't + alloc if already done. + * elf32-i386.c (elf_i386_mkobject): Likewise. + * elf32-ppc.c (ppc_elf_mkobject): Likewise. + * elf32-s390.c (elf_s390_mkobject): Likewise. + * elf32-sh.c (sh_elf_mkobject): Likewise. + * elf64-alpha.c (elf64_alpha_mkobject): Likewise. + * elf64-ppc.c (ppc64_elf_mkobject): Likewise. + * elf64-s390.c (elf_s390_mkobject): Likewise. + * elf64-x86-64.c (elf64_x86_64_mkobject): Likewise. + * elfxx-sparc.c (_bfd_sparc_elf_mkobject): Likewise. + +2006-06-20 Jakub Jelinek <jakub@redhat.com> + + * elflink.c (elf_link_add_object_symbols): Don't create .tcommon + section for relocatable link. + +2006-06-21 Alan Modra <amodra@bigpond.net.au> + + * elf-bfd.h (struct elf_backend_data): Add + elf_backend_modify_program_headers. + * elfxx-target.h (elf_backend_modify_program_headers): Define. + (elfNN_bed): Init new field. + * elf.c (elf_modify_segment_map): Remove comment. + (assign_file_positions_for_load_sections): Only call + elf_modify_segment_map for objcopy/strip. + (assign_file_positions_except_relocs): Call + elf_backend_modify_program_headers. + * elf32-frv.c (elf32_frvfdpic_always_size_sections): Don't make + .stack section. + (elf32_frvfdpic_modify_segment_map): Delete. + (elf32_frvfdpic_modify_program_headers): New. + (elf_backend_modify_segment_map): Don't define. + (elf_backend_modify_program_headers): Define. + * elf32-bfin.c (elf32_bfinfdpic_always_size_sections): Don't make + .stack section. + (elf32_bfinfdpic_modify_segment_map): Delete. + (elf32_bfinfdpic_modify_program_headers): New. + (elf_backend_modify_segment_map): Don't define. + (elf_backend_modify_program_headers): Define. + * elfxx-ia64.c (elfNN_ia64_modify_program_headers): New function. + Split out from.. + (elfNN_ia64_modify_segment_map): ..here. + (elf_backend_modify_program_headers): Define. + +2006-06-20 Jakub Jelinek <jakub@redhat.com> + + * bfd.c (bfd_record_phdr): Clear p_align and p_align_valid fields. + * elf.c (_bfd_elf_link_hash_table_init): Clear hplt field. + +2006-06-20 Alan Modra <amodra@bigpond.net.au> + + * elf-bfd.h: Formatting. + (_bfd_elf_map_sections_to_segments): Declare. + * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame_hdr): Don't + clear program_header_size. + * elf.c (get_program_header_size): Move. Don't use or set saved + program_header_size here. + (elf_modify_segment_map): New function. Split out from.. + (assign_file_positions_for_load_sections): ..here. Assert + header size is correct. Remove dead code. + (_bfd_elf_map_sections_to_segments): Rename from + map_sections_to_segments. Make global. Use get_program_header_size + when we need estimate of header size. Call elf_modify_segment_map. + Set program_header_size. + (print_segment_map): Delete. + (_bfd_elf_sizeof_headers): If segment_map available, get the + actual size. + * elf32-arm.c (elf32_arm_symbian_modify_segment_map): Make safe + for calling more than once. + * elf32-bfin.c (elf32_bfinfdpic_modify_segment_map): Likewise. + * elf32-frv.c (elf32_frvfdpic_modify_segment_map): Likewise. + * elfxx-mips.c (_bfd_mips_elf_modify_segment_map): Likewise. + * elf32-i370.c (elf_backend_add_symbol_hook): Delete. + (elf_backend_additional_program_headers): Delete. + (elf_backend_modify_segment_map): Delete. + * elf64-hppa.c (elf64_hppa_modify_segment_map): Convert to ISO C. + * elfxx-ia64.c (elfNN_ia64_modify_segment_map): Likewise. + * doc/bfdint.texi: Delete SIZEOF_HEADERS difficulties. + +2006-06-19 Vladimir Prus <vladimir@codesourcery.com> + + * elf32-arm.c (elf32_arm_swap_symbol_out): Don't set low + bit for undefined symbols. + +2006-06-19 Alan Modra <amodra@bigpond.net.au> + + * elf-bfd.h (struct elf_backend_data): Add bfd_link_info pointer + parameter. + (_bfd_elf_sizeof_headers): Replace bfd_boolean param with + bfd_link_info pointer. + * targets.c (struct bfd_target <_bfd_sizeof_headers>): Likewise. + * bfd.c (bfd_sizeof_headers): Tweak param name. + * aout-adobe.c (aout_adobe_sizeof_headers): Adjust. + * aoutx.h (NAME (aout, sizeof_headers)): Adjust. + * binary.c (binary_sizeof_headers): Adjust. + * bout.c (b_out_sizeof_headers): Adjust. + * coff-rs6000.c (_bfd_xcoff_sizeof_headers): Adjust. + * coff64-rs6000.c (xcoff64_sizeof_headers): Adjust. + * coffgen.c (coff_sizeof_headers): Adjust. + * ecoff.c (_bfd_ecoff_sizeof_headers): Adjust. + (ecoff_compute_section_file_positions): Adjust. + (_bfd_ecoff_write_object_contents): Adjust. + * elf.c (get_program_header_size, _bfd_elf_sizeof_headers): Adjust. + * elf32-arm.c (elf32_arm_additional_program_headers): Adjust. + * elf32-i370.c (elf_backend_additional_program_headers): Adjust. + * elf32-ppc.c (ppc_elf_additional_program_headers): Adjust. + * elf64-hppa.c (elf64_hppa_additional_program_headers): Adjust. + * elf64-x86-64.c (elf64_x86_64_additional_program_headers): Adjust. + * elfxx-ia64.c (elfNN_ia64_additional_program_headers): Adjust. + * elfxx-mips.c (_bfd_mips_elf_additional_program_headers): Adjust. + * elfxx-mips.h (_bfd_mips_elf_additional_program_headers): Adjust. + * i386msdos.c: Convert to ISO C. + (msdos_sizeof_headers): Adjust. + * i386os9k.c: Convert to ISO C. + (os9k_sizeof_headers): Adjust. + * ieee.c (ieee_sizeof_headers): Adjust. + * ihex.c (ihex_sizeof_headers): Adjust. + * libaout.h (NAME (aout, sizeof_headers)): Adjust. + * libbfd-in.h (_bfd_nolink_sizeof_headers): Adjust. + * libcoff-in.h (coff_sizeof_headers): Adjust. + * libecoff.h (_bfd_ecoff_sizeof_headers): Adjust. + * mach-o.c (bfd_mach_o_sizeof_headers): Adjust. + * mmo.c (mmo_sizeof_headers): Adjust. + * oasys.c (oasys_sizeof_headers): Adjust. + * pdp11.c (NAME (aout, sizeof_headers)): Adjust. + * pef.c (bfd_pef_sizeof_headers): Adjust. + * ppcboot.c (ppcboot_sizeof_headers): Adjust. + * som.c (som_sizeof_headers): Adjust. + * srec.c (srec_sizeof_headers): Adjust. + * tekhex.c (tekhex_sizeof_headers): Adjust. + * versados.c (versados_sizeof_headers): Adjust. + * vms.c (vms_sizeof_headers): Adjust. + * xcoff-target.h (_bfd_xcoff_sizeof_headers): Adjust. + * xsym.c (bfd_sym_sizeof_headers): Adjust. + * xsym.h (bfd_sym_sizeof_headers): Adjust. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + * libcoff.h: Regenerate. + +2006-06-15 Mark Shinwell <shinwell@codesourcery.com> + + * bfd-in2.h: Regenerate. + * elf32-arm.c (R_ARM_ALU_PC_G0_NC, R_ARM_ALU_PC_G0, + R_ARM_ALU_PC_G1_NC, R_ARM_ALU_PC_G1, R_ARM_ALU_PC_G2, + R_ARM_LDR_PC_G1, R_ARM_LDR_PC_G2, R_ARM_LDRS_PC_G0, + R_ARM_LDRS_PC_G1, R_ARM_LDRS_PC_G2, R_ARM_LDC_PC_G0, + R_ARM_LDC_PC_G1, R_ARM_LDC_PC_G2, R_ARM_ALU_SB_G0_NC, + R_ARM_ALU_SB_G0, R_ARM_ALU_SB_G1_NC, R_ARM_ALU_SB_G1, + R_ARM_ALU_SB_G2, R_ARM_LDR_SB_G0, R_ARM_LDR_SB_G1, + R_ARM_LDR_SB_G2, R_ARM_LDRS_SB_G0, R_ARM_LDRS_SB_G1, + R_ARM_LDRS_SB_G2, R_ARM_LDC_SB_G0, R_ARM_LDC_SB_G1, + R_ARM_LDC_SB_G2): New relocation types. + (R_ARM_PC13): Rename to AAELF name R_ARM_LDR_PC_G0 and + adjust HOWTO entry to be consistent with R_ARM_LDR_PC_G1 + and friends. + (elf32_arm_howto_table_3): Delete; contents merged into + elf32_arm_howto_table_2. + (elf32_arm_howto_from_type): Adjust correspondingly. + (elf32_arm_reloc_map): Extend with the above relocations. + (calculate_group_reloc_mask): New function. + (identify_add_or_sub): New function. + (elf32_arm_final_link_relocate): Support for the above + relocations. + * reloc.c: Add enumeration entries for BFD_RELOC_ARM_... + codes to correspond to the above relocations. + +2006-06-14 Richard Sandiford <richard@codesourcery.com> + + * elf32-m68k.c (elf_m68k_plt_info): New structure. + (elf_m68k_plt0_entry): Add R_68K_PC32-style in-place addends. + (elf_m68k_plt_entry): Likewise. + (elf_m68k_plt_info): New table. + (CFV4E_PLT_ENTRY_SIZE): Rename to... + (ISAB_PLT_ENTRY_SIZE): ...this. + (CFV4E_FLAG): Delete. + (elf_cfv4e_plt0_entry): Rename to... + (elf_isab_plt0_entry): ...this. Adjust comments. Use (-6,%pc,%d0) + for the second instruction too. + (elf_cfv4e_plt_entry): Rename to... + (elf_isab_plt_entry): ...this. Adjust comments and use (-6,%pc,%d0). + (elf_isab_plt_info): New table. + (CPU32_FLAG): Delete. + (PLT_CPU32_ENTRY_SIZE): Rename to... + (CPU32_PLT_ENTRY_SIZE): ...this. + (elf_cpu32_plt0_entry): Update bounds accordingly. Add R_68K_PC32- + style in-place addends. + (elf_cpu32_plt_entry): Likewise. + (elf_cpu32_plt_info): New table. + (elf_m68k_link_hash_table): Add a plt_info field. + (elf_m68k_link_hash_table_create): Initialize it. + (elf_m68k_get_plt_info): New function. + (elf_m68k_always_size_sections): Likewise. + (elf_m68k_adjust_dynamic_symbol): Use the plt_info hash table field. + (elf_m68k_install_pc32): New function. + (elf_m68k_finish_dynamic_symbol): Factor code using plt_info and + elf_m68k_install_pc32. + (elf_m68k_finish_dynamic_sections): Likewise. + (elf_m68k_plt_sym_val): Use elf_m68k_get_plt_info. + (elf_backend_always_size_sections): Define. + +2006-06-14 Alan Modra <amodra@bigpond.net.au> + + * elflink.c (elf_link_add_object_symbols): Save and restore + struct bfd_hash_table table, size and count fields for + as-needed libs. + +2006-06-12 Thiemo Seufer <ths@mips.com> + + * elf32-mips.c: Expand comment about ABI-mandated pagesize values. + (ELF_MAXPAGESIZE, ELF_COMMONPAGESIZE): define in a more obvious way. + * elf64-mips.c, elfn32-mips.c (ELF_MAXPAGESIZE): Fix value for IRIX6. + Delete old comments. + (ELF_COMMONPAGESIZE): Define in a more obvious way. + +2006-06-12 Nick Clifton <nickc@redhat.com> + + PR binutils/2735 + * elflink.c (elf_link_add_object_symbols): Fix the warning message + about mismatched alignments to allow for the case where the common + alignment has been deduced from the section alignment. + * bfd.c (_bfd_default_error_handler): Update comment to explain + why bfd and asection varargs are out of order. Explicitly catch + and abort on NULL bfd and asection arguments. + +2006-06-11 Richard Sandiford <richard@codesourcery.com> + Thiemo Seufer <ths@mips.com> + + * elfxx-mips.c (mips_elf_link_hash_table): Add function_stub_size. + (STUB_ORI): New macro. + (STUB_LI16U): Fix formatting. + (MIPS_FUNCTION_STUB_SIZE): Delete. + (MIPS_FUNCTION_STUB_MAX_SIZE): Likewise. + (MIPS_FUNCTION_STUB_NORMAL_SIZE): New macro. + (MIPS_FUNCTION_STUB_BIG_SIZE): Likewise. + (_bfd_mips_elf_adjust_dynamic_symbol): Use htab->function_stub_size + instead of MIPS_FUNCTION_STUB_SIZE. + (count_section_dynsyms): New function, split out from + _bfd_mips_elf_final_link. + (_bfd_mips_elf_always_size_sections): Get a worst-case estimate + of the number of dynamic symbols needed and use it to set up + function_stub_size. Use function_stub_size rather than + MIPS_FUNCTION_STUB_SIZE to determine the size of the stub section. + Use 16-byte stubs for 0x10000 dynamic symbols. + (_bfd_mips_elf_size_dynamic_sections): Use htab->function_stub_size + instead of MIPS_FUNCTION_STUB_SIZE. Fix formatting. + (_bfd_mips_elf_finish_dynamic_symbol): Likewise. Change the + size of the stub buffer from MIPS_FUNCTION_STUB_MAX_SIZE to + MIPS_FUNCTION_STUB_BIG_SIZE. Tweak the check for unhandled dynindxes. + Use MIPS_FUNCTION_STUB_BIG_SIZE rather than a hard-coded 20. + Use STUB_ORI rather than STUB_LI16U for big stubs. + (_bfd_mips_elf_link_hash_table_create): Initialize function_stub_size. + (_bfd_mips_elf_final_link): Use count_section_dynsyms. + +2006-06-09 David Ung <davidu@mips.com> + + * bfd/elfxx-mips.c (mips_elf_calculate_relocation): Fix mode for stub + calling relocations. + +2006-06-08 David Daney <ddaney@avtrex.com> + + * elfxx-mips.c (STUB_LI16): Removed. + (STUB_LUI): New macro. + (STUB_LI16U): Ditto. + (STUB_LI16S): Ditto. + (MIPS_FUNCTION_STUB_SIZE): Rewrote to take info parameter. + (_bfd_mips_elf_adjust_dynamic_symbol): Pass info parameter to + MIPS_FUNCTION_STUB_SIZE. + (_bfd_mips_elf_always_size_sections): Ditto. + (_bfd_mips_elf_size_dynamic_sections): Ditto. + (_bfd_mips_elf_finish_dynamic_sections): Ditto. + (_bfd_mips_elf_finish_dynamic_symbol): Rewrote stub generation + to allow larger symbol table indexes. + +2006-06-07 Joseph S. Myers <joseph@codesourcery.com> + + * po/Make-in (pdf, ps): New dummy targets. + +2006-06-06 Alan Modra <amodra@bigpond.net.au> + + * hash.c (bfd_hash_lookup): Correct stray line. + + * elf.c (_bfd_elf_init_private_section_data): Comment typo. + (elfcore_grok_nto_status): Use long instead of pid_t. + (elfcore_grok_nto_regs, elfcore_grok_nto_note): Likewise. + +2006-06-05 Daniel Jacobowitz <dan@codesourcery.com> + + * po/Make-in (top_builddir): Define. + +2006-06-05 Alan Modra <amodra@bigpond.net.au> + + * Makefile.am: Run "make dep-am". + * Makefile.in: Regenerate. + * config.in: Regenerate. + +2006-06-02 Alan Modra <amodra@bigpond.net.au> + H.J. Lu <hongjiu.lu@intel.com> + + PR ld/2723 + * elflink.c (bfd_elf_final_link): Don't output section symbols + for special ELF sections. + +2006-06-01 Alan Modra <amodra@bigpond.net.au> + + * stabs.c (_bfd_link_section_stabs): Use bfd_make_section*_with_flags + instead of bfd_make_section*. + * aix386-core.c: Likewise. + * aix5ppc-core.c: Likewise. + * aout-adobe.c: Likewise. + * aoutf1.h: Likewise. + * binary.c: Likewise. + * cisco-core.c: Likewise. + * coff-arm.c: Likewise. + * coff-h8300.c: Likewise. + * elf.c: Likewise. + * elf32-bfin.c: Likewise. + * elf32-m32c.c: Likewise. + * hppabsd-core.c: Likewise. + * hpux-core.c: Likewise. + * i386linux.c: Likewise. + * ieee.c: Likewise. + * ihex.c: Likewise. + * irix-core.c: Likewise. + * lynx-core.c: Likewise. + * m68klinux.c: Likewise. + * mach-o.c: Likewise. + * netbsd-core.c: Likewise. + * nlmcode.h: Likewise. + * opncls.c: Likewise. + * osf-core.c: Likewise. + * peXXigen.c: Likewise. + * ppcboot.c: Likewise. + * ptrace-core.c: Likewise. + * rs6000-core.c: Likewise. + * sco5-core.c: Likewise. + * sparclinux.c: Likewise. + * srec.c: Likewise. + * sunos.c: Likewise. + * trad-core.c: Likewise. + * xcofflink.c: Likewise. + * xsym.c: Likewise. + +2006-05-31 Daniel Jacobowitz <dan@codesourcery.com> + + * Makefile.am (INCLUDES): Use @INCINTL@. + * acinclude.m4: Include new gettext macros. + * configure.in: Use ZW_GNU_GETTEXT_SISTER_DIR and AM_PO_SUBDIRS. + Manually substitute POFILES and GMOFILES. + * Makefile.in, aclocal.m4, configure, doc/Makefile.in: Regenerated. + +2006-05-30 H.J. Lu <hongjiu.lu@intel.com> + + * bfd.c (bfd_emul_get_maxpagesize): New. + (bfd_elf_set_pagesize): Likewise. + (bfd_emul_set_maxpagesize): Likewise. + (bfd_emul_get_commonpagesize): Likewise. + (bfd_emul_set_commonpagesize): Likewise. + * bfd-in2.h: Regenerated. + + * elf-bfd.h (elf_backend_data): Add commonpagesize. + (xvec_get_elf_backend_data): New. + (get_elf_backend_data): Use xvec_get_elf_backend_data. + + * elf32-arm.c (elf32_arm_vxworks_bed): Remove const. + * elfxx-target.h (elfNN_bed): Likewise. + + * elf32-arm.c (ELF_COMMONPAGESIZE): Defined. + * elf32-mips.c (ELF_COMMONPAGESIZE): Likewise. + * elf32-ppc.c (ELF_COMMONPAGESIZE): Likewise. + * elf32-sh.c (ELF_COMMONPAGESIZE): Likewise. + * elf32-sh64.c (ELF_COMMONPAGESIZE): Likewise. + * elf32-sparc.c (ELF_COMMONPAGESIZE): Likewise. + * elf64-alpha.c (ELF_COMMONPAGESIZE): Likewise. + * elf64-ppc.c (ELF_COMMONPAGESIZE): Likewise. + * elf64-sparc.c (ELF_COMMONPAGESIZE): Likewise. + * elf64-x86-64.c (ELF_COMMONPAGESIZE): Likewise. + * elfn32-mips.c (ELF_COMMONPAGESIZE): Likewise. + * elfxx-ia64.c (ELF_COMMONPAGESIZE): Likewise. + + * elfxx-target.h (ELF_COMMONPAGESIZE): Define if not defined. + (elfNN_bed): Initialize commonpagesize with ELF_COMMONPAGESIZE. + + * targets.c (bfd_find_target): Support NULL abfd. + +2006-05-30 Nick Clifton <nickc@redhat.com> + + * po/es.po: Updated Spanish translation. + +2006-05-27 Alan Modra <amodra@bigpond.net.au> + H.J. Lu <hongjiu.lu@intel.com> + + * elf.c (assign_file_positions_for_load_sections): Retrieve + maxpagesize from m->p_align if it is valid. Set p_vaddr, + p_paddr and p_align earlier. Revert 2006-05-19 change to p_align. + (copy_elf_program_header): Copy p_align. Set p_align_valid. + +2006-05-26 H.J. Lu <hongjiu.lu@intel.com> + + * elf64-x86-64.c (ELF_MINPAGESIZE): Changed to 0x1000. + +2006-05-25 H.J. Lu <hongjiu.lu@intel.com> + + * elf64-x86-64.c (ELF_MINPAGESIZE): Set to 0x100000. + +2006-05-25 H.J. Lu <hongjiu.lu@intel.com> + + * elf64-x86-64.c (ELF_MAXPAGESIZE): Updated to 0x200000. + +2006-05-26 Alan Modra <amodra@bigpond.net.au> + + * elf.c (sym_is_global): Return a bfd_boolean. + (ignore_section_sym): New function. + (elf_map_symbols): Use ignore_section_sym to discard some syms. + (_bfd_elf_symbol_from_bfd_symbol): Ensure section belongs to + bfd before using elf_section_syms. + +2006-05-25 H.J. Lu <hongjiu.lu@intel.com> + + * config.bfd: (sh-*-linux*): Treat as 64bit target. + (sh*l*-*-netbsdelf*): Likewise. + (sh-*-netbsdelf*): Likewise. + (shl*-*-elf*): Likewise. + (sh[1234]l*-*-elf*): Likewise. + (sh3el*-*-elf*): Likewise. + (shl*-*-kaos*): Likewise. + (sh-*-elf*): Likewise. + (sh[1234]*-elf*): Likewise. + (sh-*-rtems*): Likewise. + (sh-*-kaos*): Likewise. + +2006-05-24 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/1485 + * config.bfd: Set want64 to true if 64bit bfd is used. + (sh-*-linux*): Use targ64_selvecs for 64bit targets. + (sh*l*-*-netbsdelf*): Likewise. + (sh-*-netbsdelf*): Likewise. + (shl*-*-elf*): Likewise. + (sh[1234]l*-*-elf*): Likewise. + (sh3el*-*-elf*): Likewise. + (shl*-*-kaos*): Likewise. + (sh-*-elf*): Likewise. + (sh[1234]*-elf*): Likewise. + (sh-*-rtems*): Likewise. + (sh-*-kaos*): Likewise. + +2006-05-24 Paul Brook <paul@codesourcery.com> + + * elf-bfd.h (elf_backend_data): Add elf_backend_output_arch_local_syms + * elf32-arm.c (output_arch_syminfo): Define. + (elf32_arm_ouput_plt_map_sym, elf32_arm_output_plt_map, + elf32_arm_output_arch_local_syms): New functions. + (elf_backend_output_arch_local_syms): Define. + * elflink.c (bfd_elf_final_link): Call + elf_backend_output_arch_local_syms. + * elfxx-target.h (elf_backend_output_arch_local_syms): Provide default + definition. + (elfNN_bed): Add elf_backend_output_arch_local_syms. + +2006-05-24 Paul Brook <paul@codesourcery.com> + + * elf32-arm.c (put_arm_insn, put_thumb_insn): New functions. + (elf32_thumb_to_arm_stub, elf32_arm_to_thumb_stub, + elf32_arm_finish_dynamic_symbol): Use them. + +2006-05-24 Carlos O'Donell <carlos@systemhalted.org> + Randolph Chung <tausq@debian.org> + + * elf-hppa.h (reloc_hppa_howto_table): Check bitfield for + TPREL21L/TPREL14R relocations. Handle LTOFF_TP14R relocations. + Add handling for TLS relocations. + (elf_hpp_reloc_final_type): Handle TLS relocs. + * elf32-hppa.c: Add authors for cleanup and TLS support. + (hppa_elf_local_got_tls_type, hh_name, eh_name): Define. + (elf32_hppa_link_hash_entry): Add tls_type. + (elf32_hppa_link_hash_table): Add tld_ldm_got. + (hppa_link_has_newfunc): Set tls_type. + (elf32_hppa_link_hash_table_create): Set tls_ldm_got refcount. + (hppa_stub_name): Use hh_name macro. + (elf32_hppa_copy_indirect_symbol): Copy TLS information. + (elf32_hppa_check_relocs): Call elf32_hppa_optimized_tls_reloc. + Handle TLS relocs. + (elf32_hppa_gc_sweep_hook): Likewise. + (allocate_dynrelocs): Handle TLS relocs. + (elf32_hppa_size_dynamic_sections): Count space required by TLS + relocs. Use hh_name macro. + (dtpoff_base): New function. + (tpoff): Likewise. + (elf32_hppa_optimized_tls_reloc): Likewise. + (final_link_relocate): Handle TLS relocs. + (elf32_hppa_relocate_section): Handle TLS relocs. Use eh_name + and hh_name macros. + (elf32_hppa_finish_dynamic_symbol): Setup TLS got entries. Use + hh_name and eh_name macros. + (elf32_hppa_reloc_type_clas): Handle TLS relocs. + +2006-05-24 Bjoern Haase <bjoern.m.haase@web.de> + + * archures.c: Add bfd_mach_avr6. + * cpu-avr.c: Likewise. + * reloc.c (BFD_RELOC_AVR_LO8_LDI_GS, BFD_RELOC_AVR_HI8_LDI_GS): + New relocations. + * libbfd.h: Regenerate. + * bfd-in2.h:Regenerate. + * elf32-avr.h: New file. Protoypes for functions accessed from ld. + * elf32-avr.c: Add elf32-avr.h to include list. + (elf32_avr_stub_hash_entry): New function. + (elf32_avr_link_hash_table): New struct. + (avr_link_hash_table): Likewise. + (avr_stub_hash_entry): Likewise. + (avr_stub_hash_lookup): New function. + (stub_hash_newfunc): New function. + (elf32_avr_link_hash_table_create): New function. + (elf32_avr_link_hash_table_free): New function. + (avr_get_stub_addr): New function. + (debug_relax, debug_stubs): Add new global variables controlling + debugging printout to stdout. + (avr_pc_wrap_around): Change the type to bfd_vma. + (avr_replace_call_ret_sequences): Add a new variable controling + linkrelax optimizations. + (avr_stub_is_required_for_16_bit_reloc): New function. + (avr_final_link_relocate): + Add linker hash table to parameter list. Use stub addr. if necessary. + (elf32_avr_relocate_section): + Add linker hashtable to parameter list of avr_final_link_relocate. + (bfd_elf_avr_final_write_processing): Add support for bfd_mach_avr6. + (elf32_avr_object_p): Add support for E_AVR_MACH_AVR6. + (elf32_avr_relax_delete_bytes): + Iterate over all sections of a bfd when adjusting relocs addends. + (elf32_avr_relax_section): + Evaluate avr_replace_call_ret_sequences and recalculate the size of + stub section. + (avr_stub_name): New function. + (avr_get_stub_entry): New function. + (avr_add_stub): New function. + (avr_build_one_stub): New function. + (avr_size_one_stub): New function. + (elf32_avr_setup_params): New function. + (elf32_avr_setup_section_lists): New function. + (get_local_syms): New function. + (elf32_avr_size_stubs): New function. + (bfd_elf32_bfd_link_hash_table_create): New function. + (bfd_elf32_bfd_link_hash_table_free): New function. + +2006-05-23 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/2655 + PR ld/2657 + * elf-eh-frame.c (_bfd_elf_write_section_eh_frame): Properly + update CIE/FDE length. Don't pad to the section alignment. + +2006-05-23 Jie Zhang <jie.zhang@analog.com> + + * elf32-bfin.c (bfinfdpic_relocate_section): Clear reloc for + deteted entries in .eh_frame section. + +2006-05-23 Jie Zhang <jie.zhang@analog.com> + + * elf32-bfin.c (bfin_check_relocs): Use __GLOBAL_OFFSET_TABLE_ + instead of _GLOBAL_OFFSET_TABLE_. + (bfin_relocate_section): Ditto. + (_bfin_create_got_section): Ditto. + (elf32_bfinfdpic_create_dynamic_sections): Use + __PROCEDURE_LINKAGE_TABLE_ instead of _PROCEDURE_LINKAGE_TABLE_. + (bfin_finish_dynamic_symbol): Use __DYNAMIC instead of _DYNAMIC. + +2006-05-23 Alan Modra <amodra@bigpond.net.au> + + * elf64-ppc.c (compare_symbols): Prefer strong dynamic global + function syms over other syms. + +2006-05-22 Daniel Jacobowitz <dan@codesourcery.com> + + * elflink.c (_bfd_elf_add_dynamic_entry): Remove DT_TEXTREL + check. + (bfd_elf_final_link): Add a late DT_TEXTREL check. + * elfxx-mips.c (MIPS_ELF_READONLY_SECTION): Define. + (mips_elf_create_dynamic_relocation): Set DF_TEXTREL. + (_bfd_mips_elf_check_relocs): Delete MIPS_READONLY_SECTION. + Use MIPS_ELF_READONLY_SECTION. + (_bfd_mips_elf_size_dynamic_sections): Clear DF_TEXTREL after + creating DT_TEXTREL. + (_bfd_mips_elf_finish_dynamic_sections): Clear textrel markers + if no text relocations were generated. + +2006-05-19 H.J. Lu <hongjiu.lu@intel.com> + + * elfxx-ia64.c (ELF_MAXPAGESIZE): Fix a typo in comment. + +2006-05-19 Alan Modra <amodra@bigpond.net.au> + + * elf.c (elf_fake_sections): Formatting. + (assign_file_positions_for_load_sections): Only add SEC_ALLOC + sections to p_memsz. Remove hack for PT_NOTE sections. Allow + section alignment to increase p_align for PT_LOAD. + (assign_file_positions_for_non_load_sections): Remove ARM BPABI + hack for PT_DYNAMIC. Instead, set p_filesz for all segments + other than PT_LOAD, and PT_NOTE in core. + +2006-05-17 Alan Modra <amodra@bigpond.net.au> + + * elf.c (assign_file_positions_for_segments): Split into.. + (assign_file_positions_for_load_sections): ..this, and.. + (assign_file_positions_for_non_load_sections): ..this new function,.. + (assign_file_positions_except_relocs): ..writing program headers here. + +2006-05-17 Alan Modra <amodra@bigpond.net.au> + + * elflink.c (elf_gc_sweep): Don't specially keep non-alloc, + non-load sections if they have relocs. + +2006-05-15 Paul Brook <paul@codesourcery.com> + + * cpu-arm.c (bfd_is_arm_mapping_symbol_name): Rename ... + (bfd_is_arm_special_symbol_name): ... to this. Add type argument. + Check symbol name is of specified type. + * elf32-arm.c (elf32_arm_is_target_special_symbol, + arm_elf_find_function, elf32_arm_output_symbol_hook): Use + bfd_is_arm_special_symbol_name. + * bfd-in.h (BFD_ARM_SPECIAL_SYM_TYPE_MAP, + BFD_ARM_SPECIAL_SYM_TYPE_TAG, BFD_ARM_SPECIAL_SYM_TYPE_OTHER, + BFD_ARM_SPECIAL_SYM_TYPE_ANY): Define. + (bfd_is_arm_mapping_symbol_name): Remove prototype. + (bfd_is_arm_special_symbol_name): Add prototype. + * bfd-in2.h: Regenerate. + +2006-05-15 David Heine <dlheine@tensilica.com> + Bob Wilson <bob.wilson@acm.org> + + * elf32-xtensa.c (check_loop_aligned): Fix reversed check for + undefined opcode. Clean up assertions. + (narrow_instruction, widen_instruction): Remove "do_it" parameters. + Factor most of the code into separate functions.... + (can_narrow_instruction, can_widen_instruction): New. + (prev_instr_is_a_loop): New. + (compute_ebb_proposed_actions): Combine error handling code for + decode errors. Replace call to insn_decode_len with inline code. + Use can_narrow_instruction and can_widen_instruction. Handle errors + from call to xtensa_opcode_is_loop. + (relax_section): Adjust calls to narrow_instruction and + widen_instruction. + +2006-05-15 Alan Modra <amodra@bigpond.net.au> + + PR 2658 + * elf32-ppc.c (ppc_elf_relax_section): Don't segfault on non-pic + -shared link. + +2006-05-11 Michael Matz <matz@suse.de> + + * elflink.c (match_group_member): Correctly iterate group + members. + +2006-05-11 Paul Brook <paul@codesourcery.com> + + * elf32-arm.c (elf32_arm_reloc_map): Add MOVW and MOVT relocs. + (elf32_arm_final_link_relocate): Handle MOVW and MOVT relocs. + (elf32_arm_gc_sweep_hook, elf32_arm_check_relocs): Ditto. + * reloc.c: Ditto. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + * libcoff.h: Regenerate. + +2006-05-11 Mike Bland <mbland@google.com> + + * elf.c (_bfd_elf_init_private_section_data): Don't change + section type if already set. + +2006-05-10 Nick Clifton <nickc@redhat.com> + + PR ld/2607 + * elfcode.h (valid_section_index_p): New function: Checks for a + valid section index. Allows indicies in the range SHN_LOPROC to + SHN_HIOS. + (elf_object_p): Use valid_section_index_p. + +2006-05-11 Pedro Alves <pedro_alves@portugalmail.pt> + + * coff-arm.c (ARM_26D, ARM_32, ARM_RVA_32, ARM_SECTION, + ARM_SECREL): Mark WinCE versions of these relocs as partial + inplace. + (coff_arm_relocate_section): Adjust addend for WinCE. + +2006-05-10 Alan Modra <amodra@bigpond.net.au> + + PR 2342 + * elflink.c (_bfd_elf_default_action_discarded): Revert 2006-02-16. + +2006-05-09 Nick Clifton <nickc@redhat.com> + + * coffcode.h (coff_write_relocs): Produce an error message if a an + out-of-range symbol index is detected in a reloc. + +2006-05-09 Ben Elliston <bje@au.ibm.com> + + * elf64-ppc.c (ppc64_elf_finish_dynamic_symbol): Remove unused + local variable `dynobj'. + +2006-05-05 Bjoern Haase <bjoern.m.haase@web.de> + + * elf32-avr.c (elf32_avr_relax_delete_bytes): Iterate over all + of the bfd's sections for the reloc-addend adjustments. + +2006-05-05 Martin Schwidefsky <schwidefsky@de.ibm.com> + + * elf32-s390.c (invalid_tls_insn): Call bfd_set_error. + (elf_s390_relocate_section): Add code to do the GD->LE and + LD->LE TLS linker optimizations if a brasl instruction is used + for the __tls_get_offset function call. + * elf64-s390.c (invalid_tls_insn): Call bfd_set_error. + +2006-05-05 Alan Modra <amodra@bigpond.net.au> + + * elf64-ppc.c (ppc64_elf_tls_optimize): Only optimize + R_PPC64_TPREL64 and R_PPC64_DTPMOD64 relocs when they are in + the .toc and referenced by a TLS code sequence. + (ppc64_elf_edit_toc): Cater for the unlikely situation that + .toc is the first section in a file. + +2006-05-04 Andreas Schwab <schwab@suse.de> + + * aoutf1.h (struct external_sparc_core): Declare c_regs as struct + regs instead of an array of int. + (struct external_solaris_bcp_core): Likewise. + (swapcore_sun3): Use offsetof instead of computing the offset + manually. + (swapcore_sparc): Likewise. Simplify reference to c_regs. + (swapcore_solaris_bcp): Likewise. + +2006-05-04 Daniel Jacobowitz <dan@codesourcery.com> + + * elfxx-mips.c (_bfd_mips_elf_hide_symbol): Adjust handling + for missing GOTs. + +2006-05-04 Daniel Jacobowitz <dan@codesourcery.com> + + * cpu-arm.c (bfd_is_arm_mapping_symbol_name): Accept more + mapping symbols. + +2006-05-04 Ben Elliston <bje@au.ibm.com> + + * coff-or32.c (bfd_section_from_shdr): Remove unused local + variable `ptr'. + * cofflink.c (process_embedded_commands): Remove unused local + variables `had_read' and `had_shared'. + * ecofflink.c (bfd_ecoff_debug_accumulate): Remove unused local + variable `fdr_adr'. + * ihex.c (ihex_read_section): Remove unused local variable `addr'. + +2006-05-03 Alan Modra <amodra@bigpond.net.au> + + * libbfd-in.h (_bfd_generic_new_section_hook): Declare. + * section.c (bfd_abs_symbol, bfd_com_symbol): Delete. + (bfd_und_symbol, bfd_ind_symbol): Delete. + (BFD_FAKE_SECTION): Remove SYM_PTR param, set symbol_ptr_ptr to + &SEC.symbol. + (STD_SECTION): Adjust. + (_bfd_generic_new_section_hook): New function, extracted from.. + (bfd_section_init): ..here. + (bfd_make_section_old_way): Call new_section_hook for abs, com, + und and ind sections. + * elf.c (_bfd_elf_large_com_section): Adjust. + * aoutx.h (new_section_hook): Call _bfd_generic_new_section_hook. + * pdp11.c (new_section_hook): Likewise. + * coffcode.h (coff_new_section_hook): Likewise. + * ecoff.c (_bfd_ecoff_new_section_hook): Likewise. + * elf.c (_bfd_elf_new_section_hook): Likewise. + * vms.c (vms_new_section_hook): Likwise. + * elf32-arm.c (elf32_arm_new_section_hook): Check used_by_bfd isn't + already set. + * elf32-sh64.c (sh64_elf_new_section_hook): Likewise. + * elf32-xtensa.c (elf_xtensa_new_section_hook): Likewise. + * elf64-mmix.c (mmix_elf_new_section_hook): Likewise. + * elf64-ppc.c (ppc64_elf_new_section_hook): Likewise. + * elfxx-mips.c (_bfd_mips_elf_new_section_hook): Likewise. + * elfxx-sparc.c (_bfd_sparc_elf_new_section_hook): Likewise. + * ieee.c (ieee_new_section_hook): Likewise. Call + _bfd_generic_new_section_hook too. + * mmo.c (mmo_new_section_hook): Likewise. + * oasys.c (oasys_new_section_hook): Likewise. + * som.c (som_new_section_hook): Likewise. + * coff-w65.c (reloc_processing): Don't use bfd_abs_symbol. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + +2006-05-03 Alan Modra <amodra@bigpond.net.au> + + * hash.c (DEFAULT_SIZE): Revert last change. + (higher_prime_number): Correct test for no larger prime. Don't + abort on error, instead return 0. Depopulate primes[]. + (bfd_hash_lookup): If we overflow size, refuse to grow table. + +2006-05-02 Paul Brook <paul@codesourcery.com> + + * elf32-arm.c (elf32_arm_final_link_relocate): Set thumb funciton bit + for R_ARM_REL32. + +2006-05-02 Ben Elliston <bje@au.ibm.com> + + * archive.c (bfd_generic_archive_p): Remove unused local variable + `fail'. + * dwarf2.c (decode_line_info): Remove unused local variable + `basic_block'. + * elfcode.h (elf_slurp_reloc_table_from_section): Remove unused + local variable `s'. + * tekhex.c (tekhex_write_object_contents): Remove unused local + variable `bytes_written'. + * aout-ns32k.c (MY_swap_std_reloc_out): Remove unused local + variable `r_addend'. + * elf32-dlx.c (dlx_rtype_to_howto): Remove breaks after returns. + * elfxx-mips.c (_bfd_elf_mips_mach): Remove breaks after returns. + (_bfd_ns32k_relocate_contents): Remove break after return. + * elf.c (bfd_section_from_shdr): Remove breaks after returns. + +2006-05-02 Nick Clifton <nickc@redhat.com> + + * elf32-sh-symbian.c: Rename local define DEBUG to SYMBIAN_DEBUG + in order to avoid conflicts with the global DEBUG define. + +2006-05-02 Alan Modra <amodra@bigpond.net.au> + + * dwarf2.c: Formatting. + * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Simplify + output section check. + * elf32-i370.c: Warning fixes inside #ifdef DEBUG. + * elf32-m32c.c: Similarly. + * elf32-ppc.c: Similarly. + * elf32-v850.c: Similarly. + * nlm32-sparc.c: Similarly. + * elfcode.h: Similarly. + (elf_symbol_flags): Delete. + * elflink.c (elf_link_input_bfd): Comment typo. + +2006-05-01 DJ Delorie <dj@redhat.com> + + * bfd-in.h (bfd_hash_table): Add count field. + * bfd-in2.h: Regenerate. + * hash.c (higher_prime_number): New. + (bfd_hash_table_inint_n): Init count field. + (bfd_hash_lookup): Grow table as needed. + +2006-04-27 Kaz Kojima <kkojima@rr.iij4u.or.jp> + + PR binutils/2584 + * tekhex.c (getvalue): Change return type to bfd_boolean and + add the new parameter. Return false if the unexpected character + is found. + (getsym): Likewise. + (first_phase): Change return type to bfd_boolean and return + false if the unexpected character is found. Replace abort + with returning false. + (pass_over): Change return type to bfd_boolean and the type of + the second argument to bfd_boolean (*) (bfd *, int, char *). + Return false if FUNC returns false. + (tekhex_object_p): Return NULL if pass_over fails. + +2006-04-27 Alan Modra <amodra@bigpond.net.au> + + * coff-rs6000.c (xcoff_write_archive_contents_old): Warning fix. + +2006-04-26 H.J. Lu <hongjiu.lu@intel.com> + + PR binutils/2593 + * elf.c (_bfd_elf_new_section_hook): Don't set section ELF type + and flags if its BFD flags have been set. + (_bfd_elf_init_private_section_data): Don't copy the output ELF + section type from input if it has been set to something + different. + +2006-04-25 H.J. Lu <hongjiu.lu@intel.com> + + PR binutils/2467 + * elf.c (_bfd_elf_close_and_cleanup): Check elf_tdata (abfd) + is NULL first. + + * elf32-arm.c (elf32_arm_close_and_cleanup): Check if + abfd->sections is NULL. + (elf32_arm_bfd_free_cached_info): New. + (bfd_elf32_bfd_free_cached_info): Defined. + + * elfxx-target.h (bfd_elfNN_bfd_free_cached_info): Default it + to _bfd_free_cached_info. + + * libbfd-in.h (_bfd_free_cached_info): New. + * libbfd: Regenerated. + + * opncls.c (_bfd_delete_bfd): Check if abfd->memory is NULL. + (_bfd_free_cached_info): New. + +2006-04-21 Alan Modra <amodra@bigpond.net.au> + + * elf.c (assign_file_positions_except_relocs): Move code setting + file position of non-loaded sections.. + (assign_file_positions_for_segments): ..to here. + +2006-04-20 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/2537 + * elf.c (bfd_section_from_shdr): Allow sections reserved for + applications. Issue an error on sections we don't know how + to handle. + +2006-04-19 Alan Modra <amodra@bigpond.net.au> + + * Makefile.am: Run "make dep-am". + * Makefile.in: Regenerate. + +2006-04-19 Alan Modra <amodra@bigpond.net.au> + + * warning.m4 (--enable-werror): Format help message. + (--enable-build-warnings): Likewise. + * configure: Regenerate. + +2006-04-18 Nick Clifton <nickc@redhat.com> + + PR 2257 + * elfcode.h (elf_object_p): Allow files with corrupt e_shstrndx + fields to still be handled as ELF files. + +2006-04-16 Daniel Jacobowitz <dan@codesourcery.com> + + * po/SRC-POTFILES.in: Regenerated. + +2006-04-16 Daniel Jacobowitz <dan@codesourcery.com> + + * configure.in: Update version to 2.17.50. + * configure: Regenerated. + +2006-04-14 David Heine <dlheine@tensilica.com> + + * elf32-xtensa.c (build_reloc_opcodes): New. + (compute_text_actions): Use it to decode opcodes outside inner loop. + (check_section_ebb_pcrels_fit): Add "reloc_opcodes" argument, and if + it is set, use it to get the opcodes for relocations. + (move_shared_literal): Adjust call to check_section_ebb_pcrels_fit. + +2006-04-08 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/2513 + * elf32-i386.c (GOT_TLS_MASK): New macro for tls_type. + (GOT_TLS_IE_IE): Likewise. + (GOT_TLS_IE_GD): Likewise. + (GOT_TLS_IE_MASK): Likewise. + (elf_i386_check_relocs): For global symbols, set GOT_TLS_IE_GD + and GOT_TLS_IE_IE for R_386_TLS_GD and R_386_TLS_IE + respectively. + (allocate_dynrelocs): If both GOT_TLS_IE_IE and GOT_TLS_IE_GD + are set, treat tls_type as GOT_TLS_IE_BOTH. + (elf_i386_relocate_section): Likewise. + +2006-04-07 Randolph Chung <tausq@debian.org> + + * elf64-hppa.c (elf64_hppa_grok_prstatus): New function. + (elf64_hppa_grok_psinfo): Likewise. + (elf_backend_grok_pstatus, elf_backend_grok_psinfo): Define. + +2006-04-06 DJ Delorie <dj@redhat.com> + + * elf32-m32c.c (m32c_elf_relocate_section): Generate a symbol for + each plt entry we create. + +2006-04-06 Carlos O'Donell <carlos@codesourcery.com> + + * po/Make-in: Add install-html target. + * Makefile.am: Rename docdir to bfddocdir. Add datarootdir, docdir + htmldir. Add install-html and install-html-recursive targets. + * Makefile.in: Regenerate. + * configure.in: AC_SUBST for datarootdir, docdir and htmldir. + * configure: Regenerate. + +2006-04-06 H.J. Lu <hongjiu.lu@intel.com> + + * elfxx-ia64.c (elfNN_ia64_relax_section): Skip unneeded passes + with the skip_relax_pass_0 and skip_relax_pass_1 bits in the + section structure. + +2006-04-05 Bernd Schmidt <bernd.schmidt@analog.com> + + * elf32-bfin.c (bfinfdpic_relocs_info_hash): Sprinkle casts to + eliminate warnings. + +2006-04-05 H.J. Lu <hongjiu.lu@intel.com> + James E Wilson <wilson@specifixinc.com> + + PR ld/2442 + * elfxx-ia64.c (elfNN_ia64_dyn_sym_info): Remove next. + (elfNN_ia64_local_hash_entry): Add count, sorted_count and + size. + (elfNN_ia64_link_hash_entry): Likewise. + (elfNN_ia64_new_elf_hash_entry): Initialize count, sorted_count + and size. + (elfNN_ia64_hash_copy_indirect): Updated elfNN_ia64_dyn_sym_info + processing. + (elfNN_ia64_hash_hide_symbol): Likewise. + (elfNN_ia64_global_dyn_sym_thunk): Likewise. + (elfNN_ia64_local_dyn_sym_thunk): Likewise. + (elfNN_ia64_global_dyn_info_free): New function. + (elfNN_ia64_local_dyn_info_free): Likewise. + (elfNN_ia64_hash_table_free): Free local and global + elfNN_ia64_dyn_sym_info. + (addend_compare): New function. + (sort_dyn_sym_info): Likewise. + (get_dyn_sym_info): Updated to use binary search for addend. + (elfNN_ia64_check_relocs): Scan relocations to create dynamic + relocation arrays first. + +2006-04-05 Bernd Schmidt <bernd.schmidt@analog.com> + + * elf32-bfin.c (_bfin_create_got_section): Don't generate a _gp + symbol. + +2006-04-05 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/2411 + * elflink.c (check_dynsym): New. + (elf_link_output_extsym): Use it. + (bfd_elf_final_link): Likewise. + +2006-04-05 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/2404 + * elflink.c (_bfd_elf_merge_symbol): Skip the default indirect + symbol from the dynamic definition with the default version if + its type and the type of existing regular definition mismatch. + +2006-04-05 Richard Sandiford <richard@codesourcery.com> + Daniel Jacobowitz <dan@codesourcery.com> + + * config.bfd (sparc-*-vxworks*): New stanza. + * configure.in (bfd_elf32_sparc_vxworks_vec): New stanza. + (bfd_elf32_sparc_vec, bfd_elf64_sparc_vec): Add elf-vxworks.lo. + * configure: Regenerate. + * elf32-sparc.c: Include elf-vxworks.h. + (elf32_sparc_vxworks_link_hash_table_create: New. + (elf32_sparc_vxworks_final_write_processing): New. + (TARGET_BIG_SYM): Override for VxWorks. + (TARGET_BIG_NAME, ELF_MINPAGESIZE): Likewise. + (bfd_elf32_bfd_link_hash_table_create): Likewise. + (elf_backend_want_got_plt, elf_backend_plt_readonly): Likewise. + (elf_backend_got_header_size, elf_backend_add_symbol_hook): Likewise. + (elf_backend_link_output_symbol_hook): Likewise. + (elf_backend_emit_relocs): Likewise. + (elf_backend_final_write_processing, elf32_bed): Likewise. + * elfxx-sparc.c: Include libiberty.h and elf-vxworks.h. + (sparc_vxworks_exec_plt0_entry, sparc_vxworks_exec_plt_entry): New. + (sparc_vxworks_shared_plt0_entry, sparc_vxworks_shared_plt_entry): New. + (_bfd_sparc_elf_link_hash_table_create): Don't initialize + build_plt_entry here. + (create_got_section): Initialize sgotplt for VxWorks. + (_bfd_sparc_elf_create_dynamic_sections): Initialize build_plt_entry, + plt_header_size and plt_entry_size, with new VxWorks-specific settings. + Call elf_vxworks_create_dynamic_sections for VxWorks. + (allocate_dynrelocs): Use plt_header_size and plt_entry_size. + Allocate room for .got.plt and .rela.plt.unloaded entries on VxWorks. + (_bfd_sparc_elf_size_dynamic_sections): Don't allocate a nop in .plt + for VxWorks. Check for the .got.plt section. + (sparc_vxworks_build_plt_entry): New function. + (_bfd_sparc_elf_finish_dynamic_symbol): Add handling of VxWorks PLTs. + Don't make _GLOBAL_OFFSET_TABLE_ and _PROCEDURE_LINKAGE_TABLE_ + absolute on VxWorks. + (sparc32_finish_dyn): Add special handling for DT_RELASZ + and DT_PLTGOT on VxWorks. + (sparc_vxworks_finish_exec_plt): New. + (sparc_vxworks_finish_shared_plt): New. + (_bfd_sparc_elf_finish_dynamic_sections): Call them. + Use plt_header_size and plt_entry_size. + * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Add is_vxworks, + srelplt2, sgotplt, plt_header_size and plt_entry_size fields. + * Makefile.am (elfxx-sparc.lo): Depend on elf-vxworks.h. + (elf32-sparc.lo): Likewise. + * Makefile.in: Regenerate. + * targets.c (bfd_elf32_sparc_vxworks_vec): Declare. + (_bfd_target_vector): Add a pointer to it. + +2006-03-30 Ben Elliston <bje@au.ibm.com> + + PR ld/2267 + * elflink.c (elf_fixup_link_order): Ensure `elfsec' is not a + special section number that exceeds the number of ELF sections + (eg. SHN_MIPS_SCOMMON). + +2006-03-27 Richard Sandiford <richard@codesourcery.com> + + * elfxx-mips.c (mips_got_entry): Add more commentary. + (mips_elf_local_got_index): Use the hash table entry to record + the GOT index of forced-local symbols. + (mips_elf_initialize_tls_index): Rearrange code. Store the index + in either the hash table entry or the mips_got_entry, not both. + Add more commentary. + (mips_elf_multi_got): Make sure the g->next is nonnull when calling + mips_elf_initialize_tls_index. + +2006-03-25 Bernd Schmidt <bernd.schmidt@analog.com> + + * elf32-bfin.c (bfd_const_reloc, bfd_oper_reloc, bfin_push_reloc, + RELOC_STACK_SIZE, reloc_stack, reloc_stack_tos, is_reloc_stack_empty, + reloc_stack_push, reloc_stack_pop, reloc_stack_operate, + bfin_areloc_howto_table): Delete. All + uses deleted as well. + (bfin_reloc_map): Delete all stack relocs. + (bfin_info_to_howto, bfin_bfd_reloc_type_lookup, + bfin_reloc_type_lookup): Don't support them. + (bfin_relocate_section): Don't try to handle them. + + * config.bfd (bfin-*-*): Add bfd_elf32_bfinfdpic_vec. + * configure.in: Likewise. + * configure: Regenerate. + * elf32-bfin.c: Include "elf/dwarf2.h" and "hashtab.h". + (BFIN_RELOC_MAX): Now 0x21. + (bfin_howto_table, bfin_reloc_map): Add FD-PIC relocs. + (bfd_elf32_bfinfdpic_vec): Declare. + (IS_FDPIC): New macro. + (struct bfinfdpic_elf_link_hash_table): New struct. + (bfinfdpic_hash_table, bfinfdpic_got_section, + bfinfdpic_gotrel_section, bfinfdpic_gotfixup_section, + bfinfdpic_plt_setion, bfinfdpic_pltrel_section, + bfinfdpic_relocs_info, bfinfdpic_got_initial_offset, + bfinfdpic_plt_initial_offset): Accessor macros for it. + (BFINFDPIC_SYM_LOCAL, BFINFDPIC_FUNCDESC_LOCAL): New macros. + (struct bfinfdpic_relocs_info): New struct. + (LZPLT_RESOLVER_EXTRA, LZPLT_NORMAL_SIZE, LZPLT_ENTRIES, + BFINFDPIC_LZPLT_BLOCK_SIZE, BFINFDPIC_LZPLT_RESOLV_LOC, + DEFAULT_STACK_SIZE): New macros. + (bfinfdpic_elf_link_hash_table_create, bfinfdpic_relocs_info_hash, + bfinfdpic_relocs_info_eq, bfinfdpics_relocs_info_find, + bfinfdpic_relocs_info_for_global, bfinfdpic_relocs_info_for_local, + bfinfdpic_pic_merge_early_relocs_info, _bfinfdpic_add_dyn_reloc, + _bfinfdpic_add_rofixup, _bfinfdpic_osec_to_segment, + _bfinfdpic_osec_readonly_p, bfinfdpic_relocate_section, + bfinfdpic_check_relocs, bfinfdpic_gc_sweep_hook, + _bfinfdpic_link_omit_section_dynsym, _bfin_create_got_section, + elf32_bfinfdpic_create_dynamic_sections, _bfinfdpic_get_fd_entry, + _bfinfdpic_compute_got_alloc_data, _bfinfdpic_get_got_entry, + _bfinfdpic_assign_got_entries, _bfinfdpic_assign_plt_entries, + _bfinfdpic_resolve_final_relocs_info, + elf32_bfinfdpic_size_dynamic_sections, + elf32_bfinfdpic_always_size_sections, + elf32_bfinfdpic_modify_segment_map, + _bfinfdpic_count_got_plt_entries, + elf32_bfinfdpic_finish_dynamic_sections, + elf32_bfinfdpic_adjust_dynamic_symbol, + elf32_bfinfdpic_finish_dynamic_symbol, + elf32_bfinfdpic_elf_use_relative_eh_frame, + elf32_bfinfdpic_elf_encode_eh_address, + elf32_bfin_object_p, bfin_elf_copy_private_bfd_data, + elf32_bfinfdpic_copy_private_bfd_data, + (struct _bfinfdpic_dynamic_got_info, + struct _bfinfdpic_dynamic_got_plt_info): New structs. + (elf32_bfin_print_private_bfd_data): Print PIC flags. + (elf32_bfin_merge_private_bfd_data): Extend to support FD-PIC. + (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME, elf32_bed, + elf_backend_got_header_size, bfd_elf32_bfd_link_hash_table_create, + elf_backend_always_size_sectinos, elf_backend_modify_segment_map, + bfd_elf32_bfd_copy_private_bfd_data, + elf_backend_create_dynamic_sections, elf_backend_adjust_dynamic_symbol, + elf_backend_size_dynamic_sections, elf_backend_finish_dynamic_symbol, + elf_backend_finish_dynamic_sections, elf_backend_relocate_section, + elf_backend_can_make_relative_eh_frame, elf_backend_check_relocs, + elf_backend_can_make_ldsa_relative_eh_frame, elf_backend_may_use_rel_p, + elf_backend_may_use_rela_p, elf_backend_default_use_rela_p, + elf_backend_omit_section_dynsym): Redefine these macros and include + "elf32-target.h" again to create the elf32-bfinfdpic target. + * reloc.c (BFD_RELOC_BFIN_GOT17M4, BFD_RELOC_BFIN_GOTHI, + BFD_RELOC_BFIN_GOTLO, BFD_RELOC_BFIN_FUNCDESC, + BFD_RELOC_BFIN_FUNCDESC_GOT17M4, BFD_RELOC_BFIN_FUNCDESC_GOTHI, + BFD_RELOC_BFIN_FUNCDESC_GOTLO, BFD_RELOC_BFIN_FUNCDESC_VALUE, + BFD_RELOC_BFIN_FUNCDESC_GOTOFF17M4, BFD_RELOC_BFIN_FUNCDESC_GOTOFFHI, + BFD_RELOC_BFIN_FUNCDESC_GOTOFFLO, BFD_RELOC_BFIN_GOTOFFHI, + BFD_RELOC_BFIN_GOTOFFLO): New. + * targets.c (bfd_elf32_bfinfdpic_vec): New bfd_target. + (_bfd_target_vector): Add it. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + +2006-03-25 Richard Sandiford <richard@codesourcery.com> + + * cpu-m68k.c (bfd_m68k_compatible): Treat ISA A+ and ISA B code as + incompatible. Likewise MAC and EMAC code. + * elf32-m68k.c (elf32_m68k_merge_private_bfd_data): Use + bfd_get_compatible to set the new bfd architecture. Rely on it + to detect incompatibilities. + +2006-03-23 Michael Matz <matz@suse.de> + + * reloc.c: Add BFD_RELOC_X86_64_GOT64, BFD_RELOC_X86_64_GOTPCREL64, + BFD_RELOC_X86_64_GOTPC64, BFD_RELOC_X86_64_GOTPLT64, + BFD_RELOC_X86_64_PLTOFF64. + * bfd-in2.h: Regenerated. + * libbfd.h: Regenerated. + * elf64-x86-64.c (x86_64_elf_howto_table): Correct comment. + Add howtos for above relocs. + (x86_64_reloc_map): Add mappings for new relocs. + (elf64_x86_64_check_relocs): R_X86_64_GOT64, R_X86_64_GOTPCREL64, + R_X86_64_GOTPLT64 need a got entry. R_X86_64_GOTPLT64 also a PLT + entry. R_X86_64_GOTPC64 needs a .got section. R_X86_64_PLTOFF64 + needs a PLT entry. + (elf64_x86_64_gc_sweep_hook): Reflect changes from + elf64_x86_64_check_relocs for the new relocs. + (elf64_x86_64_relocate_section): Handle new relocs. + +2006-03-22 Bob Wilson <bob.wilson@acm.org> + + * elf32-xtensa.c (xtensa_read_table_entries): Remove assertion that + rel->r_addend is zero. + +2006-03-22 Richard Sandiford <richard@codesourcery.com> + + * elfxx-mips.c (_bfd_mips_vxworks_finish_dynamic_symbol): Fix type + of "loc". + +2006-03-22 Richard Sandiford <richard@codesourcery.com> + Daniel Jacobowitz <dan@codesourcery.com> + Phil Edwards <phil@codesourcery.com> + Zack Weinberg <zack@codesourcery.com> + Mark Mitchell <mark@codesourcery.com> + Nathan Sidwell <nathan@codesourcery.com> + + * bfd-in2.h: Regenerate. + * config.bfd (mips*-*-vxworks*, mips*el-*-vxworks*): New stanzas. + * configure.in (bfd_elf32_bigmips_vxworks_vec): New stanza. + (bfd_elf32_littlemips_vxworks_vec): Likewise. + (bfd_elf32_bigmips_vec): Add elf-vxworks.lo. + (bfd_elf32_littlemips_vec): Likewise. + (bfd_elf32_nbigmips_vec): Likewise. + (bfd_elf32_nlittlemips_vec): Likewise. + (bfd_elf32_ntradbigmips_vec): Likewise. + (bfd_elf32_ntradlittlemips_vec): Likewise. + (bfd_elf32_tradbigmips_vec): Likewise. + (bfd_elf32_tradlittlemips_vec): Likewise. + (bfd_elf64_bigmips_vec): Likewise. + (bfd_elf64_littlemips_vec): Likewise. + (bfd_elf64_tradbigmips_vec): Likewise. + (bfd_elf64_tradlittlemips_vec): Likewise. + * elf32-mips.c: Include elf-vxworks.h. + (mips_info_to_howto_rel): Use elf_backend_mips_rtype_to_howto + instead of calling mips_elf32_rtype_to_howto directly. + (mips_vxworks_copy_howto_rela): New reloc howto. + (mips_vxworks_jump_slot_howto_rela): Likewise. + (mips_vxworks_bfd_reloc_type_lookup): New function. + (mips_vxworks_rtype_to_howto): Likewise. + (mips_vxworks_final_write_processing): Likewise. + (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME): Override for VxWorks. + (TARGET_BIG_SYM, TARGET_BIG_NAME, elf_bed, ELF_MAXPAGESIZE): Likewise. + (elf_backend_want_got_plt): Likewise. + (elf_backend_want_plt_sym): Likewise. + (elf_backend_got_symbol_offset): Likewise. + (elf_backend_want_dynbss): Likewise. + (elf_backend_may_use_rel_p): Likewise. + (elf_backend_may_use_rela_p): Likewise. + (elf_backend_default_use_rela_p): Likewise. + (elf_backend_got_header_size: Likewise. + (elf_backend_plt_readonly): Likewise. + (bfd_elf32_bfd_reloc_type_lookup): Likewise. + (elf_backend_mips_rtype_to_howto): Likewise. + (elf_backend_adjust_dynamic_symbol): Likewise. + (elf_backend_finish_dynamic_symbol): Likewise. + (bfd_elf32_bfd_link_hash_table_create): 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_backend_additional_program_headers): Likewise. + (elf_backend_modify_segment_map): Likewise. + (elf_backend_symbol_processing): Likewise. + * elfxx-mips.c: Include elf-vxworks.h. + (mips_elf_link_hash_entry): Add is_relocation_target and + is_branch_target fields. + (mips_elf_link_hash_table): Add is_vxworks, srelbss, sdynbss, srelplt, + srelplt2, sgotplt, splt, plt_header_size and plt_entry_size fields. + (MIPS_ELF_RELA_SIZE, MIPS_ELF_REL_DYN_NAME): New macros. + (MIPS_RESERVED_GOTNO): Take a mips_elf_link_hash_table argument. + Return 3 for VxWorks. + (ELF_MIPS_GP_OFFSET): Change the argument from a bfd to a + mips_elf_link_hash_table. Return 0 for VxWorks. + (MIPS_ELF_GOT_MAX_SIZE): Change the argument from a bfd to a + mips_elf_link_hash_table. Update the call to ELF_MIPS_GP_OFFSET. + (mips_vxworks_exec_plt0_entry): New variable. + (mips_vxworks_exec_plt_entry): Likewise. + (mips_vxworks_shared_plt0_entry): Likewise. + (mips_vxworks_shared_plt_entry): Likewise. + (mips_elf_link_hash_newfunc): Initialize the new hash_entry fields. + (mips_elf_rel_dyn_section): Change the bfd argument to a + mips_elf_link_hash_table. Use MIPS_ELF_REL_DYN_NAME to get + the name of the section. + (mips_elf_initialize_tls_slots): Update the call to + mips_elf_rel_dyn_section. + (mips_elf_gotplt_index): New function. + (mips_elf_local_got_index): Add an input_section argument. + Update the call to mips_elf_create_local_got_entry. + (mips_elf_got_page): Likewise. + (mips_elf_got16_entry): Likewise. + (mips_elf_create_local_got_entry): Add bfd_link_info and input_section + arguments. Create dynamic relocations for each entry on VxWorks. + (mips_elf_merge_gots): Update the use of MIPS_ELF_GOT_MAX_SIZE. + (mips_elf_multi_got): Update the uses of MIPS_ELF_GOT_MAX_SIZE + and MIPS_RESERVED_GOTNO. + (mips_elf_create_got_section): Update the uses of + MIPS_ELF_GOT_MAX_SIZE. Create .got.plt on VxWorks. + (is_gott_symbol): New function. + (mips_elf_calculate_relocation): Use a dynobj local variable. + Update the calls to mips_elf_local_got_index, mips_elf_got16_entry and + mips_elf_got_page_entry. Set G to the .got.plt entry when calculating + VxWorks R_MIPS_CALL* relocations. Calculate and use G for all GOT + relocations on VxWorks. Add dynamic relocations for references + to the VxWorks __GOTT_BASE__ and __GOTT_INDEX__ symbols. Don't + create dynamic relocations for R_MIPS_32, R_MIPS_REL32 or R_MIPS_64 + in VxWorks executables. + (mips_elf_allocate_dynamic_relocations): Add a bfd_link_info argument. + Use MIPS_ELF_RELA_SIZE to calculate the size of a VxWorks entry. + Don't allocate a null entry on VxWorks. + (mips_elf_create_dynamic_relocation): Update the call to + mips_elf_rel_dyn_section. Use absolute rather than relative + relocations for VxWorks, and make them RELA rather than REL. + (_bfd_mips_elf_create_dynamic_sections): Don't make .dynamic + read-only on VxWorks. Update the call to mips_elf_rel_dyn_section. + Create the .plt, .rela.plt, .dynbss and .rela.bss sections on + VxWorks. Likewise create the _PROCEDURE_LINKAGE_TABLE symbol. + Call elf_vxworks_create_dynamic_sections for VxWorks and + initialize the plt_header_size and plt_entry_size fields. + (_bfd_mips_elf_check_relocs): Don't allow GOT relocations to be + used in VxWorks executables. Don't allocate dynamic relocations + for R_MIPS_32, R_MIPS_REL32 or R_MIPS_64 in VxWorks executables. + Set is_relocation_target for each symbol referenced by a relocation. + Allocate .rela.dyn entries for relocations against the special + VxWorks __GOTT_BASE__ and __GOTT_INDEX__ symbols. Create GOT + entries for all VxWorks R_MIPS_GOT16 relocations. Don't allocate + a global GOT entry for symbols mentioned in VxWorks R_MIPS_CALL*, + R_MIPS_32, R_MIPS_REL32 or R_MIPS_64 relocations. Update the calls + to mips_elf_rel_dyn_section and mips_elf_allocate_dynamic_relocations. + Set is_branch_target for symbols mentioned in R_MIPS_PC16 or R_MIPS_26 + relocations. Don't set no_fn_stub on VxWorks. + (_bfd_mips_elf_adjust_dynamic_symbol): Update the call to + mips_elf_allocate_dynamic_relocations. + (_bfd_mips_vxworks_adjust_dynamic_symbol): New function. + (_bfd_mips_elf_always_size_sections): Do not allocate GOT page + entries for VxWorks, and do not create multiple GOTs. + (_bfd_mips_elf_size_dynamic_sections): Use MIPS_ELF_REL_DYN_NAME. + Handle .got specially for VxWorks. Update the uses of + MIPS_RESERVED_GOTNO and mips_elf_allocate_dynamic_relocations. + Check for sgotplt and splt. Allocate the .rel(a).dyn contents last, + once its final size is known. Set DF_TEXTREL for VxWorks. Add + DT_RELA, DT_RELASZ, DT_RELAENT, DT_PLTREL, DT_PLTRELSZ and DT_JMPREL + tags on VxWorks. Do not add the MIPS-specific tags for VxWorks. + (_bfd_mips_vxworks_finish_dynamic_symbol): New function. + (mips_vxworks_finish_exec_plt): Likewise. + (mips_vxworks_finish_shared_plt): Likewise. + (_bfd_mips_elf_finish_dynamic_sections): Remove an unncessary call + to mips_elf_rel_dyn_section. Use a VxWorks-specific value of + DT_PLTGOT. Handle DT_RELA, DT_RELASZ, DT_RELAENT, DT_PLTREL, + DT_PLTRELSZ and DT_JMPREL. Update the uses of MIPS_RESERVED_GOTNO + and mips_elf_rel_dyn_section. Use a different GOT header for + VxWorks. Don't sort .rela.dyn on VxWorks. Finish the PLT on VxWorks. + (_bfd_mips_elf_link_hash_table_create): Initialize the new + mips_elf_link_hash_table fields. + (_bfd_mips_vxworks_link_hash_table_create): New function. + (_bfd_mips_elf_final_link): Set the GP value to _GLOBAL_OFFSET_TABLE_ + on VxWorks. Update the call to ELF_MIPS_GP_OFFSET. + * elfxx-mips.h (_bfd_mips_vxworks_adjust_dynamic_symbol): Declare. + (_bfd_mips_vxworks_finish_dynamic_symbol): Likewise. + (_bfd_mips_vxworks_link_hash_table_create): Likewise. + * libbfd.h: Regenerate. + * Makefile.am (elfxx-mips.lo): Depend on elf-vxworks.h. + (elf32-mips.lo): Likewise. + * Makefile.in: Regenerate. + * reloc.c (BFD_RELOC_MIPS_COPY, BFD_RELOC_MIPS_JUMP_SLOT): Declare. + * targets.c (bfd_elf32_bigmips_vxworks_vec): Declare. + (bfd_elf32_littlemips_vxworks_vec): Likewise. + (_bfd_target_vector): Add entries for them. + +2006-03-19 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + * elf64-hppa.c (elf64_hppa_special_sections): Change flags for .tbss + section from SHF_PARISC_WEAKORDER to SHF_HP_TLS. + (elf_backend_special_sections): Remove #undef. + +2006-03-18 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + * elf64-hppa.c (allocate_global_data_opd): Don't create an OPD entry + for undefined weak symbols. + +2006-03-17 Daniel Jacobowitz <dan@codesourcery.com> + + PR ld/2462 + * elflink.c (bfd_elf_final_link): Remove + bed->elf_backend_emit_relocs from emit_relocs. + +2006-03-17 Alexandre Oliva <aoliva@redhat.com> + + * elf32-ppc.c (ppc_elf_relocate_section): Copy addend from + first relocation to the second when relaxing TLS GD to LE; + zero it out when relaxing to IE. + +2006-03-17 Alan Modra <amodra@bigpond.net.au> + + PR 2434 + * elflink.c (elf_link_add_object_symbols): Save and restore + warning sym's linked sym. + +2006-03-16 Alan Modra <amodra@bigpond.net.au> + + PR 2434 + * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. + (elf_link_add_object_symbols): Delete unnecessary locals. Rename + hash_table -> htab. Formatting. Save entire symbol table + before loading as-needed syms, and restore afterwards if lib not + needed. Use bfd_hash_allocate rather than bfd_alloc for sym + name. Free some buffers earlier. + * bfd-in.h (struct bfd_hash_table): Add entsize. + (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. + * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise + * hash.c (bfd_hash_table_init_n): Add entsize param, save to + hash table. + (bfd_hash_table_init): Add param, adjust calls. + * aoutx.h: Adjust all hash_table_init functions and calls. + * bfd.c: Likewise. + * coff-arm.c: Likewise. + * coff-h8300.c: Likewise. + * coff-ppc.c: Likewise. + * cofflink.c: Likewise. + * ecoff.c: Likewise. + * ecofflink.c: Likewise. + * elf-m10300.c: Likewise. + * elf-strtab.c: Likewise. + * elf.c: Likewise. + * elf32-arm.c: Likewise. + * elf32-bfin.c: Likewise. + * elf32-cris.c: Likewise. + * elf32-frv.c: Likewise. + * elf32-hppa.c: Likewise. + * elf32-i386.c: Likewise. + * elf32-m32r.c: Likewise. + * elf32-m68hc1x.c: Likewise. + * elf32-m68k.c: Likewise. + * elf32-ppc.c: Likewise. + * elf32-s390.c: Likewise. + * elf32-sh.c: Likewise. + * elf32-vax.c: Likewise. + * elf64-alpha.c: Likewise. + * elf64-hppa.c: Likewise. + * elf64-ppc.c: Likewise. + * elf64-s390.c: Likewise. + * elf64-sh64.c: Likewise. + * elf64-x86-64.c: Likewise. + * elfxx-ia64.c: Likewise. + * elfxx-mips.c: Likewise. + * elfxx-sparc.c: Likewise. + * i386linux.c: Likewise. + * libaout.h: Likewise. + * libbfd-in.h: Likewise. + * libcoff-in.h: Likewise. + * linker.c: Likewise. + * m68klinux.c: Likewise. + * merge.c: Likewise. + * opncls.c: Likewise. + * pdp11.c: Likewise. + * sparclinux.c: Likewise. + * stabs.c: Likewise. + * sunos.c: Likewise. + * vms.c: Likewise. + * xcofflink.c: Likewise. + * section.c (struct section_hash_entry): Move to.. + * libbfd-in.h: ..here. + * Makefile.am: Run "make dep-am" + * Makefile.in: Regenerate. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + * libcoff.h: Regenerate. + +2006-03-16 Alan Modra <amodra@bigpond.net.au> + + * elf32-ppc.c (ppc_elf_check_relocs): REL24 and REL14 relocs + against __GLOBAL_OFFSET_TABLE__ need never be dynamic. Tweak + last change to REL32 relocs so that they are counted as + possibly dynamic as per REL24 and REL14. + +2006-03-16 Alan Modra <amodra@bigpond.net.au> + + * elf32-ppc.c (ppc_elf_check_relocs): Don't fall into REL24 + checks from REL32. + +2006-03-15 Ben Elliston <bje@au.ibm.com> + + * elf32-arm.c (elf32_arm_merge_eabi_attributes): Iterate over all + in_list elements, not just the first. + +2006-03-14 Richard Sandiford <richard@codesourcery.com> + + * elf32-mips.c (mips_elf_adjust_addend): New function, mostly split + out from... + (_bfd_mips_elf_relocate_section): ...here. Use it to adjust r_addend + for final links too. + +2006-03-13 Richard Sandiford <richard@codesourcery.com> + + * elfxx-mips.c (mips_elf_create_got_section): Initialize hgot. + +2006-03-11 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/2443 + * dwarf2.c (concat_filename): Don't issue an error if file is 0. + +2006-03-10 Paul Brook <paul@codesourcery.com> + + * elf32-arm.c (INTERWORK_FLAG): Handle EABIv5. + (elf32_arm_print_private_bfd_data): Ditto. + +2006-03-09 Paul Brook <paul@codesourcery.com> + + * cpu-arm.c (bfd_is_arm_mapping_symbol_name): Recognise additional + mapping symbols. + +2006-03-09 Khem Raj <khem@mvista.com> + + * elf32-arm.c(elf32_arm_finish_dynamic_sections): Use unsigned + char type. + +2006-03-08 H.J. Lu <hongjiu.lu@intel.com> + + * elfxx-ia64.c (elfNN_ia64_choose_gp): Properly choose gp. + +2006-03-07 Richard Sandiford <richard@codesourcery.com> + Daniel Jacobowitz <dan@codesourcery.com> + Zack Weinberg <zack@codesourcery.com> + Nathan Sidwell <nathan@codesourcery.com> + Paul Brook <paul@codesourcery.com> + Ricardo Anguiano <anguiano@codesourcery.com> + Phil Edwards <phil@codesourcery.com> + + * configure.in (bfd_elf32_bigarm_vec): Include elf-vxworks.lo. + (bfd_elf32_bigarm_symbian_vec): Likewise. + (bfd_elf32_bigarm_vxworks_vec): Likewise. + (bfd_elf32_littlearm_vec): Likewise. + (bfd_elf32_littlearm_symbian_vec): Likewise. + (bfd_elf32_littlearm_vxworks_vec): Likewise. + * configure: Regenerate. + * elf32-arm.c: Include libiberty.h and elf-vxworks.h. + (RELOC_SECTION, RELOC_SIZE, SWAP_RELOC_IN, SWAP_RELOC_OUT): New macros. + (elf32_arm_vxworks_bed): Add forward declaration. + (elf32_arm_howto_table_1): Fix the masks for R_ASM_ABS12. + (elf32_arm_vxworks_exec_plt0_entry): New table. + (elf32_arm_vxworks_exec_plt_entry): Likewise. + (elf32_arm_vxworks_shared_plt_entry): Likewise. + (elf32_arm_link_hash_table): Add vxworks_p and srelplt2 fields. + (reloc_section_p): New function. + (create_got_section): Use RELOC_SECTION. + (elf32_arm_create_dynamic_sections): Likewise. Call + elf_vxworks_create_dynamic_sections for VxWorks targets. + Choose between the two possible values of plt_header_size + and plt_entry_size. + (elf32_arm_link_hash_table_create): Initialize vxworks_p and srelplt2. + (elf32_arm_abs12_reloc): New function. + (elf32_arm_final_link_relocate): Call it. Allow the creation of + dynamic R_ARM_ABS12 relocs on VxWorks. Use reloc_section_p, + RELOC_SIZE, SWAP_RELOC_OUT and RELOC_SECTION. Initialize the + r_addend fields of relocs. On rela targets, skip any code that + adjusts in-place addends. When using _bfd_link_final_relocate + to perform a final relocation, pass rel->r_addend as the addend + argument. + (elf32_arm_merge_private_bfd_data): If one of the bfds is a VxWorks + object, ignore flags that are not standard on VxWorks. + (elf32_arm_check_relocs): Allow the creation of dynamic R_ARM_ABS12 + relocs on VxWorks. Use reloc_section_p. + (elf32_arm_adjust_dynamic_symbol): Use RELOC_SECTION and RELOC_SIZE. + (allocate_dynrelocs): Use RELOC_SIZE. Account for the size of + .rela.plt.unloaded relocs on VxWorks targets. + (elf32_arm_size_dynamic_sections): Use RELOC_SIZE. Check for + .rela.plt.unloaded as well as .rel(a).plt. Add DT_RELA* tags + instead of DT_REL* tags on RELA targets. + (elf32_arm_finish_dynamic_symbol): Use RELOC_SECTION, RELOC_SIZE + and SWAP_RELOC_OUT. Initialize r_addend fields. Handle VxWorks + PLT entries. Do not make _GLOBAL_OFFSET_TABLE_ absolute on VxWorks. + (elf32_arm_finish_dynamic_sections): Use RELOC_SECTION, RELOC_SIZE + and SWAP_RELOC_OUT. Initialize r_addend fields. Handle DT_RELASZ + like DT_RELSZ. Handle the VxWorks form of initial PLT entry. + Correct the .rela.plt.unreloaded symbol indexes. + (elf32_arm_output_symbol_hook): Call the VxWorks version of this + hook on VxWorks targets. + (elf32_arm_vxworks_link_hash_table_create): Set vxworks_p to true. + Minor formatting tweak. + (elf32_arm_vxworks_final_write_processing): New function. + (elf_backend_add_symbol_hook): Override for VxWorks and reset + for Symbian. + (elf_backend_final_write_processing): Likewise. + (elf_backend_emit_relocs): Likewise. + (elf_backend_want_plt_sym): Likewise. + (ELF_MAXPAGESIZE): Likewise. + (elf_backend_may_use_rel_p): Minor formatting tweak. + (elf_backend_may_use_rela_p): Likewise. + (elf_backend_default_use_rela_p): Likewise. + (elf_backend_rela_normal): Likewise. + * Makefile.in (elf32-arm.lo): Depend on elf-vxworks.h. + +2006-03-06 Nathan Sidwell <nathan@codesourcery.com> + + * archures.c (bfd_mach_mcf_isa_a_nodiv, bfd_mach_mcf_isa_b_nousp): + New. Adjust other variants. + (bfd_default_scan): Update. + * bfd-in2.h: Rebuilt. + * cpu-m68k.c: Adjust. + (bfd_m68k_compatible): New. Use it for architectures. + * elf32-m68k.c (elf32_m68k_object_p): Adjust. + (elf32_m68k_merge_private_bfd_data): Adjust. Correct isa-a/b + mismatch. + (elf32_m68k_print_private_bfd_data): Adjust. + * ieee.c (ieee_write_processor): Adjust. + +2006-03-06 Alan Modra <amodra@bigpond.net.au> + + * dwarf2.c: Formatting. + (add_line_info): Remove outer loop. + +2006-03-05 H.J. Lu <hongjiu.lu@intel.com> + Alan Modra <amodra@bigpond.net.au> + + PR binutils/2338 + * dwarf2.c (loadable_section): New struct. + (dwarf2_debug): Add loadable_section_count and + loadable_sections. + (new_line_sorts_after): New. + (add_line_info): Use new_line_sorts_after to compare line + addresses. + (check_function_name): Removed. + (unset_sections): New. + (place_sections): New. + (_bfd_dwarf2_find_nearest_line): Updated. Call place_sections + and unset_sections on relocatable files. + (_bfd_dwarf2_find_line): Likewise. + +2006-03-03 Nick Clifton <nickc@redhat.com> + + * cpu-avr.c: Update to ISO-C90 formatting. + * elf32-avr.c: Likewise. + +2006-03-03 Bjoern Haase <bjoern.m.haase@web.de> + + * elf32-avr.c (avr_reloc_map): Insert BFD_RELOC_AVR_MS8_LDI + and R_AVR_MS8_LDI + (bfd_elf_avr_final_write_processing): Set + EF_AVR_LINKRELAX_PREPARED in e_flags field. + (elf32_avr_relax_section): New function. + (elf32_avr_relax_delete_bytes): New function. + (elf32_avr_get_relocated_section_contents): New function. + (avr_pc_wrap_around): New function. + (avr_relative_distance_considering_wrap_around): New function. + (avr_final_link_relocate): Handle negative int8t_t immediate for R_AVR_LDI. + * reloc.c: Add BFD_RELOC_AVR_MS8_LDI and BFD_RELOC_AVR_LDI_NEG + * libbfd.h: Regenerate. + * bfd-in2.h: Regenerate. + +2006-03-02 DJ Delorie <dj@redhat.com> + + * elf32-m32c.c (m32c_offset_for_reloc): Fix local symbol + calculations. + +2006-03-02 Richard Sandiford <richard@codesourcery.com> + + * elf32-ppc.c (is_ppc_elf_target): Return true if the target is + bfd_elf32_powerpc_vxworks_vec. + +2006-03-02 Nick Clifton <nickc@redhat.com> + + * elf32-m32c.c (m32c_elf_relax_section): Initialise 'gap'. + +2006-03-02 Richard Sandiford <richard@codesourcery.com> + + * elf32-i386.c (elf_i386_create_dynamic_sections): Use + elf_vxworks_create_dynamic_sections. + (elf_i386_size_dynamic_sections): Remove VxWorks GOT and PLT + symbol handling. + * elf32-ppc.c (ppc_elf_create_dynamic_sections): Use + elf_vxworks_create_dynamic_sections. + (ppc_elf_size_dynamic_sections): Remove VxWorks GOT and PLT + symbol handling. + * elf-vxworks.c (elf_vxworks_create_dynamic_sections): New function. + * elf-vxworks.h (elf_vxworks_create_dynamic_sections): Declare. + +2006-03-02 Richard Sandiford <richard@codesourcery.com> + + * elf32-i386.c (elf_i386_vxworks_link_output_symbol_hook): Delete. + (elf_backend_link_output_symbol_hook): Use + elf_vxworks_link_output_symbol_hook instead. + * elf32-ppc.c (elf_i386_vxworks_link_output_symbol_hook): Delete. + (elf_backend_link_output_symbol_hook): Use + elf_vxworks_link_output_symbol_hook instead. + * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Provide the + same interface as elf_backend_link_output_symbol_hook. + * elf-vxworks.h (elf_vxworks_link_output_symbol_hook): Update + prototype accordingly. + +2006-03-02 Richard Sandiford <richard@codesourcery.com> + + * elf32-ppc.c (ppc_elf_plt_type): New enumeration. + (ppc_elf_link_hash_table): Replace old_got and new_got with + plt_type and can_use_new_plt. + (ppc_elf_create_dynamic_sections): Add SEC_HAS_CONTENTS, + SEC_LOAD and SEC_READONLY to the VxWorks .plt flags. + (ppc_elf_check_relocs): Set can_use_new_plt instead of new_plt. + Move from plt_type == PLT_UNSET to PLT_OLD instead of setting old_plt. + (ppc_elf_select_plt_layout): Move from plt_type == PLT_UNSET to + either plt_type == PLT_OLD or plt_type == PLT_NEW. Assert that + this function should not be called for VxWorks targets. + (ppc_elf_tls_setup): Use plt_type instead of old_got. + (allocate_got): Likewise. Rearrange so that max_before_header + is only used for PLT_OLD and PLT_NEW. + (allocate_dynrelocs): Use plt_type instead of old_got and is_vxworks. + (ppc_elf_size_dynamic_sections): Likewise. + (ppc_elf_relax_section): Likewise. + (ppc_elf_relocate_section): Likewise. + (ppc_elf_finish_dynamic_symbol): Likewise. + (ppc_elf_vxworks_link_hash_table_create): Initialize plt_type. + +2006-02-28 Richard Sandiford <richard@codesourcery.com> + + * elf32-i386.c (elf_i386_link_hash_table): Add next_tls_desc_index. + (elf_i386_link_hash_table_create): Initialize it. + (elf_i386_compute_jump_table_size): Use it instead of + srelplt->reloc_count. + (allocate_dynrelocs): Likewise. + (elf_i386_size_dynamic_sections): Likewise. + (elf_i386_relocate_section): Likewise. + +2006-02-27 Jakub Jelinek <jakub@redhat.com> + + * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Handle S flag. + (_bfd_elf_write_section_eh_frame): Likewise. + +2006-02-27 Carlos O'Donell <carlos@codesourcery.com> + + * po/Make-in: Add html target. + +2006-02-27 Richard Sandiford <richard@codesourcery.com> + + * elf-m10300.c (_bfd_mn10300_elf_finish_dynamic_symbol): Use the + cached hgot entry to check for _GLOBAL_OFFSET_TABLE_. + * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Likewise. + * elf32-bfin.c (bfin_finish_dynamic_symbol): Likewise. + * elf32-cris.c (elf_cris_finish_dynamic_symbol): Likewise. + * elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Likewise. + * elf32-i386.c (elf_i386_finish_dynamic_symbol): Likewise. + * elf32-m32r.c (m32r_elf_finish_dynamic_symbol): Likewise. + * elf32-m68k.c (elf_m68k_finish_dynamic_symbol): Likewise. + * elf32-sh.c (sh_elf_finish_dynamic_symbol): Likewise. + * elf32-vax.c (elf_vax_finish_dynamic_symbol): Likewise. + * elf32-xtensa.c (elf_xtensa_finish_dynamic_symbol): Likewise. + * elf64-sh64.c (sh64_elf64_finish_dynamic_symbol): Likewise. + * elf64-x86-64.c (elf64_x86_64_finish_dynamic_symbol): Likewise. + * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Likewise. + * elf32-s390.c (elf_s390_finish_dynamic_symbol): Likewise. Also use + the cached hplt entry to check for _PROCEDURE_LINKAGE_TABLE_. + * elf64-alpha.c (elf64_alpha_finish_dynamic_symbol): Likewise. + * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise. + * elfxx-ia64.c (elfNN_ia64_finish_dynamic_symbol): Likewise. + * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Likewise. + +2006-02-25 Richard Sandiford <richard@codesourcery.com> + + * elf-bfd.h (elf_link_hash_table): Add hplt field. + * elflink.c (_bfd_elf_create_dynamic_sections): Initialize it. + * elf-m10300.c (_bfd_mn10300_elf_create_got_section): Likewise. + * elf32-frv.c (_frv_create_got_section): Likewise. + * elf32-m32r.c (m32r_elf_create_dynamic_sections): Likewise. + * elf32-sh.c (sh_elf_create_dynamic_sections): Likewise. + * elf64-alpha.c (elf64_alpha_create_dynamic_sections): Likewise. + * elf64-sh64.c (sh64_elf64_create_dynamic_sections): Likewise. + * elf32-i386.c (elf_i386_link_hash_table): Remove hgot and hplt. + (elf_i386_link_hash_table_create): Don't initialize them. + (elf_i386_size_dynamic_sections): Use the generic ELF hplt and + hgot fields. + (elf_i386_finish_dynamic_symbol): Likewise. + * elf32-ppc.c (ppc_elf_link_hash_table): Remove hplt. + (ppc_elf_size_dynamic_sections): Use the generic ELF hplt fields. + (ppc_elf_finish_dynamic_symbol): Likewise. + +2006-02-24 DJ Delorie <dj@redhat.com> + + * elf32-m32c.c (m32c_elf_howto_table): Add relaxation relocs. + (m32c_elf_relocate_section): Don't relocate them. + (compare_reloc): New. + (relax_reloc): Remove. + (m32c_offset_for_reloc): New. + (m16c_addr_encodings): New. + (m16c_jmpaddr_encodings): New. + (m32c_addr_encodings): New. + (m32c_elf_relax_section): Relax jumps and address displacements. + (m32c_elf_relax_delete_bytes): Adjust for internal syms. Fix up + short jumps. + + * reloc.c: Add m32c relax relocs. + * libbfd.h: Regenerate. + * bfd-in2.h: Regenerate. + +2006-02-24 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/2218 + * elf-bfd.h (elf_backend_data): Add elf_backend_fixup_symbol. + (_bfd_elf_link_hash_fixup_symbol): New. + + * elflink.c (_bfd_elf_link_hash_fixup_symbol): New. + (_bfd_elf_fix_symbol_flags): Call elf_backend_fixup_symbol if + it isn't NULL. + + * elfxx-ia64.c (elf_backend_fixup_symbol): Defined. + + * elfxx-target.h (elf_backend_fixup_symbol): New. + (elfNN_bed): Initialize elf_backend_fixup_symbol. + +2006-02-23 H.J. Lu <hongjiu.lu@intel.com> + + * cpu-ia64-opc.c (ins_immu5b): New. + (ext_immu5b): Likewise. + (elf64_ia64_operands): Add IMMU5b. + +2006-02-21 Alan Modra <amodra@bigpond.net.au> + + PR ld/2218 + * elf32-arm.c (allocate_dynrelocs): Ensure undef weak sym in pie + is dynamic. + * elf32-hppa.c (allocate_dynrelocs): Likewise. + * elf32-i386.c (allocate_dynrelocs): Likewise. + * elf32-s390.c (allocate_dynrelocs): Likewise. + * elf32-sh.c (allocate_dynrelocs): Likewise. + * elf64-s390.c (allocate_dynrelocs): Likewise. + * elf64-x86-64.c (allocate_dynrelocs): Likewise. + * elf32-m32r.c (allocate_dynrelocs): Likewise. Discard relocs + on undef weak with non-default visibility too. + * elfxx-sparc.c (allocate_dynrelocs): Ditto. + +2006-02-21 Alan Modra <amodra@bigpond.net.au> + + * bfd.c: (_bfd_default_error_handler): Don't call abort on + error, instead call _exit. + (_bfd_abort): Call _exit not xexit. + +2006-02-17 Kevin Buettner <kevinb@redhat.com> + + * elf32-frv.c (elf32_frv_grok_prstatus, elf32_frv_grok_psinfo): + New functions. + * elf_backend_grok_prstatus, elf_backend_grok_psinfo): Define. + +2006-02-17 Shrirang Khisti <shrirangk@kpitcummins.com> + Anil Paranjape <anilp1@kpitcummins.com> + Shilin Shakti <shilins@kpitcummins.com> + + * Makefile.am: Add xc16x related entry + * Makefile.in: Regenerate + * archures.c: Add bfd_xc16x_arch + * bfd-in2.h: Regenerate + * config.bfd: Add xc16x-*-elf + * configure.in: Add bfd_elf32_xc16x_vec + * configure: Regenerate. + * targets.c: Added xc16x related information + * cpu-xc16x.c: New file + * reloc.c: Add new relocations specific to xc16x: + BFD_RELOC_XC16X_PAG, BFD_RELOC_XC16X_POF, BFD_RELOC_XC16X_SEG, + BFD_RELOC_XC16X_SOF + * elf32-xc16x.c: New file. + +2006-02-17 Alan Modra <amodra@bigpond.net.au> + + * elf32-ppc.c (allocate_dynrelocs): Tweak undef weak handling. + * elf64-ppc.c (allocate_dynrelocs): Likewise. + +2006-02-17 Alan Modra <amodra@bigpond.net.au> + + PR ld/2218 + * elf64-ppc.c (allocate_dynrelocs): Ensure undef weak sym is + dynamic. + (ppc64_elf_relocate_section): Check output reloc section size. + * elf32-ppc.c (allocate_dynrelocs): Simplify undef weak test. + +2006-02-16 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/2322 + * elf.c (get_segment_type): New function. + (_bfd_elf_print_private_bfd_data): Use it. + (print_segment_map): New function. + (assign_file_positions_for_segments): Call print_segment_map + when there are not enough room for program headers. + +2006-02-16 Nick Hudson <nick.hudson@dsl.pipex.com> + + * config.bfd (mips*el-*-netbsd*, mips*-*-netbsd*): Use + traditional MIPS ELF targets. + +2006-02-15 H.J. Lu <hongjiu.lu@intel.com> + + PR binutils/2338 + * dwarf2.c (check_function_name): New function. + (_bfd_dwarf2_find_nearest_line): Use check_function_name to + check if function is correct. + +2006-02-16 Alan Modra <amodra@bigpond.net.au> + + * elflink.c (_bfd_elf_default_action_discarded): Return 0 for + debug sections. + (elf_link_input_bfd): Adjust comments. + +2006-02-10 H.J. Lu <hongjiu.lu@intel.com> + + * elf.c (copy_private_bfd_data): Minor update. + +2006-02-10 H.J. Lu <hongjiu.lu@intel.com> + + PR binutils/2258 + * elf.c (copy_private_bfd_data): Renamed to ... + (rewrite_elf_program_header): This. + (copy_elf_program_header): New function. + (copy_private_bfd_data): Likewise. + +2006-02-07 Nathan Sidwell <nathan@codesourcery.com> + + * archures.c (bfd_mach_mcf5200, bfd_mach_mcf5206e, + bfd_mach_mcf5307, bfd_mach_mcf5407, bfd_mach_mcf528x, + bfd_mach_mcfv4e, bfd_mach_mcf521x, bfd_mach_mcf5249, + bfd_mach_mcf547x, bfd_mach_mcf548x): Remove. + (bfd_mach_mcf_isa_a, bfd_mach_mcf_isa_a_div, + bfd_mach_mcf_isa_a_div_mac, bfd_mach_mcf_isa_a_div_emac, + bfd_mach_mcf_isa_aplus, bfd_mach_mcf_isa_aplus_mac, + bfd_mach_mcf_isa_aplus_emac, bfd_mach_mcf_isa_aplus_usp, + bfd_mach_mcf_isa_aplus_usp_mac, bfd_mach_mcf_isa_aplus_usp_emac, + bfd_mach_mcf_isa_b, bfd_mach_mcf_isa_b_mac, bfd_mach_mcf_isa_b_emac, + bfd_mach_mcf_isa_b_usp_float, bfd_mach_mcf_isa_b_usp_float_mac, + bfd_mach_mcf_isa_b_usp_float_emac): New. + (bfd_default_scan): Update coldfire mapping. + * bfd-in.h (bfd_m68k_mach_to_features, + bfd_m68k_features_to_mach): Declare. + * bfd-in2.h: Rebuilt. + * cpu-m68k.c (arch_info_struct): Add new coldfire machines, + adjust legacy names. + (m68k_arch_features): New. + (bfd_m68k_mach_to_features, + bfd_m68k_features_to_mach): Define. + * elf32-m68k.c (elf32_m68k_object_p): New. + (elf32_m68k_merge_private_bfd_data): Merge the CF EF flags. + (elf32_m68k_print_private_bfd_data): Print the CF EF flags. + (elf_backend_object_p): Define. + * ieee.c (ieee_write_processor): Update coldfire machines. + * libbfd.h: Rebuilt. + +2006-02-06 Steve Ellcey <sje@cup.hp.com> + + * elfxx-ia64.c (elfNN_ia64_fake_sections): Set SHF_IA_64_HP_TLS + if SHF_TLS is set. + +2006-02-05 Arnold Metselaar <arnold.metselaar@planet.nl> + + * coff-z80.c (r_imm24): New howto. + (rtype2howto): New case R_IMM24. + (coff_z80_reloc_type_lookup): New case BFD_RELOC_24. + (extra_case): Use bfd_get_8 for R_IMM8, new case R_IMM24. + +2006-02-04 Richard Sandiford <richard@codesourcery.com> + + * elfxx-mips.c (mips_elf_initialize_tls_index): If a TLS symbol + has already been assigned a GOT index, copy that index to the + current hash table entry. + +2006-02-01 Eric Botcazou <ebotcazou@libertysurf.fr> + + * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Reinstate bypass + for call-to-undefweak reloc overflow. + +2006-01-31 Eric Botcazou <ebotcazou@libertysurf.fr> + + * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Reinstate bypass + for 32-bit relocs overflow. + +2006-01-27 Paul Brook <paul@codesourcery.com> + + * elf32-arm.c (elf32_arm_get_symbol_type): Allow STT_TLS thumb + objects. + +2006-01-18 Alexandre Oliva <aoliva@redhat.com> + + Introduce TLS descriptors for i386 and x86_64. + * reloc.c (BFD_RELOC_386_TLS_GOTDESC, BFD_RELOC_386_TLS_DESC, + BFD_RELOC_386_TLS_DESC_CALL, BFD_RELOC_X86_64_GOTPC32_TLSDESC, + BFD_RELOC_X86_64_TLSDESC, BFD_RELOC_X86_64_TLSDESC_CALL): New. + * libbfd.h, bfd-in2.h: Rebuilt. + * elf32-i386.c (elf_howto_table): New relocations. + (R_386_tls): Adjust. + (elf_i386_reloc_type_lookup): Map new relocations. + (GOT_TLS_GDESC, GOT_TLS_GD_BOTH_P): New macros. + (GOT_TLS_GD_P, GOT_TLS_GDESC_P, GOT_TLS_GD_ANY_P): New macros. + (struct elf_i386_link_hash_entry): Add tlsdesc_got field. + (struct elf_i386_obj_tdata): Add local_tlsdesc_gotent field. + (elf_i386_local_tlsdesc_gotent): New macro. + (struct elf_i386_link_hash_table): Add sgotplt_jump_table_size. + (elf_i386_compute_jump_table_size): New macro. + (link_hash_newfunc): Initialize tlsdesc_got. + (elf_i386_link_hash_table_create): Set sgotplt_jump_table_size. + (elf_i386_tls_transition): Handle R_386_TLS_GOTDESC and + R_386_TLS_DESC_CALL. + (elf_i386_check_relocs): Likewise. Allocate space for + local_tlsdesc_gotent. + (elf_i386_gc_sweep_hook): Handle R_386_TLS_GOTDESC and + R_386_TLS_DESC_CALL. + (allocate_dynrelocs): Count function PLT relocations. Reserve + space for TLS descriptors and relocations. + (elf_i386_size_dynamic_sections): Reserve space for TLS + descriptors and relocations. Set up sgotplt_jump_table_size. + Don't zero reloc_count in srelplt. + (elf_i386_always_size_sections): New. Set up _TLS_MODULE_BASE_. + (elf_i386_relocate_section): Handle R_386_TLS_GOTDESC and + R_386_TLS_DESC_CALL. + (elf_i386_finish_dynamic_symbol): Use GOT_TLS_GD_ANY_P. + (elf_backend_always_size_sections): Define. + * elf64-x86-64.c (x86_64_elf_howto): Add R_X86_64_GOTPC32_TLSDESC, + R_X86_64_TLSDESC, R_X86_64_TLSDESC_CALL. + (R_X86_64_standard): Adjust. + (x86_64_reloc_map): Map new relocs. + (elf64_x86_64_rtype_to_howto): New, split out of... + (elf64_x86_64_info_to_howto): ... this function, and... + (elf64_x86_64_reloc_type_lookup): ... use it to map elf_reloc_val. + (GOT_TLS_GDESC, GOT_TLS_GD_BOTH_P): New macros. + (GOT_TLS_GD_P, GOT_TLS_GDESC_P, GOT_TLS_GD_ANY_P): New macros. + (struct elf64_x86_64_link_hash_entry): Add tlsdesc_got field. + (struct elf64_x86_64_obj_tdata): Add local_tlsdesc_gotent field. + (elf64_x86_64_local_tlsdesc_gotent): New macro. + (struct elf64_x86_64_link_hash_table): Add tlsdesc_plt, + tlsdesc_got and sgotplt_jump_table_size fields. + (elf64_x86_64_compute_jump_table_size): New macro. + (link_hash_newfunc): Initialize tlsdesc_got. + (elf64_x86_64_link_hash_table_create): Initialize new fields. + (elf64_x86_64_tls_transition): Handle R_X86_64_GOTPC32_TLSDESC and + R_X86_64_TLSDESC_CALL. + (elf64_x86_64_check_relocs): Likewise. Allocate space for + local_tlsdesc_gotent. + (elf64_x86_64_gc_sweep_hook): Handle R_X86_64_GOTPC32_TLSDESC and + R_X86_64_TLSDESC_CALL. + (allocate_dynrelocs): Count function PLT relocations. Reserve + space for TLS descriptors and relocations. + (elf64_x86_64_size_dynamic_sections): Reserve space for TLS + descriptors and relocations. Set up sgotplt_jump_table_size, + tlsdesc_plt and tlsdesc_got. Make room for them. Don't zero + reloc_count in srelplt. Add dynamic entries for DT_TLSDESC_PLT + and DT_TLSDESC_GOT. + (elf64_x86_64_always_size_sections): New. Set up + _TLS_MODULE_BASE_. + (elf64_x86_64_relocate_section): Handle R_386_TLS_GOTDESC and + R_386_TLS_DESC_CALL. + (elf64_x86_64_finish_dynamic_symbol): Use GOT_TLS_GD_ANY_P. + (elf64_x86_64_finish_dynamic_sections): Set DT_TLSDESC_PLT and + DT_TLSDESC_GOT. Set up TLS descriptor lazy resolver PLT entry. + (elf_backend_always_size_sections): Define. + +2006-01-17 H.J. Lu <hongjiu.lu@intel.com> + + PR binutils/2096 + * dwarf2.c (comp_unit_contains_address): Update comment. + (_bfd_dwarf2_find_nearest_line): Use section's vma, instead of + lma. Return TRUE only if both comp_unit_contains_address and + comp_unit_find_nearest_line return TRUE. + (_bfd_dwarf2_find_line): Use section's vma, instead of lma. + +2006-01-18 Alan Modra <amodra@bigpond.net.au> + + * elf-bfd.h (struct elf_backend_data): Add gc_mark_dynamic_ref. + (bfd_elf_gc_mark_dynamic_ref_symbol): Declare. + * elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Rename from + elf_gc_mark_dynamic_ref_symbol. Make global. + (bfd_elf_gc_sections): Call bed->gc_mark_dynamic_ref. + * elfxx-target.h (elf_backend_gc_mark_dynamic_ref): Define. + (elfNN_bed): Init new field. + * elf64-ppc.c (elf_backend_gc_mark_dynamic_ref): Define. + (ppc64_elf_gc_mark_dynamic_ref): New function. + +2006-01-17 Alan Modra <amodra@bigpond.net.au> + + * elf64-ppc.c (ppc64_elf_gc_mark_hook): Don't hang forever in loop. + +2006-01-17 Nick Clifton <nickc@redhat.com> + + PR binutils/2159 + * elf.c (elfcore_write_pstatus): Add ATTRIBUTE_UNUSED to unused + parameters. + +2006-01-11 Nick Clifton <nickc@redhat.com> + + * elf32-arm.c (elf32_arm_output_symbol_hook): Install new entry + into the newly (re)allocated map array. + +2006-01-09 Alexis Wilke <alexis_wilke@yahoo.com> + + * peXXigen.c (tbl): Add comma after "HIGH3ADJ". + +2006-01-01 Jakub Jelinek <jakub@redhat.com> + + * elf64-ppc.c (ppc64_elf_action_discarded): Return 0 + for .toc1 section. + +For older changes see ChangeLog-2005 + +Local Variables: +mode: change-log +left-margin: 8 +fill-column: 74 +version-control: never +End: diff --git a/contrib/binutils/bfd/Makefile.am b/contrib/binutils/bfd/Makefile.am index 77278a832a16..48919af759b6 100644 --- a/contrib/binutils/bfd/Makefile.am +++ b/contrib/binutils/bfd/Makefile.am @@ -1,6 +1,7 @@ ## Process this file with automake to generate Makefile.in AUTOMAKE_OPTIONS = 1.9 cygnus +ACLOCAL_AMFLAGS = -I . -I .. -I ../config # Uncomment the following line when doing a release. # RELEASE=y @@ -63,6 +64,7 @@ ALL_MACHINES = \ cpu-arm.lo \ cpu-avr.lo \ cpu-bfin.lo \ + cpu-cr16.lo \ cpu-cr16c.lo \ cpu-cris.lo \ cpu-crx.lo \ @@ -91,6 +93,7 @@ ALL_MACHINES = \ cpu-m10300.lo \ cpu-maxq.lo \ cpu-mcore.lo \ + cpu-mep.lo \ cpu-mips.lo \ cpu-mmix.lo \ cpu-mt.lo \ @@ -103,8 +106,10 @@ ALL_MACHINES = \ cpu-powerpc.lo \ cpu-rs6000.lo \ cpu-s390.lo \ + cpu-score.lo \ cpu-sh.lo \ cpu-sparc.lo \ + cpu-spu.lo \ cpu-tic30.lo \ cpu-tic4x.lo \ cpu-tic54x.lo \ @@ -125,6 +130,7 @@ ALL_MACHINES_CFILES = \ cpu-arm.c \ cpu-avr.c \ cpu-bfin.c \ + cpu-cr16.c \ cpu-cris.c \ cpu-cr16c.c \ cpu-crx.c \ @@ -153,6 +159,7 @@ ALL_MACHINES_CFILES = \ cpu-m10300.c \ cpu-maxq.c \ cpu-mcore.c \ + cpu-mep.c \ cpu-mips.c \ cpu-mmix.c \ cpu-mt.c \ @@ -165,8 +172,10 @@ ALL_MACHINES_CFILES = \ cpu-powerpc.c \ cpu-rs6000.c \ cpu-s390.c \ + cpu-score.c \ cpu-sh.c \ cpu-sparc.c \ + cpu-spu.c \ cpu-tic30.c \ cpu-tic4x.c \ cpu-tic54x.c \ @@ -235,6 +244,7 @@ BFD32_BACKENDS = \ elf32-arm.lo \ elf32-avr.lo \ elf32-bfin.lo \ + elf32-cr16.lo \ elf32-cr16c.lo \ elf32-cris.lo \ elf32-crx.lo \ @@ -262,6 +272,7 @@ BFD32_BACKENDS = \ elf-m10200.lo \ elf-m10300.lo \ elf32-mcore.lo \ + elf32-mep.lo \ elfxx-mips.lo \ elf32-mips.lo \ elf32-mt.lo \ @@ -271,12 +282,14 @@ BFD32_BACKENDS = \ elf32-pj.lo \ elf32-ppc.lo \ elf32-s390.lo \ + elf32-score.lo \ elf32-sh.lo \ elf32-sh-symbian.lo \ elf32-sh64.lo \ elf32-sh64-com.lo \ elfxx-sparc.lo \ elf32-sparc.lo \ + elf32-spu.lo \ elf32-v850.lo \ elf32-vax.lo \ elf32-xstormy16.lo \ @@ -284,6 +297,7 @@ BFD32_BACKENDS = \ elf32-xc16x.lo \ elf32.lo \ elflink.lo \ + elf-attrs.lo \ elf-strtab.lo \ elf-eh-frame.lo \ elf-vxworks.lo \ @@ -323,6 +337,8 @@ BFD32_BACKENDS = \ pef.lo \ pe-arm.lo \ pei-arm.lo \ + pe-arm-wince.lo \ + pei-arm-wince.lo \ pe-i386.lo \ pei-i386.lo \ pe-mcore.lo \ @@ -407,6 +423,7 @@ BFD32_BACKENDS_CFILES = \ elf32-arm.c \ elf32-avr.c \ elf32-bfin.c \ + elf32-cr16.c \ elf32-cr16c.c \ elf32-cris.c \ elf32-crx.c \ @@ -434,6 +451,7 @@ BFD32_BACKENDS_CFILES = \ elf-m10200.c \ elf-m10300.c \ elf32-mcore.c \ + elf32-mep.c \ elfxx-mips.c \ elf32-mips.c \ elf32-mt.c \ @@ -445,10 +463,12 @@ BFD32_BACKENDS_CFILES = \ elf32-sh64.c \ elf32-sh64-com.c \ elf32-s390.c \ + elf32-score.c \ elf32-sh.c \ elf32-sh-symbian.c \ elfxx-sparc.c \ elf32-sparc.c \ + elf32-spu.c \ elf32-v850.c \ elf32-vax.c \ elf32-xstormy16.c \ @@ -456,6 +476,7 @@ BFD32_BACKENDS_CFILES = \ elf32-xc16x.c \ elf32.c \ elflink.c \ + elf-attrs.c \ elf-strtab.c \ elf-eh-frame.c \ elf-vxworks.c \ @@ -495,6 +516,8 @@ BFD32_BACKENDS_CFILES = \ pef.c \ pe-arm.c \ pei-arm.c \ + pe-arm-wince.c \ + pei-arm-wince.c \ pe-i386.c \ pei-i386.c \ pe-mcore.c \ @@ -538,6 +561,7 @@ BFD64_BACKENDS = \ coff64-rs6000.lo \ demo64.lo \ efi-app-ia64.lo \ + efi-app-x86_64.lo \ elf64-x86-64.lo \ elf64-alpha.lo \ elf64-hppa.lo \ @@ -555,7 +579,11 @@ BFD64_BACKENDS = \ mmo.lo \ nlm32-alpha.lo \ nlm64.lo \ - pepigen.lo + coff-x86_64.lo \ + pe-x86_64.lo \ + pei-x86_64.lo \ + pepigen.lo \ + pex64igen.lo BFD64_BACKENDS_CFILES = \ aix5ppc-core.c \ @@ -564,6 +592,7 @@ BFD64_BACKENDS_CFILES = \ coff64-rs6000.c \ demo64.c \ efi-app-ia64.c \ + efi-app-x86_64.c \ elf64-x86-64.c \ elf64-alpha.c \ elf64-hppa.c \ @@ -578,7 +607,10 @@ BFD64_BACKENDS_CFILES = \ elf64.c \ mmo.c \ nlm32-alpha.c \ - nlm64.c + nlm64.c \ + coff-x86_64.c \ + pe-x86_64.c \ + pei-x86_64.c OPTIONAL_BACKENDS = \ aix386-core.lo \ @@ -612,11 +644,10 @@ CONFIG_STATUS_DEPENDENCIES = \ WORDSIZE = @wordsize@ ALL_BACKENDS = @all_backends@ BFD_BACKENDS = @bfd_backends@ -BFD_LIBS = @bfd_libs@ BFD_MACHINES = @bfd_machines@ TDEFAULTS = @tdefaults@ -INCLUDES = @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) -I$(srcdir)/../intl -I../intl +INCLUDES = @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) @INCINTL@ # C source files that correspond to .o's. SOURCE_CFILES = \ @@ -628,7 +659,7 @@ SOURCE_CFILES = \ $(OPTIONAL_BACKENDS_CFILES) BUILD_CFILES = \ - elf32-ia64.c elf64-ia64.c peigen.c pepigen.c + elf32-ia64.c elf64-ia64.c peigen.c pepigen.c pex64igen.c CFILES = $(SOURCE_CFILES) $(BUILD_CFILES) @@ -698,7 +729,8 @@ install-html-recursive: # BFD_BACKENDS Routines the configured targets need. # BFD_MACHINES Architecture-specific routines the configured targets need. # COREFILE Core file routines for a native configuration -OFILES = $(BFD_BACKENDS) $(BFD_MACHINES) @COREFILE@ +# bfd64_libs Routines for 64bit support +OFILES = $(BFD_BACKENDS) $(BFD_MACHINES) @COREFILE@ @bfd64_libs@ stamp-ofiles: Makefile rm -f tofiles @@ -715,10 +747,12 @@ stamp-ofiles: Makefile ofiles: stamp-ofiles ; @true -libbfd_la_SOURCES = $(BFD32_LIBS_CFILES) $(BFD64_LIBS_CFILES) +# Since BFD64_LIBS is optional and we can't have substitution in +# libbfd_la_SOURCES, we put BFD64_LIBS in OFILES instead. +libbfd_la_SOURCES = $(BFD32_LIBS_CFILES) libbfd_la_DEPENDENCIES = $(OFILES) ofiles libbfd_la_LIBADD = `cat ofiles` @WIN32LIBADD@ -libbfd_la_LDFLAGS = -release $(VERSION) @WIN32LDFLAGS@ +libbfd_la_LDFLAGS = -release `cat libtool-soversion` @WIN32LDFLAGS@ # libtool will build .libs/libbfd.a. We create libbfd.a in the build # directory so that we don't have to convert all the programs that use @@ -756,6 +790,9 @@ targets.lo: targets.c Makefile archures.lo: archures.c Makefile $(LIBTOOL) --mode=compile $(COMPILE) -c $(TDEFAULTS) $(srcdir)/archures.c +dwarf2.lo: dwarf2.c Makefile + $(LIBTOOL) --mode=compile $(COMPILE) -c -DDEBUGDIR=\"$(DEBUGDIR)\" $(srcdir)/dwarf2.c + elf32-target.h : elfxx-target.h rm -f elf32-target.h sed -e s/NN/32/g < $(srcdir)/elfxx-target.h > elf32-target.new @@ -786,6 +823,11 @@ pepigen.c : peXXigen.c sed -e s/XX/pep/g < $(srcdir)/peXXigen.c > pepigen.new mv -f pepigen.new pepigen.c +pex64igen.c: peXXigen.c + rm -f pex64igen.c + sed -e s/XX/pex64/g < $(srcdir)/peXXigen.c > pex64igen.new + mv -f pex64igen.new pex64igen.c + BFD_H_DEPS= $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h LOCAL_H_DEPS= libbfd.h sysdep.h config.h $(BFD32_LIBS) \ @@ -929,17 +971,26 @@ MOSTLYCLEANFILES = ofiles stamp-ofiles CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEPA DEP1 DEP2 libbfd.a stamp-lib \ stmp-bin2-h stmp-lbfd-h stmp-lcoff-h -DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES) +DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES) libtool-soversion bfdver.h: $(srcdir)/version.h $(srcdir)/Makefile.in @echo "creating $@" @bfd_version=`echo "$(VERSION)" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\ bfd_version_string="\"$(VERSION)\"" ;\ + bfd_soversion="$(VERSION)" ;\ + bfd_version_package="\"$(PKGVERSION)\"" ;\ + report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\ if test "x$(RELEASE)" = x ; then \ bfd_version_date=`sed -n -e 's/.*DATE //p' < $(srcdir)/version.h` ;\ - bfd_version_string="\"$(VERSION) $${bfd_version_date}\"" ;\ + bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\ + bfd_soversion="$(VERSION).$${bfd_version_date}" ;\ fi ;\ - sed -e "s/@bfd_version@/$$bfd_version/" -e "s/@bfd_version_string@/$$bfd_version_string/" < $(srcdir)/version.h > $@ + sed -e "s,@bfd_version@,$$bfd_version," \ + -e "s,@bfd_version_string@,$$bfd_version_string," \ + -e "s,@bfd_version_package@,$$bfd_version_package," \ + -e "s,@report_bugs_to@,$$report_bugs_to," \ + < $(srcdir)/version.h > $@; \ + echo "$${bfd_soversion}" > libtool-soversion # What appears below is generated by a hacked mkdep using gcc -MM. @@ -950,11 +1001,12 @@ archive.lo: archive.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ $(INCDIR)/safe-ctype.h archures.lo: archures.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/safe-ctype.h -bfd.lo: bfd.c bfdver.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h libcoff.h \ - libecoff.h $(INCDIR)/coff/ecoff.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h +bfd.lo: bfd.c $(INCDIR)/filenames.h bfdver.h $(INCDIR)/libiberty.h \ + $(INCDIR)/demangle.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/sym.h libcoff.h libecoff.h $(INCDIR)/coff/ecoff.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h bfdio.lo: bfdio.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h bfdwin.lo: bfdwin.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cache.lo: cache.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ @@ -1008,6 +1060,7 @@ cpu-arm.lo: cpu-arm.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/libiberty.h cpu-avr.lo: cpu-avr.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-bfin.lo: cpu-bfin.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-cr16.lo: cpu-cr16.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-cris.lo: cpu-cris.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-cr16c.lo: cpu-cr16c.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-crx.lo: cpu-crx.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h @@ -1040,6 +1093,7 @@ cpu-m10200.lo: cpu-m10200.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-m10300.lo: cpu-m10300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-maxq.lo: cpu-maxq.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-mcore.lo: cpu-mcore.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-mep.lo: cpu-mep.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-mips.lo: cpu-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-mmix.lo: cpu-mmix.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-mt.lo: cpu-mt.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h @@ -1055,9 +1109,11 @@ cpu-powerpc.lo: cpu-powerpc.c $(INCDIR)/filenames.h \ $(INCDIR)/hashtab.h cpu-rs6000.lo: cpu-rs6000.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-s390.lo: cpu-s390.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-score.lo: cpu-score.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-sh.lo: cpu-sh.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(srcdir)/../opcodes/sh-opc.h cpu-sparc.lo: cpu-sparc.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-spu.lo: cpu-spu.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-tic30.lo: cpu-tic30.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-tic4x.lo: cpu-tic4x.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-tic54x.lo: cpu-tic54x.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h @@ -1127,7 +1183,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 \ @@ -1197,7 +1254,7 @@ coff-tic54x.lo: coff-tic54x.c $(INCDIR)/filenames.h \ $(INCDIR)/hashtab.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic54x.h \ $(INCDIR)/coff/ti.h $(INCDIR)/coff/internal.h libcoff.h \ coffcode.h coffswap.h -coff-tic80.lo: coff-tic80.c $(INCDIR)/bfdlink.h $(INCDIR)/filenames.h \ +coff-tic80.lo: coff-tic80.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/hashtab.h $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h \ $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h coff-u68k.lo: coff-u68k.c coff-m68k.c $(INCDIR)/filenames.h \ @@ -1260,11 +1317,16 @@ elf32-arm.lo: elf32-arm.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ elf32-avr.lo: elf32-avr.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)/elf/avr.h \ - $(INCDIR)/elf/reloc-macros.h elf32-target.h + $(INCDIR)/elf/reloc-macros.h elf32-avr.h elf32-target.h elf32-bfin.lo: elf32-bfin.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)/elf/bfin.h \ - $(INCDIR)/elf/reloc-macros.h elf32-target.h + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/elf/dwarf2.h \ + elf32-target.h +elf32-cr16.lo: elf32-cr16.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/elf/cr16.h $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-cr16c.lo: elf32-cr16c.c $(INCDIR)/filenames.h \ $(INCDIR)/hashtab.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/cr16c.h \ $(INCDIR)/elf/reloc-macros.h elf-bfd.h $(INCDIR)/elf/common.h \ @@ -1378,19 +1440,24 @@ elf32-mcore.lo: elf32-mcore.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/mcore.h \ $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-mep.lo: elf32-mep.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)/elf/mep.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ + elf32-target.h elfxx-mips.lo: elfxx-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/libiberty.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ elfxx-mips.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \ - $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \ - $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h elf-vxworks.h + elf-vxworks.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \ + $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h elf32-mips.lo: elf32-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \ - $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \ - $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h elf-vxworks.h \ + $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \ - ecoffswap.h elf32-target.h elf-vxworks.h + ecoffswap.h elf32-target.h elf32-mt.lo: elf32-mt.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)/elf/mt.h \ @@ -1422,9 +1489,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 \ @@ -1434,27 +1501,36 @@ elf32-s390.lo: elf32-s390.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/s390.h \ $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-score.lo: elf32-score.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/elf/score.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 elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/sparc.h \ - elfxx-sparc.h elf-vxworks.h + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/opcode/sparc.h elfxx-sparc.h elf-vxworks.h elf32-sparc.lo: elf32-sparc.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/sparc.h \ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/sparc.h \ - elfxx-sparc.h elf32-target.h elf-vxworks.h + elfxx-sparc.h elf-vxworks.h elf32-target.h +elf32-spu.lo: elf32-spu.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/spu.h \ + $(INCDIR)/elf/reloc-macros.h elf32-spu.h elf32-target.h elf32-v850.lo: elf32-v850.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/v850.h \ @@ -1486,6 +1562,9 @@ elflink.lo: elflink.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)/safe-ctype.h \ $(INCDIR)/libiberty.h $(INCDIR)/objalloc.h +elf-attrs.lo: elf-attrs.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf-strtab.lo: elf-strtab.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)/libiberty.h @@ -1570,7 +1649,7 @@ m88kopenbsd.lo: m88kopenbsd.c netbsd.h $(INCDIR)/filenames.h \ $(INCDIR)/hashtab.h libaout.h $(INCDIR)/bfdlink.h aout-target.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ $(INCDIR)/aout/ar.h -mach-o.lo: mach-o.c mach-o.h $(INCDIR)/filenames.h \ +mach-o.lo: mach-o.c $(INCDIR)/filenames.h mach-o.h \ $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h mach-o-target.c mipsbsd.lo: mipsbsd.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ @@ -1610,8 +1689,8 @@ pdp11.lo: pdp11.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ $(INCDIR)/safe-ctype.h -pef.lo: pef.c $(INCDIR)/safe-ctype.h pef.h pef-traceback.h \ - $(INCDIR)/filenames.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h +pef.lo: pef.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ + pef.h pef-traceback.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h pe-arm.lo: pe-arm.c $(INCDIR)/filenames.h coff-arm.c \ $(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ @@ -1620,6 +1699,16 @@ pei-arm.lo: pei-arm.c $(INCDIR)/filenames.h coff-arm.c \ $(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h +pe-arm-wince.lo: pe-arm-wince.c pe-arm.c $(INCDIR)/filenames.h \ + coff-arm.c $(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h \ + $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ + peicode.h libpei.h +pei-arm-wince.lo: pei-arm-wince.c pei-arm.c $(INCDIR)/filenames.h \ + coff-arm.c $(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h \ + $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ + peicode.h libpei.h pe-i386.lo: pe-i386.c $(INCDIR)/filenames.h coff-i386.c \ $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ @@ -1662,7 +1751,7 @@ pei-mips.lo: pei-mips.c $(INCDIR)/filenames.h pe-mips.c \ $(INCDIR)/hashtab.h $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h -ppcboot.lo: ppcboot.c $(INCDIR)/safe-ctype.h $(INCDIR)/filenames.h \ +ppcboot.lo: ppcboot.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ $(INCDIR)/hashtab.h reloc16.lo: reloc16.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/bfdlink.h genlink.h $(INCDIR)/coff/internal.h \ @@ -1703,7 +1792,7 @@ vms.lo: vms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/hashtab.h vms.h vms-gsd.lo: vms-gsd.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/hashtab.h vms.h -vms-hdr.lo: vms-hdr.c bfdver.h $(INCDIR)/filenames.h \ +vms-hdr.lo: vms-hdr.c $(INCDIR)/filenames.h bfdver.h \ $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h $(INCDIR)/hashtab.h \ vms.h vms-misc.lo: vms-misc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ @@ -1713,12 +1802,12 @@ vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/hashtab.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \ libcoff.h libxcoff.h -xsym.lo: xsym.c xsym.h $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +xsym.lo: xsym.c $(INCDIR)/filenames.h xsym.h $(INCDIR)/hashtab.h xtensa-isa.lo: xtensa-isa.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/xtensa-isa.h $(INCDIR)/xtensa-isa-internal.h xtensa-modules.lo: xtensa-modules.c $(INCDIR)/xtensa-isa.h \ $(INCDIR)/xtensa-isa-internal.h -aix5ppc-core.lo: aix5ppc-core.c +aix5ppc-core.lo: aix5ppc-core.c $(INCDIR)/filenames.h aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/hashtab.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h @@ -1740,6 +1829,11 @@ efi-app-ia64.lo: efi-app-ia64.c $(INCDIR)/filenames.h \ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ peicode.h libpei.h +efi-app-x86_64.lo: efi-app-x86_64.c $(INCDIR)/filenames.h \ + coff-x86_64.c $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h \ + $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h \ + coffcode.h peicode.h libpei.h elf64-x86-64.lo: elf64-x86-64.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/x86-64.h \ @@ -1808,6 +1902,21 @@ nlm32-alpha.lo: nlm32-alpha.c $(INCDIR)/filenames.h \ nlm64.lo: nlm64.c nlmcode.h $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ $(INCDIR)/nlm/external.h +coff-x86_64.lo: coff-x86_64.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h coffcode.h \ + coffswap.h +pe-x86_64.lo: pe-x86_64.c $(INCDIR)/filenames.h coff-x86_64.c \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h coffcode.h \ + peicode.h libpei.h +pei-x86_64.lo: pei-x86_64.c $(INCDIR)/filenames.h coff-x86_64.c \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h coffcode.h \ + peicode.h libpei.h aix386-core.lo: aix386-core.c $(INCDIR)/filenames.h \ $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h @@ -1824,16 +1933,19 @@ 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 pepigen.lo: pepigen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/ia64.h $(INCDIR)/coff/external.h \ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h libpei.h +pex64igen.lo: pex64igen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/x86_64.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h libpei.h # IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/contrib/binutils/bfd/Makefile.in b/contrib/binutils/bfd/Makefile.in index 8ed905635617..8f4580e1821c 100644 --- a/contrib/binutils/bfd/Makefile.in +++ b/contrib/binutils/bfd/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.5 from Makefile.am. +# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -15,8 +15,6 @@ @SET_MAKE@ -SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES) - srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ @@ -49,10 +47,17 @@ DIST_COMMON = $(srcdir)/../config.guess $(srcdir)/../config.sub README \ $(srcdir)/../config.sub subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/../config/acx.m4 $(top_srcdir)/../bfd/bfd.m4 \ - $(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../libtool.m4 \ - $(top_srcdir)/../gettext.m4 $(top_srcdir)/configure.in +am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ + $(top_srcdir)/../config/depstand.m4 \ + $(top_srcdir)/../config/gettext-sister.m4 \ + $(top_srcdir)/../config/lead-dot.m4 \ + $(top_srcdir)/../config/nls.m4 $(top_srcdir)/../config/po.m4 \ + $(top_srcdir)/../config/progtest.m4 \ + $(top_srcdir)/../config/stdint.m4 $(top_srcdir)/../libtool.m4 \ + $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \ + $(top_srcdir)/../ltversion.m4 $(top_srcdir)/bfd.m4 \ + $(top_srcdir)/warning.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ @@ -80,19 +85,18 @@ am__objects_1 = archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo \ opncls.lo reloc.lo section.lo syms.lo targets.lo hash.lo \ linker.lo srec.lo binary.lo tekhex.lo ihex.lo stabs.lo \ stab-syms.lo merge.lo dwarf2.lo simple.lo -am__objects_2 = archive64.lo -am_libbfd_la_OBJECTS = $(am__objects_1) $(am__objects_2) +am_libbfd_la_OBJECTS = $(am__objects_1) libbfd_la_OBJECTS = $(am_libbfd_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I. depcomp = am__depfiles_maybe = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ @@ -105,7 +109,6 @@ ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ @@ -131,20 +134,24 @@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ +DEBUGDIR = @DEBUGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@ -GMOFILES = @GMOFILES@ +FGREP = @FGREP@ +GENCAT = @GENCAT@ +GENINSRC_NEVER_FALSE = @GENINSRC_NEVER_FALSE@ +GENINSRC_NEVER_TRUE = @GENINSRC_NEVER_TRUE@ GMSGFMT = @GMSGFMT@ -GT_NO = @GT_NO@ -GT_YES = @GT_YES@ +GREP = @GREP@ HDEFINES = @HDEFINES@ -INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INCINTL = @INCINTL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_LIBBFD_FALSE = @INSTALL_LIBBFD_FALSE@ INSTALL_LIBBFD_TRUE = @INSTALL_LIBBFD_TRUE@ @@ -152,10 +159,10 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ -INTLDEPS = @INTLDEPS@ -INTLLIBS = @INTLLIBS@ -INTLOBJS = @INTLOBJS@ +LD = @LD@ LDFLAGS = @LDFLAGS@ +LIBINTL = @LIBINTL@ +LIBINTL_DEP = @LIBINTL_DEP@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -167,6 +174,8 @@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ NO_WERROR = @NO_WERROR@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ @@ -176,14 +185,16 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -POFILES = @POFILES@ +PKGVERSION = @PKGVERSION@ POSUB = @POSUB@ RANLIB = @RANLIB@ +REPORT_BUGS_TEXI = @REPORT_BUGS_TEXI@ +REPORT_BUGS_TO = @REPORT_BUGS_TO@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TDEFINES = @TDEFINES@ -USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ @@ -192,6 +203,7 @@ WIN32LIBADD = @WIN32LIBADD@ XGETTEXT = @XGETTEXT@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_backends = @all_backends@ @@ -202,10 +214,10 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ +bfd64_libs = @bfd64_libs@ bfd_backends = @bfd_backends@ bfd_default_target_size = @bfd_default_target_size@ bfd_file_ptr = @bfd_file_ptr@ -bfd_libs = @bfd_libs@ bfd_machines = @bfd_machines@ bfd_ufile_ptr = @bfd_ufile_ptr@ bfdincludedir = @bfdincludedir@ @@ -230,10 +242,10 @@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ -l = @l@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -251,6 +263,7 @@ target_vendor = @target_vendor@ tdefaults = @tdefaults@ wordsize = @wordsize@ AUTOMAKE_OPTIONS = 1.9 cygnus +ACLOCAL_AMFLAGS = -I . -I .. -I ../config # Uncomment the following line when doing a release. # RELEASE=y @@ -299,6 +312,7 @@ ALL_MACHINES = \ cpu-arm.lo \ cpu-avr.lo \ cpu-bfin.lo \ + cpu-cr16.lo \ cpu-cr16c.lo \ cpu-cris.lo \ cpu-crx.lo \ @@ -327,6 +341,7 @@ ALL_MACHINES = \ cpu-m10300.lo \ cpu-maxq.lo \ cpu-mcore.lo \ + cpu-mep.lo \ cpu-mips.lo \ cpu-mmix.lo \ cpu-mt.lo \ @@ -339,8 +354,10 @@ ALL_MACHINES = \ cpu-powerpc.lo \ cpu-rs6000.lo \ cpu-s390.lo \ + cpu-score.lo \ cpu-sh.lo \ cpu-sparc.lo \ + cpu-spu.lo \ cpu-tic30.lo \ cpu-tic4x.lo \ cpu-tic54x.lo \ @@ -361,6 +378,7 @@ ALL_MACHINES_CFILES = \ cpu-arm.c \ cpu-avr.c \ cpu-bfin.c \ + cpu-cr16.c \ cpu-cris.c \ cpu-cr16c.c \ cpu-crx.c \ @@ -389,6 +407,7 @@ ALL_MACHINES_CFILES = \ cpu-m10300.c \ cpu-maxq.c \ cpu-mcore.c \ + cpu-mep.c \ cpu-mips.c \ cpu-mmix.c \ cpu-mt.c \ @@ -401,8 +420,10 @@ ALL_MACHINES_CFILES = \ cpu-powerpc.c \ cpu-rs6000.c \ cpu-s390.c \ + cpu-score.c \ cpu-sh.c \ cpu-sparc.c \ + cpu-spu.c \ cpu-tic30.c \ cpu-tic4x.c \ cpu-tic54x.c \ @@ -472,6 +493,7 @@ BFD32_BACKENDS = \ elf32-arm.lo \ elf32-avr.lo \ elf32-bfin.lo \ + elf32-cr16.lo \ elf32-cr16c.lo \ elf32-cris.lo \ elf32-crx.lo \ @@ -499,6 +521,7 @@ BFD32_BACKENDS = \ elf-m10200.lo \ elf-m10300.lo \ elf32-mcore.lo \ + elf32-mep.lo \ elfxx-mips.lo \ elf32-mips.lo \ elf32-mt.lo \ @@ -508,12 +531,14 @@ BFD32_BACKENDS = \ elf32-pj.lo \ elf32-ppc.lo \ elf32-s390.lo \ + elf32-score.lo \ elf32-sh.lo \ elf32-sh-symbian.lo \ elf32-sh64.lo \ elf32-sh64-com.lo \ elfxx-sparc.lo \ elf32-sparc.lo \ + elf32-spu.lo \ elf32-v850.lo \ elf32-vax.lo \ elf32-xstormy16.lo \ @@ -521,6 +546,7 @@ BFD32_BACKENDS = \ elf32-xc16x.lo \ elf32.lo \ elflink.lo \ + elf-attrs.lo \ elf-strtab.lo \ elf-eh-frame.lo \ elf-vxworks.lo \ @@ -560,6 +586,8 @@ BFD32_BACKENDS = \ pef.lo \ pe-arm.lo \ pei-arm.lo \ + pe-arm-wince.lo \ + pei-arm-wince.lo \ pe-i386.lo \ pei-i386.lo \ pe-mcore.lo \ @@ -644,6 +672,7 @@ BFD32_BACKENDS_CFILES = \ elf32-arm.c \ elf32-avr.c \ elf32-bfin.c \ + elf32-cr16.c \ elf32-cr16c.c \ elf32-cris.c \ elf32-crx.c \ @@ -671,6 +700,7 @@ BFD32_BACKENDS_CFILES = \ elf-m10200.c \ elf-m10300.c \ elf32-mcore.c \ + elf32-mep.c \ elfxx-mips.c \ elf32-mips.c \ elf32-mt.c \ @@ -682,10 +712,12 @@ BFD32_BACKENDS_CFILES = \ elf32-sh64.c \ elf32-sh64-com.c \ elf32-s390.c \ + elf32-score.c \ elf32-sh.c \ elf32-sh-symbian.c \ elfxx-sparc.c \ elf32-sparc.c \ + elf32-spu.c \ elf32-v850.c \ elf32-vax.c \ elf32-xstormy16.c \ @@ -693,6 +725,7 @@ BFD32_BACKENDS_CFILES = \ elf32-xc16x.c \ elf32.c \ elflink.c \ + elf-attrs.c \ elf-strtab.c \ elf-eh-frame.c \ elf-vxworks.c \ @@ -732,6 +765,8 @@ BFD32_BACKENDS_CFILES = \ pef.c \ pe-arm.c \ pei-arm.c \ + pe-arm-wince.c \ + pei-arm-wince.c \ pe-i386.c \ pei-i386.c \ pe-mcore.c \ @@ -776,6 +811,7 @@ BFD64_BACKENDS = \ coff64-rs6000.lo \ demo64.lo \ efi-app-ia64.lo \ + efi-app-x86_64.lo \ elf64-x86-64.lo \ elf64-alpha.lo \ elf64-hppa.lo \ @@ -793,7 +829,11 @@ BFD64_BACKENDS = \ mmo.lo \ nlm32-alpha.lo \ nlm64.lo \ - pepigen.lo + coff-x86_64.lo \ + pe-x86_64.lo \ + pei-x86_64.lo \ + pepigen.lo \ + pex64igen.lo BFD64_BACKENDS_CFILES = \ aix5ppc-core.c \ @@ -802,6 +842,7 @@ BFD64_BACKENDS_CFILES = \ coff64-rs6000.c \ demo64.c \ efi-app-ia64.c \ + efi-app-x86_64.c \ elf64-x86-64.c \ elf64-alpha.c \ elf64-hppa.c \ @@ -816,7 +857,10 @@ BFD64_BACKENDS_CFILES = \ elf64.c \ mmo.c \ nlm32-alpha.c \ - nlm64.c + nlm64.c \ + coff-x86_64.c \ + pe-x86_64.c \ + pei-x86_64.c OPTIONAL_BACKENDS = \ aix386-core.lo \ @@ -852,10 +896,9 @@ CONFIG_STATUS_DEPENDENCIES = \ WORDSIZE = @wordsize@ ALL_BACKENDS = @all_backends@ BFD_BACKENDS = @bfd_backends@ -BFD_LIBS = @bfd_libs@ BFD_MACHINES = @bfd_machines@ TDEFAULTS = @tdefaults@ -INCLUDES = @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) -I$(srcdir)/../intl -I../intl +INCLUDES = @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) @INCINTL@ # C source files that correspond to .o's. SOURCE_CFILES = \ @@ -867,7 +910,7 @@ SOURCE_CFILES = \ $(OPTIONAL_BACKENDS_CFILES) BUILD_CFILES = \ - elf32-ia64.c elf64-ia64.c peigen.c pepigen.c + elf32-ia64.c elf64-ia64.c peigen.c pepigen.c pex64igen.c CFILES = $(SOURCE_CFILES) $(BUILD_CFILES) SOURCE_HFILES = \ @@ -892,11 +935,15 @@ BLD_POTFILES = $(BUILD_CFILES) $(BUILD_HFILES) # BFD_BACKENDS Routines the configured targets need. # BFD_MACHINES Architecture-specific routines the configured targets need. # COREFILE Core file routines for a native configuration -OFILES = $(BFD_BACKENDS) $(BFD_MACHINES) @COREFILE@ -libbfd_la_SOURCES = $(BFD32_LIBS_CFILES) $(BFD64_LIBS_CFILES) +# bfd64_libs Routines for 64bit support +OFILES = $(BFD_BACKENDS) $(BFD_MACHINES) @COREFILE@ @bfd64_libs@ + +# Since BFD64_LIBS is optional and we can't have substitution in +# libbfd_la_SOURCES, we put BFD64_LIBS in OFILES instead. +libbfd_la_SOURCES = $(BFD32_LIBS_CFILES) libbfd_la_DEPENDENCIES = $(OFILES) ofiles libbfd_la_LIBADD = `cat ofiles` @WIN32LIBADD@ -libbfd_la_LDFLAGS = -release $(VERSION) @WIN32LDFLAGS@ +libbfd_la_LDFLAGS = -release `cat libtool-soversion` @WIN32LDFLAGS@ # libtool will build .libs/libbfd.a. We create libbfd.a in the build # directory so that we don't have to convert all the programs that use @@ -919,7 +966,7 @@ MOSTLYCLEANFILES = ofiles stamp-ofiles CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEPA DEP1 DEP2 libbfd.a stamp-lib \ stmp-bin2-h stmp-lbfd-h stmp-lcoff-h -DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES) +DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES) libtool-soversion all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -931,15 +978,15 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ - cd $(srcdir) && $(AUTOMAKE) --foreign \ + echo ' cd $(srcdir) && $(AUTOMAKE) --cygnus '; \ + cd $(srcdir) && $(AUTOMAKE) --cygnus \ && exit 0; \ exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile'; \ cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign Makefile + $(AUTOMAKE) --cygnus Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ @@ -1340,6 +1387,9 @@ targets.lo: targets.c Makefile archures.lo: archures.c Makefile $(LIBTOOL) --mode=compile $(COMPILE) -c $(TDEFAULTS) $(srcdir)/archures.c +dwarf2.lo: dwarf2.c Makefile + $(LIBTOOL) --mode=compile $(COMPILE) -c -DDEBUGDIR=\"$(DEBUGDIR)\" $(srcdir)/dwarf2.c + elf32-target.h : elfxx-target.h rm -f elf32-target.h sed -e s/NN/32/g < $(srcdir)/elfxx-target.h > elf32-target.new @@ -1369,6 +1419,11 @@ pepigen.c : peXXigen.c rm -f pepigen.c sed -e s/XX/pep/g < $(srcdir)/peXXigen.c > pepigen.new mv -f pepigen.new pepigen.c + +pex64igen.c: peXXigen.c + rm -f pex64igen.c + sed -e s/XX/pex64/g < $(srcdir)/peXXigen.c > pex64igen.new + mv -f pex64igen.new pex64igen.c $(BFD32_LIBS) \ $(BFD64_LIBS) \ $(ALL_MACHINES) \ @@ -1501,11 +1556,20 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/Makefile.in @echo "creating $@" @bfd_version=`echo "$(VERSION)" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\ bfd_version_string="\"$(VERSION)\"" ;\ + bfd_soversion="$(VERSION)" ;\ + bfd_version_package="\"$(PKGVERSION)\"" ;\ + report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\ if test "x$(RELEASE)" = x ; then \ bfd_version_date=`sed -n -e 's/.*DATE //p' < $(srcdir)/version.h` ;\ - bfd_version_string="\"$(VERSION) $${bfd_version_date}\"" ;\ + bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\ + bfd_soversion="$(VERSION).$${bfd_version_date}" ;\ fi ;\ - sed -e "s/@bfd_version@/$$bfd_version/" -e "s/@bfd_version_string@/$$bfd_version_string/" < $(srcdir)/version.h > $@ + sed -e "s,@bfd_version@,$$bfd_version," \ + -e "s,@bfd_version_string@,$$bfd_version_string," \ + -e "s,@bfd_version_package@,$$bfd_version_package," \ + -e "s,@report_bugs_to@,$$report_bugs_to," \ + < $(srcdir)/version.h > $@; \ + echo "$${bfd_soversion}" > libtool-soversion # What appears below is generated by a hacked mkdep using gcc -MM. @@ -1516,11 +1580,12 @@ archive.lo: archive.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ $(INCDIR)/safe-ctype.h archures.lo: archures.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/safe-ctype.h -bfd.lo: bfd.c bfdver.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h libcoff.h \ - libecoff.h $(INCDIR)/coff/ecoff.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h +bfd.lo: bfd.c $(INCDIR)/filenames.h bfdver.h $(INCDIR)/libiberty.h \ + $(INCDIR)/demangle.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/sym.h libcoff.h libecoff.h $(INCDIR)/coff/ecoff.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h bfdio.lo: bfdio.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h bfdwin.lo: bfdwin.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cache.lo: cache.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ @@ -1574,6 +1639,7 @@ cpu-arm.lo: cpu-arm.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/libiberty.h cpu-avr.lo: cpu-avr.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-bfin.lo: cpu-bfin.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-cr16.lo: cpu-cr16.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-cris.lo: cpu-cris.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-cr16c.lo: cpu-cr16c.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-crx.lo: cpu-crx.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h @@ -1606,6 +1672,7 @@ cpu-m10200.lo: cpu-m10200.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-m10300.lo: cpu-m10300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-maxq.lo: cpu-maxq.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-mcore.lo: cpu-mcore.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-mep.lo: cpu-mep.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-mips.lo: cpu-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-mmix.lo: cpu-mmix.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-mt.lo: cpu-mt.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h @@ -1621,9 +1688,11 @@ cpu-powerpc.lo: cpu-powerpc.c $(INCDIR)/filenames.h \ $(INCDIR)/hashtab.h cpu-rs6000.lo: cpu-rs6000.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-s390.lo: cpu-s390.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-score.lo: cpu-score.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-sh.lo: cpu-sh.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(srcdir)/../opcodes/sh-opc.h cpu-sparc.lo: cpu-sparc.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-spu.lo: cpu-spu.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-tic30.lo: cpu-tic30.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-tic4x.lo: cpu-tic4x.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h cpu-tic54x.lo: cpu-tic54x.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h @@ -1693,7 +1762,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 \ @@ -1763,7 +1833,7 @@ coff-tic54x.lo: coff-tic54x.c $(INCDIR)/filenames.h \ $(INCDIR)/hashtab.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic54x.h \ $(INCDIR)/coff/ti.h $(INCDIR)/coff/internal.h libcoff.h \ coffcode.h coffswap.h -coff-tic80.lo: coff-tic80.c $(INCDIR)/bfdlink.h $(INCDIR)/filenames.h \ +coff-tic80.lo: coff-tic80.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/hashtab.h $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h \ $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h coff-u68k.lo: coff-u68k.c coff-m68k.c $(INCDIR)/filenames.h \ @@ -1826,11 +1896,16 @@ elf32-arm.lo: elf32-arm.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ elf32-avr.lo: elf32-avr.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)/elf/avr.h \ - $(INCDIR)/elf/reloc-macros.h elf32-target.h + $(INCDIR)/elf/reloc-macros.h elf32-avr.h elf32-target.h elf32-bfin.lo: elf32-bfin.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)/elf/bfin.h \ - $(INCDIR)/elf/reloc-macros.h elf32-target.h + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/elf/dwarf2.h \ + elf32-target.h +elf32-cr16.lo: elf32-cr16.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/elf/cr16.h $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-cr16c.lo: elf32-cr16c.c $(INCDIR)/filenames.h \ $(INCDIR)/hashtab.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/cr16c.h \ $(INCDIR)/elf/reloc-macros.h elf-bfd.h $(INCDIR)/elf/common.h \ @@ -1944,19 +2019,24 @@ elf32-mcore.lo: elf32-mcore.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/mcore.h \ $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-mep.lo: elf32-mep.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)/elf/mep.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ + elf32-target.h elfxx-mips.lo: elfxx-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/libiberty.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ elfxx-mips.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \ - $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \ - $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h elf-vxworks.h + elf-vxworks.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \ + $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h elf32-mips.lo: elf32-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \ - $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \ - $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h elf-vxworks.h \ + $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \ - ecoffswap.h elf32-target.h elf-vxworks.h + ecoffswap.h elf32-target.h elf32-mt.lo: elf32-mt.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)/elf/mt.h \ @@ -1988,9 +2068,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 \ @@ -2000,27 +2080,36 @@ elf32-s390.lo: elf32-s390.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/s390.h \ $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-score.lo: elf32-score.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/elf/score.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 elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/sparc.h \ - elfxx-sparc.h elf-vxworks.h + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/opcode/sparc.h elfxx-sparc.h elf-vxworks.h elf32-sparc.lo: elf32-sparc.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/sparc.h \ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/sparc.h \ - elfxx-sparc.h elf32-target.h elf-vxworks.h + elfxx-sparc.h elf-vxworks.h elf32-target.h +elf32-spu.lo: elf32-spu.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/spu.h \ + $(INCDIR)/elf/reloc-macros.h elf32-spu.h elf32-target.h elf32-v850.lo: elf32-v850.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/v850.h \ @@ -2052,6 +2141,9 @@ elflink.lo: elflink.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)/safe-ctype.h \ $(INCDIR)/libiberty.h $(INCDIR)/objalloc.h +elf-attrs.lo: elf-attrs.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf-strtab.lo: elf-strtab.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)/libiberty.h @@ -2136,7 +2228,7 @@ m88kopenbsd.lo: m88kopenbsd.c netbsd.h $(INCDIR)/filenames.h \ $(INCDIR)/hashtab.h libaout.h $(INCDIR)/bfdlink.h aout-target.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ $(INCDIR)/aout/ar.h -mach-o.lo: mach-o.c mach-o.h $(INCDIR)/filenames.h \ +mach-o.lo: mach-o.c $(INCDIR)/filenames.h mach-o.h \ $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h mach-o-target.c mipsbsd.lo: mipsbsd.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ @@ -2176,8 +2268,8 @@ pdp11.lo: pdp11.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ $(INCDIR)/safe-ctype.h -pef.lo: pef.c $(INCDIR)/safe-ctype.h pef.h pef-traceback.h \ - $(INCDIR)/filenames.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h +pef.lo: pef.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ + pef.h pef-traceback.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h pe-arm.lo: pe-arm.c $(INCDIR)/filenames.h coff-arm.c \ $(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ @@ -2186,6 +2278,16 @@ pei-arm.lo: pei-arm.c $(INCDIR)/filenames.h coff-arm.c \ $(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h +pe-arm-wince.lo: pe-arm-wince.c pe-arm.c $(INCDIR)/filenames.h \ + coff-arm.c $(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h \ + $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ + peicode.h libpei.h +pei-arm-wince.lo: pei-arm-wince.c pei-arm.c $(INCDIR)/filenames.h \ + coff-arm.c $(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h \ + $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ + peicode.h libpei.h pe-i386.lo: pe-i386.c $(INCDIR)/filenames.h coff-i386.c \ $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ @@ -2228,7 +2330,7 @@ pei-mips.lo: pei-mips.c $(INCDIR)/filenames.h pe-mips.c \ $(INCDIR)/hashtab.h $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h -ppcboot.lo: ppcboot.c $(INCDIR)/safe-ctype.h $(INCDIR)/filenames.h \ +ppcboot.lo: ppcboot.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ $(INCDIR)/hashtab.h reloc16.lo: reloc16.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/bfdlink.h genlink.h $(INCDIR)/coff/internal.h \ @@ -2269,7 +2371,7 @@ vms.lo: vms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/hashtab.h vms.h vms-gsd.lo: vms-gsd.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/hashtab.h vms.h -vms-hdr.lo: vms-hdr.c bfdver.h $(INCDIR)/filenames.h \ +vms-hdr.lo: vms-hdr.c $(INCDIR)/filenames.h bfdver.h \ $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h $(INCDIR)/hashtab.h \ vms.h vms-misc.lo: vms-misc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ @@ -2279,12 +2381,12 @@ vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/hashtab.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \ libcoff.h libxcoff.h -xsym.lo: xsym.c xsym.h $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +xsym.lo: xsym.c $(INCDIR)/filenames.h xsym.h $(INCDIR)/hashtab.h xtensa-isa.lo: xtensa-isa.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/xtensa-isa.h $(INCDIR)/xtensa-isa-internal.h xtensa-modules.lo: xtensa-modules.c $(INCDIR)/xtensa-isa.h \ $(INCDIR)/xtensa-isa-internal.h -aix5ppc-core.lo: aix5ppc-core.c +aix5ppc-core.lo: aix5ppc-core.c $(INCDIR)/filenames.h aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/hashtab.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h @@ -2306,6 +2408,11 @@ efi-app-ia64.lo: efi-app-ia64.c $(INCDIR)/filenames.h \ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ peicode.h libpei.h +efi-app-x86_64.lo: efi-app-x86_64.c $(INCDIR)/filenames.h \ + coff-x86_64.c $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h \ + $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h \ + coffcode.h peicode.h libpei.h elf64-x86-64.lo: elf64-x86-64.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/x86-64.h \ @@ -2374,6 +2481,21 @@ nlm32-alpha.lo: nlm32-alpha.c $(INCDIR)/filenames.h \ nlm64.lo: nlm64.c nlmcode.h $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ $(INCDIR)/nlm/external.h +coff-x86_64.lo: coff-x86_64.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h coffcode.h \ + coffswap.h +pe-x86_64.lo: pe-x86_64.c $(INCDIR)/filenames.h coff-x86_64.c \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h coffcode.h \ + peicode.h libpei.h +pei-x86_64.lo: pei-x86_64.c $(INCDIR)/filenames.h coff-x86_64.c \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h coffcode.h \ + peicode.h libpei.h aix386-core.lo: aix386-core.c $(INCDIR)/filenames.h \ $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h @@ -2390,18 +2512,21 @@ 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 pepigen.lo: pepigen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/ia64.h $(INCDIR)/coff/external.h \ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h libpei.h +pex64igen.lo: pex64igen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/x86_64.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h libpei.h # IF YOU PUT ANYTHING HERE IT WILL GO AWAY # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/contrib/binutils/bfd/acinclude.m4 b/contrib/binutils/bfd/acinclude.m4 index 95e3d4a702d3..cd4fd55be6c2 100644 --- a/contrib/binutils/bfd/acinclude.m4 +++ b/contrib/binutils/bfd/acinclude.m4 @@ -1,7 +1,3 @@ -sinclude(../config/acx.m4) -sinclude(../bfd/bfd.m4) -sinclude(../bfd/warning.m4) - dnl See whether we need to use fopen-bin.h rather than fopen-same.h. AC_DEFUN([BFD_BINARY_FOPEN], [AC_REQUIRE([AC_CANONICAL_TARGET]) @@ -45,22 +41,6 @@ else fi AC_SUBST(EXEEXT_FOR_BUILD)])dnl -sinclude(../libtool.m4) -dnl The lines below arrange for aclocal not to bring libtool.m4 -dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake -dnl to add a definition of LIBTOOL to Makefile.in. -ifelse(yes,no,[ -AC_DEFUN([AM_PROG_LIBTOOL],) -AC_DEFUN([AM_DISABLE_SHARED],) -AC_SUBST(LIBTOOL) -]) - -sinclude(../gettext.m4) -ifelse(yes,no,[ -AC_DEFUN([CY_WITH_NLS],) -AC_SUBST(INTLLIBS) -]) - AC_DEFUN([AM_INSTALL_LIBBFD], [AC_MSG_CHECKING([whether to install libbfd]) AC_ARG_ENABLE(install-libbfd, diff --git a/contrib/binutils/bfd/aclocal.m4 b/contrib/binutils/bfd/aclocal.m4 index d5f315805a9c..9dfea067fbf9 100644 --- a/contrib/binutils/bfd/aclocal.m4 +++ b/contrib/binutils/bfd/aclocal.m4 @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.9.5 -*- Autoconf -*- +# generated automatically by aclocal 1.9.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005 Free Software Foundation, Inc. @@ -28,7 +28,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.9.5])]) + [AM_AUTOMAKE_VERSION([1.9.6])]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- @@ -480,27 +480,6 @@ AC_DEFUN([AM_PROG_INSTALL_SH], install_sh=${install_sh-"$am_aux_dir/install-sh"} AC_SUBST(install_sh)]) -# Copyright (C) 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 2 - -# Check whether the underlying file-system supports filenames -# with a leading dot. For instance MS-DOS doesn't. -AC_DEFUN([AM_SET_LEADING_DOT], -[rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null -AC_SUBST([am__leading_dot])]) - # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering @@ -889,4 +868,18 @@ AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR +m4_include([../config/acx.m4]) +m4_include([../config/depstand.m4]) +m4_include([../config/gettext-sister.m4]) +m4_include([../config/lead-dot.m4]) +m4_include([../config/nls.m4]) +m4_include([../config/po.m4]) +m4_include([../config/progtest.m4]) +m4_include([../config/stdint.m4]) +m4_include([../libtool.m4]) +m4_include([../ltoptions.m4]) +m4_include([../ltsugar.m4]) +m4_include([../ltversion.m4]) +m4_include([bfd.m4]) +m4_include([warning.m4]) m4_include([acinclude.m4]) diff --git a/contrib/binutils/bfd/aout-arm.c b/contrib/binutils/bfd/aout-arm.c index d8834a4f331d..4b0d42c1acad 100644 --- a/contrib/binutils/bfd/aout-arm.c +++ b/contrib/binutils/bfd/aout-arm.c @@ -1,6 +1,6 @@ /* BFD back-end for raw ARM a.out binaries. - Copyright 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005 - Free Software Foundation, Inc. + Copyright 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, + 2007 Free Software Foundation, Inc. Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) This file is part of BFD, the Binary File Descriptor library. @@ -19,8 +19,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" /* Avoid multiple definitions from aoutx if supporting standard a.out as well as our own. */ @@ -50,6 +50,7 @@ #define N_MAGIC(x) ((x).a_info & ~07200) #define MY_bfd_reloc_type_lookup aoutarm_bfd_reloc_type_lookup +#define MY_bfd_reloc_name_lookup aoutarm_bfd_reloc_name_lookup #include "libaout.h" #include "aout/aout64.h" @@ -317,6 +318,22 @@ MY (bfd_reloc_type_lookup) (bfd *abfd, } } +static reloc_howto_type * +MY (bfd_reloc_name_lookup) (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (MY (howto_table)) / sizeof (MY (howto_table)[0]); + i++) + if (MY (howto_table)[i].name != NULL + && strcasecmp (MY (howto_table)[i].name, r_name) == 0) + return &MY (howto_table)[i]; + + return NULL; +} + #define MY_swap_std_reloc_in MY (swap_std_reloc_in) #define MY_swap_std_reloc_out MY (swap_std_reloc_out) #define MY_get_section_contents _bfd_generic_get_section_contents diff --git a/contrib/binutils/bfd/aout-target.h b/contrib/binutils/bfd/aout-target.h index 5a30eda74142..3e5fa910170e 100644 --- a/contrib/binutils/bfd/aout-target.h +++ b/contrib/binutils/bfd/aout-target.h @@ -1,6 +1,6 @@ /* Define a target vector and some small routines for a variant of a.out. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005 + 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -29,6 +29,7 @@ #endif extern reloc_howto_type * NAME (aout, reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); +extern reloc_howto_type * NAME (aout, reloc_name_lookup) (bfd *, const char *); /* Set parameters about this a.out file that are machine-dependent. This routine is called from some_aout_object_p just before it returns. */ @@ -494,6 +495,9 @@ MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info) #ifndef MY_bfd_reloc_type_lookup #define MY_bfd_reloc_type_lookup NAME (aout, reloc_type_lookup) #endif +#ifndef MY_bfd_reloc_name_lookup +#define MY_bfd_reloc_name_lookup NAME (aout, reloc_name_lookup) +#endif #ifndef MY_bfd_make_debug_symbol #define MY_bfd_make_debug_symbol 0 #endif diff --git a/contrib/binutils/bfd/aoutf1.h b/contrib/binutils/bfd/aoutf1.h index cba4fbbeff99..0353bfdc3f28 100644 --- a/contrib/binutils/bfd/aoutf1.h +++ b/contrib/binutils/bfd/aoutf1.h @@ -1,6 +1,6 @@ /* A.out "format 1" file handling code for BFD. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, - 2001, 2002, 2003, 2004, 2005, 2006 + 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -20,8 +20,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "aout/sun4.h" @@ -566,6 +566,7 @@ sunos4_core_file_p (bfd *abfd) struct internal_sunos_core internal_sunos_core; char external_core[1]; } *mergem; + flagword flags; if (bfd_bread ((void *) longbuf, (bfd_size_type) sizeof (longbuf), abfd) != sizeof (longbuf)) @@ -627,28 +628,31 @@ sunos4_core_file_p (bfd *abfd) abfd->tdata.sun_core_data->hdr = core; /* Create the sections. */ - core_stacksec (abfd) = bfd_make_section_anyway (abfd, ".stack"); + flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS; + core_stacksec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".stack", + flags); if (core_stacksec (abfd) == NULL) /* bfd_release frees everything allocated after it's arg. */ goto loser; - core_datasec (abfd) = bfd_make_section_anyway (abfd, ".data"); + flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS; + core_datasec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".data", + flags); if (core_datasec (abfd) == NULL) goto loser; - core_regsec (abfd) = bfd_make_section_anyway (abfd, ".reg"); + flags = SEC_HAS_CONTENTS; + core_regsec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".reg", + flags); if (core_regsec (abfd) == NULL) goto loser; - core_reg2sec (abfd) = bfd_make_section_anyway (abfd, ".reg2"); + flags = SEC_HAS_CONTENTS; + core_reg2sec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".reg2", + flags); if (core_reg2sec (abfd) == NULL) goto loser; - core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS; - core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS; - core_regsec (abfd)->flags = SEC_HAS_CONTENTS; - core_reg2sec (abfd)->flags = SEC_HAS_CONTENTS; - core_stacksec (abfd)->size = core->c_ssize; core_datasec (abfd)->size = core->c_dsize; core_regsec (abfd)->size = core->c_regs_size; diff --git a/contrib/binutils/bfd/aoutx.h b/contrib/binutils/bfd/aoutx.h index 7dce07240ff6..09331aa0ca24 100644 --- a/contrib/binutils/bfd/aoutx.h +++ b/contrib/binutils/bfd/aoutx.h @@ -1,6 +1,6 @@ /* BFD semi-generic back-end for a.out binaries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -118,8 +118,8 @@ DESCRIPTION #define KEEPIT udata.i -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "safe-ctype.h" #include "bfdlink.h" @@ -129,8 +129,6 @@ DESCRIPTION #include "aout/stab_gnu.h" #include "aout/ar.h" -reloc_howto_type * NAME (aout, reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); - /* SUBSECTION Relocations @@ -319,6 +317,31 @@ NAME (aout, reloc_type_lookup) (bfd *abfd, bfd_reloc_code_real_type code) } } +reloc_howto_type * +NAME (aout, reloc_name_lookup) (bfd *abfd, const char *r_name) +{ + unsigned int i, size; + reloc_howto_type *howto_table; + + if (obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE) + { + howto_table = howto_table_ext; + size = sizeof (howto_table_ext) / sizeof (howto_table_ext[0]); + } + else + { + howto_table = howto_table_std; + size = sizeof (howto_table_std) / sizeof (howto_table_std[0]); + } + + for (i = 0; i < size; i++) + if (howto_table[i].name != NULL + && strcasecmp (howto_table[i].name, r_name) == 0) + return &howto_table[i]; + + return NULL; +} + /* SUBSECTION Internal entry points @@ -1193,26 +1216,21 @@ NAME (aout, new_section_hook) (bfd *abfd, asection *newsect) { obj_textsec (abfd)= newsect; newsect->target_index = N_TEXT; - return TRUE; } - - if (obj_datasec (abfd) == NULL && !strcmp (newsect->name, ".data")) + else if (obj_datasec (abfd) == NULL && !strcmp (newsect->name, ".data")) { obj_datasec (abfd) = newsect; newsect->target_index = N_DATA; - return TRUE; } - - if (obj_bsssec (abfd) == NULL && !strcmp (newsect->name, ".bss")) + else if (obj_bsssec (abfd) == NULL && !strcmp (newsect->name, ".bss")) { obj_bsssec (abfd) = newsect; newsect->target_index = N_BSS; - return TRUE; } } /* We allow more than three sections internally. */ - return TRUE; + return _bfd_generic_new_section_hook (abfd, newsect); } bfd_boolean @@ -1934,7 +1952,10 @@ NAME (aout, swap_std_reloc_out) (bfd *abfd, if (bfd_is_com_section (output_section) || bfd_is_abs_section (output_section) - || bfd_is_und_section (output_section)) + || bfd_is_und_section (output_section) + /* PR gas/3041 a.out relocs against weak symbols + must be treated as if they were against externs. */ + || (sym->flags & BSF_WEAK)) { if (bfd_abs_section_ptr->symbol == sym) { @@ -2785,7 +2806,8 @@ NAME (aout, find_nearest_line) (bfd *abfd, } int -NAME (aout, sizeof_headers) (bfd *abfd, bfd_boolean execable ATTRIBUTE_UNUSED) +NAME (aout, sizeof_headers) (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return adata (abfd).exec_bytes_size; } diff --git a/contrib/binutils/bfd/archive.c b/contrib/binutils/bfd/archive.c index 5a12f01f7cc5..053ad47dfddf 100644 --- a/contrib/binutils/bfd/archive.c +++ b/contrib/binutils/bfd/archive.c @@ -1,6 +1,6 @@ /* BFD back-end for archive files (libraries). Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Cygnus Support. Mostly Gumby Henkel-Wallace's fault. @@ -129,8 +129,8 @@ SUBSECTION " 18 " - Long name 18 characters long, extended pseudo-BSD. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libiberty.h" #include "libbfd.h" #include "aout/ar.h" @@ -666,10 +666,7 @@ bfd_generic_archive_p (bfd *abfd) first = bfd_openr_next_archived_file (abfd, NULL); if (first != NULL) { - bfd_boolean fail; - first->target_defaulted = FALSE; - fail = FALSE; if (bfd_check_format (first, bfd_object) && first->xvec != abfd->xvec) { @@ -915,12 +912,12 @@ bfd_slurp_armap (bfd *abfd) if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0) return FALSE; - if (!strncmp (nextname, "__.SYMDEF ", 16) - || !strncmp (nextname, "__.SYMDEF/ ", 16)) /* old Linux archives */ + if (CONST_STRNEQ (nextname, "__.SYMDEF ") + || CONST_STRNEQ (nextname, "__.SYMDEF/ ")) /* Old Linux archives. */ return do_slurp_bsd_armap (abfd); - else if (!strncmp (nextname, "/ ", 16)) + else if (CONST_STRNEQ (nextname, "/ ")) return do_slurp_coff_armap (abfd); - else if (!strncmp (nextname, "/SYM64/ ", 16)) + else if (CONST_STRNEQ (nextname, "/SYM64/ ")) { /* 64bit ELF (Irix 6) archive. */ #ifdef BFD64 @@ -966,11 +963,11 @@ bfd_slurp_bsd_armap_f2 (bfd *abfd) if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0) return FALSE; - if (!strncmp (nextname, "__.SYMDEF ", 16) - || !strncmp (nextname, "__.SYMDEF/ ", 16)) /* Old Linux archives. */ + if (CONST_STRNEQ (nextname, "__.SYMDEF ") + || CONST_STRNEQ (nextname, "__.SYMDEF/ ")) /* Old Linux archives. */ return do_slurp_bsd_armap (abfd); - if (strncmp (nextname, "/ ", 16)) + if (! CONST_STRNEQ (nextname, "/ ")) { bfd_has_map (abfd) = FALSE; return TRUE; @@ -1066,8 +1063,8 @@ _bfd_slurp_extended_name_table (bfd *abfd) if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0) return FALSE; - if (strncmp (nextname, "ARFILENAMES/ ", 16) != 0 && - strncmp (nextname, "// ", 16) != 0) + if (! CONST_STRNEQ (nextname, "ARFILENAMES/ ") + && ! CONST_STRNEQ (nextname, "// ")) { bfd_ardata (abfd)->extended_names = NULL; bfd_ardata (abfd)->extended_names_size = 0; @@ -1237,7 +1234,9 @@ _bfd_construct_extended_name_table (bfd *abfd, *tablen = 0; /* Figure out how long the table should be. */ - for (current = abfd->archive_head; current != NULL; current = current->next) + for (current = abfd->archive_head; + current != NULL; + current = current->archive_next) { const char *normal; unsigned int thislen; @@ -1289,8 +1288,9 @@ _bfd_construct_extended_name_table (bfd *abfd, *tablen = total_namelen; strptr = *tabloc; - for (current = abfd->archive_head; current != NULL; current = - current->next) + for (current = abfd->archive_head; + current != NULL; + current = current->archive_next) { const char *normal; unsigned int thislen; @@ -1339,7 +1339,7 @@ hpux_uid_gid_encode (char str[6], long int id) str[5] = '@' + (id & 3); id >>= 2; - for (cnt = 4; cnt >= 0; ++cnt, id >>= 6) + for (cnt = 4; cnt >= 0; --cnt, id >>= 6) str[cnt] = ' ' + (id & 0x3f); } #endif /* HPUX_LARGE_AR_IDS */ @@ -1640,7 +1640,9 @@ _bfd_write_archive_contents (bfd *arch) /* Verify the viability of all entries; if any of them live in the filesystem (as opposed to living in an archive open for input) then construct a fresh ar_hdr for them. */ - for (current = arch->archive_head; current; current = current->next) + for (current = arch->archive_head; + current != NULL; + current = current->archive_next) { /* This check is checking the bfds for the objects we're reading from (which are usually either an object file or archive on @@ -1650,14 +1652,14 @@ _bfd_write_archive_contents (bfd *arch) if (bfd_write_p (current)) { bfd_set_error (bfd_error_invalid_operation); - return FALSE; + goto input_err; } if (!current->arelt_data) { current->arelt_data = bfd_ar_hdr_from_filesystem (arch, current->filename, current); if (!current->arelt_data) - return FALSE; + goto input_err; /* Put in the file name. */ BFD_SEND (arch, _bfd_truncate_arname, @@ -1708,7 +1710,9 @@ _bfd_write_archive_contents (bfd *arch) } } - for (current = arch->archive_head; current; current = current->next) + for (current = arch->archive_head; + current != NULL; + current = current->archive_next) { char buffer[DEFAULT_BUFFERSIZE]; unsigned int remaining = arelt_size (current); @@ -1719,7 +1723,7 @@ _bfd_write_archive_contents (bfd *arch) != sizeof (*hdr)) return FALSE; if (bfd_seek (current, (file_ptr) 0, SEEK_SET) != 0) - return FALSE; + goto input_err; while (remaining) { unsigned int amt = DEFAULT_BUFFERSIZE; @@ -1729,8 +1733,8 @@ _bfd_write_archive_contents (bfd *arch) if (bfd_bread (buffer, amt, current) != amt) { if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_malformed_archive); - return FALSE; + bfd_set_error (bfd_error_file_truncated); + goto input_err; } if (bfd_bwrite (buffer, amt, arch) != amt) return FALSE; @@ -1763,6 +1767,10 @@ _bfd_write_archive_contents (bfd *arch) } return TRUE; + + input_err: + bfd_set_error (bfd_error_on_input, current, bfd_get_error ()); + return FALSE; } /* Note that the namidx for the first symbol is 0. */ @@ -1801,12 +1809,12 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength) /* Drop all the files called __.SYMDEF, we're going to make our own. */ while (arch->archive_head && strcmp (arch->archive_head->filename, "__.SYMDEF") == 0) - arch->archive_head = arch->archive_head->next; + arch->archive_head = arch->archive_head->archive_next; /* Map over each element. */ for (current = arch->archive_head; current != NULL; - current = current->next, elt_no++) + current = current->archive_next, elt_no++) { if (bfd_check_format (current, bfd_object) && (bfd_get_file_flags (current) & HAS_SYMS) != 0) @@ -1963,7 +1971,7 @@ bsd_write_armap (bfd *arch, { firstreal += arelt_size (current) + sizeof (struct ar_hdr); firstreal += firstreal % 2; - current = current->next; + current = current->archive_next; } while (current != map[count].u.abfd); } @@ -2133,7 +2141,7 @@ coff_write_armap (bfd *arch, archive_member_file_ptr += arelt_size (current) + sizeof (struct ar_hdr); /* Remember aboout the even alignment. */ archive_member_file_ptr += archive_member_file_ptr % 2; - current = current->next; + current = current->archive_next; } /* Now write the strings themselves. */ diff --git a/contrib/binutils/bfd/archive64.c b/contrib/binutils/bfd/archive64.c index 3b28f853c216..5e2bf1198c20 100644 --- a/contrib/binutils/bfd/archive64.c +++ b/contrib/binutils/bfd/archive64.c @@ -1,30 +1,30 @@ /* MIPS-specific support for 64-bit ELF - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2006, 2007 Free Software Foundation, Inc. Ian Lance Taylor, Cygnus Support Linker support added by Mark Mitchell, CodeSourcery, LLC. <mark@codesourcery.com> -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This file supports the 64-bit (MIPS) ELF archives. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "aout/ar.h" @@ -65,10 +65,10 @@ bfd_elf64_archive_slurp_armap (bfd *abfd) return FALSE; /* Archives with traditional armaps are still permitted. */ - if (strncmp (nextname, "/ ", 16) == 0) + if (CONST_STRNEQ (nextname, "/ ")) return bfd_slurp_armap (abfd); - if (strncmp (nextname, "/SYM64/ ", 16) != 0) + if (! CONST_STRNEQ (nextname, "/SYM64/ ")) { bfd_has_map (abfd) = FALSE; return TRUE; @@ -215,7 +215,7 @@ bfd_elf64_archive_write_armap (bfd *arch, + sizeof (struct ar_hdr)); /* remember about the even alignment */ archive_member_file_ptr += archive_member_file_ptr % 2; - current = current->next; + current = current->archive_next; } /* now write the strings themselves */ diff --git a/contrib/binutils/bfd/archures.c b/contrib/binutils/bfd/archures.c index 137c8285806b..d14ac3898bbe 100644 --- a/contrib/binutils/bfd/archures.c +++ b/contrib/binutils/bfd/archures.c @@ -1,6 +1,6 @@ /* BFD library support routines for architectures. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Hacked by John Gilmore and Steve Chamberlain of Cygnus Support. @@ -20,8 +20,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "safe-ctype.h" @@ -80,22 +80,26 @@ DESCRIPTION .#define bfd_mach_m68040 6 .#define bfd_mach_m68060 7 .#define bfd_mach_cpu32 8 -.#define bfd_mach_mcf_isa_a_nodiv 9 -.#define bfd_mach_mcf_isa_a 10 -.#define bfd_mach_mcf_isa_a_mac 11 -.#define bfd_mach_mcf_isa_a_emac 12 -.#define bfd_mach_mcf_isa_aplus 13 -.#define bfd_mach_mcf_isa_aplus_mac 14 -.#define bfd_mach_mcf_isa_aplus_emac 15 -.#define bfd_mach_mcf_isa_b_nousp 16 -.#define bfd_mach_mcf_isa_b_nousp_mac 17 -.#define bfd_mach_mcf_isa_b_nousp_emac 18 -.#define bfd_mach_mcf_isa_b 19 -.#define bfd_mach_mcf_isa_b_mac 20 -.#define bfd_mach_mcf_isa_b_emac 21 -.#define bfd_mach_mcf_isa_b_float 22 -.#define bfd_mach_mcf_isa_b_float_mac 23 -.#define bfd_mach_mcf_isa_b_float_emac 24 +.#define bfd_mach_fido 9 +.#define bfd_mach_mcf_isa_a_nodiv 10 +.#define bfd_mach_mcf_isa_a 11 +.#define bfd_mach_mcf_isa_a_mac 12 +.#define bfd_mach_mcf_isa_a_emac 13 +.#define bfd_mach_mcf_isa_aplus 14 +.#define bfd_mach_mcf_isa_aplus_mac 15 +.#define bfd_mach_mcf_isa_aplus_emac 16 +.#define bfd_mach_mcf_isa_b_nousp 17 +.#define bfd_mach_mcf_isa_b_nousp_mac 18 +.#define bfd_mach_mcf_isa_b_nousp_emac 19 +.#define bfd_mach_mcf_isa_b 20 +.#define bfd_mach_mcf_isa_b_mac 21 +.#define bfd_mach_mcf_isa_b_emac 22 +.#define bfd_mach_mcf_isa_b_float 23 +.#define bfd_mach_mcf_isa_b_float_mac 24 +.#define bfd_mach_mcf_isa_b_float_emac 25 +.#define bfd_mach_mcf_isa_c 26 +.#define bfd_mach_mcf_isa_c_mac 27 +.#define bfd_mach_mcf_isa_c_emac 28 . bfd_arch_vax, {* DEC Vax *} . bfd_arch_i960, {* Intel 960 *} . {* The order of the following is important. @@ -136,6 +140,8 @@ DESCRIPTION .{* Nonzero if MACH is a 64 bit sparc architecture. *} .#define bfd_mach_sparc_64bit_p(mach) \ . ((mach) >= bfd_mach_sparc_v9 && (mach) != bfd_mach_sparc_v8plusb) +. bfd_arch_spu, {* PowerPC SPU *} +.#define bfd_mach_spu 256 . bfd_arch_mips, {* MIPS Rxxxx *} .#define bfd_mach_mips3000 3000 .#define bfd_mach_mips3900 3900 @@ -274,6 +280,7 @@ DESCRIPTION .#define bfd_mach_arm_XScale 10 .#define bfd_mach_arm_ep9312 11 .#define bfd_mach_arm_iWMMXt 12 +.#define bfd_mach_arm_iWMMXt2 13 . bfd_arch_ns32k, {* National Semiconductors ns32000 *} . bfd_arch_w65, {* WDC 65816 *} . bfd_arch_tic30, {* Texas Instruments TMS320C30 *} @@ -315,6 +322,9 @@ DESCRIPTION .#define bfd_mach_fr500 500 .#define bfd_mach_fr550 550 . bfd_arch_mcore, +. bfd_arch_mep, +.#define bfd_mach_mep 1 +.#define bfd_mach_mep_h1 0x6831 . bfd_arch_ia64, {* HP/Intel ia64 *} .#define bfd_mach_ia64_elf64 64 .#define bfd_mach_ia64_elf32 32 @@ -335,8 +345,11 @@ DESCRIPTION .#define bfd_mach_avr3 3 .#define bfd_mach_avr4 4 .#define bfd_mach_avr5 5 +.#define bfd_mach_avr6 6 . bfd_arch_bfin, {* ADI Blackfin *} .#define bfd_mach_bfin 1 +. bfd_arch_cr16, {* National Semiconductor CompactRISC (ie CR16). *} +.#define bfd_mach_cr16 1 . bfd_arch_cr16c, {* National Semiconductor CompactRISC. *} .#define bfd_mach_cr16c 1 . bfd_arch_crx, {* National Semiconductor CRX. *} @@ -348,6 +361,7 @@ DESCRIPTION . bfd_arch_s390, {* IBM s390 *} .#define bfd_mach_s390_31 31 .#define bfd_mach_s390_64 64 +. bfd_arch_score, {* Sunplus score *} . bfd_arch_openrisc, {* OpenRISC *} . bfd_arch_mmix, {* Donald Knuth's educational processor. *} . bfd_arch_xstormy16, @@ -425,6 +439,7 @@ extern const bfd_arch_info_type bfd_arc_arch; extern const bfd_arch_info_type bfd_arm_arch; extern const bfd_arch_info_type bfd_avr_arch; extern const bfd_arch_info_type bfd_bfin_arch; +extern const bfd_arch_info_type bfd_cr16_arch; extern const bfd_arch_info_type bfd_cr16c_arch; extern const bfd_arch_info_type bfd_cris_arch; extern const bfd_arch_info_type bfd_crx_arch; @@ -451,6 +466,7 @@ extern const bfd_arch_info_type bfd_m68k_arch; extern const bfd_arch_info_type bfd_m88k_arch; extern const bfd_arch_info_type bfd_maxq_arch; extern const bfd_arch_info_type bfd_mcore_arch; +extern const bfd_arch_info_type bfd_mep_arch; extern const bfd_arch_info_type bfd_mips_arch; extern const bfd_arch_info_type bfd_mmix_arch; extern const bfd_arch_info_type bfd_mn10200_arch; @@ -466,8 +482,10 @@ extern const bfd_arch_info_type bfd_powerpc_archs[]; #define bfd_powerpc_arch bfd_powerpc_archs[0] extern const bfd_arch_info_type bfd_rs6000_arch; extern const bfd_arch_info_type bfd_s390_arch; +extern const bfd_arch_info_type bfd_score_arch; extern const bfd_arch_info_type bfd_sh_arch; extern const bfd_arch_info_type bfd_sparc_arch; +extern const bfd_arch_info_type bfd_spu_arch; extern const bfd_arch_info_type bfd_tic30_arch; extern const bfd_arch_info_type bfd_tic4x_arch; extern const bfd_arch_info_type bfd_tic54x_arch; @@ -492,6 +510,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] = &bfd_arm_arch, &bfd_avr_arch, &bfd_bfin_arch, + &bfd_cr16_arch, &bfd_cr16c_arch, &bfd_cris_arch, &bfd_crx_arch, @@ -518,6 +537,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] = &bfd_m88k_arch, &bfd_maxq_arch, &bfd_mcore_arch, + &bfd_mep_arch, &bfd_mips_arch, &bfd_mmix_arch, &bfd_mn10200_arch, @@ -531,8 +551,10 @@ static const bfd_arch_info_type * const bfd_archures_list[] = &bfd_powerpc_arch, &bfd_rs6000_arch, &bfd_s390_arch, + &bfd_score_arch, &bfd_sh_arch, &bfd_sparc_arch, + &bfd_spu_arch, &bfd_tic30_arch, &bfd_tic4x_arch, &bfd_tic54x_arch, diff --git a/contrib/binutils/bfd/bfd-in.h b/contrib/binutils/bfd/bfd-in.h index 33b649d05855..617aa07ec550 100644 --- a/contrib/binutils/bfd/bfd-in.h +++ b/contrib/binutils/bfd/bfd-in.h @@ -1,7 +1,7 @@ /* Main header file for the bfd library -- portable access to object files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Contributed by Cygnus Support. @@ -43,6 +43,30 @@ extern "C" { #endif #endif +/* This is a utility macro to handle the situation where the code + wants to place a constant string into the code, followed by a + comma and then the length of the string. Doing this by hand + is error prone, so using this macro is safer. The macro will + also safely handle the case where a NULL is passed as the arg. */ +#define STRING_COMMA_LEN(STR) (STR), ((STR) ? sizeof (STR) - 1 : 0) +/* Unfortunately it is not possible to use the STRING_COMMA_LEN macro + to create the arguments to another macro, since the preprocessor + will mis-count the number of arguments to the outer macro (by not + evaluating STRING_COMMA_LEN and so missing the comma). This is a + problem for example when trying to use STRING_COMMA_LEN to build + the arguments to the strncmp() macro. Hence this alternative + definition of strncmp is provided here. + + Note - these macros do NOT work if STR2 is not a constant string. */ +#define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0) + /* strcpy() can have a similar problem, but since we know we are + copying a constant string, we can use memcpy which will be faster + since there is no need to check for a NUL byte inside STR. We + can also save time if we do not need to copy the terminating NUL. */ +#define LITMEMCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2) - 1) +#define LITSTRCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2)) + + /* The word size used by BFD on the host. This may be 64 with a 32 bit target if the host is 64 bit, or if other 64 bit targets have been selected with --enable-targets, or if --enable-64-bit-bfd. */ @@ -326,7 +350,15 @@ typedef struct bfd_section *sec_ptr; (((sec)->rawsize ? (sec)->rawsize : (sec)->size) \ / bfd_octets_per_byte (bfd)) -typedef struct stat stat_type; +/* Return TRUE if section has been discarded. */ +#define elf_discarded_section(sec) \ + (!bfd_is_abs_section (sec) \ + && bfd_is_abs_section ((sec)->output_section) \ + && (sec)->sec_info_type != ELF_INFO_TYPE_MERGE \ + && (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS) + +/* Forward define. */ +struct stat; typedef enum bfd_print_symbol { @@ -374,10 +406,6 @@ struct bfd_hash_table { /* The hash array. */ struct bfd_hash_entry **table; - /* The number of slots in the hash table. */ - unsigned int size; - /* The size of elements. */ - unsigned int entsize; /* A function used to create new elements in the hash table. The first entry is itself a pointer to an element. When this function is first invoked, this pointer will be NULL. However, @@ -390,6 +418,14 @@ struct bfd_hash_table /* An objalloc for this hash table. This is a struct objalloc *, but we use void * to avoid requiring the inclusion of objalloc.h. */ void *memory; + /* The number of slots in the hash table. */ + unsigned int size; + /* The number of entries in the hash table. */ + unsigned int count; + /* The size of elements. */ + unsigned int entsize; + /* If non-zero, don't grow the hash table. */ + unsigned int frozen:1; }; /* Initialize a hash table. */ @@ -660,7 +696,7 @@ extern void bfd_elf_set_dt_needed_name extern const char *bfd_elf_get_dt_soname (bfd *); extern void bfd_elf_set_dyn_lib_class - (bfd *, int); + (bfd *, enum dynamic_lib_link_class); extern int bfd_elf_get_dyn_lib_class (bfd *); extern struct bfd_link_needed_list *bfd_elf_get_runpath_list @@ -817,6 +853,27 @@ extern bfd_boolean bfd_coff_set_symbol_class extern bfd_boolean bfd_m68k_coff_create_embedded_relocs (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); +/* ARM VFP11 erratum workaround support. */ +typedef enum +{ + BFD_ARM_VFP11_FIX_DEFAULT, + BFD_ARM_VFP11_FIX_NONE, + BFD_ARM_VFP11_FIX_SCALAR, + BFD_ARM_VFP11_FIX_VECTOR +} bfd_arm_vfp11_fix; + +extern void bfd_elf32_arm_init_maps + (bfd *); + +extern void bfd_elf32_arm_set_vfp11_fix + (bfd *, struct bfd_link_info *); + +extern bfd_boolean bfd_elf32_arm_vfp11_erratum_scan + (bfd *, struct bfd_link_info *); + +extern void bfd_elf32_arm_vfp11_fix_veneer_locations + (bfd *, struct bfd_link_info *); + /* ARM Interworking support. Called from linker. */ extern bfd_boolean bfd_arm_allocate_interworking_sections (struct bfd_link_info *); @@ -842,10 +899,11 @@ extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections (struct bfd_link_info *); extern bfd_boolean bfd_elf32_arm_process_before_allocation - (bfd *, struct bfd_link_info *, int); + (bfd *, struct bfd_link_info *); void bfd_elf32_arm_set_target_relocs - (struct bfd_link_info *, int, char *, int, int); + (bfd *, struct bfd_link_info *, int, char *, int, int, bfd_arm_vfp11_fix, + int, int); extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking (bfd *, struct bfd_link_info *); @@ -854,8 +912,14 @@ extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd (bfd *, struct bfd_link_info *); /* ELF ARM mapping symbol support */ -extern bfd_boolean bfd_is_arm_mapping_symbol_name - (const char * name); +#define BFD_ARM_SPECIAL_SYM_TYPE_MAP (1 << 0) +#define BFD_ARM_SPECIAL_SYM_TYPE_TAG (1 << 1) +#define BFD_ARM_SPECIAL_SYM_TYPE_OTHER (1 << 2) +#define BFD_ARM_SPECIAL_SYM_TYPE_ANY (~0) +extern bfd_boolean bfd_is_arm_special_symbol_name + (const char * name, int type); + +extern void bfd_elf32_arm_set_byteswap_code (struct bfd_link_info *, int); /* ARM Note section processing. */ extern bfd_boolean bfd_arm_merge_machines diff --git a/contrib/binutils/bfd/bfd-in2.h b/contrib/binutils/bfd/bfd-in2.h index ddcda2377df6..8ea1cdd3b188 100644 --- a/contrib/binutils/bfd/bfd-in2.h +++ b/contrib/binutils/bfd/bfd-in2.h @@ -8,7 +8,7 @@ /* Main header file for the bfd library -- portable access to object files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Contributed by Cygnus Support. @@ -50,6 +50,30 @@ extern "C" { #endif #endif +/* This is a utility macro to handle the situation where the code + wants to place a constant string into the code, followed by a + comma and then the length of the string. Doing this by hand + is error prone, so using this macro is safer. The macro will + also safely handle the case where a NULL is passed as the arg. */ +#define STRING_COMMA_LEN(STR) (STR), ((STR) ? sizeof (STR) - 1 : 0) +/* Unfortunately it is not possible to use the STRING_COMMA_LEN macro + to create the arguments to another macro, since the preprocessor + will mis-count the number of arguments to the outer macro (by not + evaluating STRING_COMMA_LEN and so missing the comma). This is a + problem for example when trying to use STRING_COMMA_LEN to build + the arguments to the strncmp() macro. Hence this alternative + definition of strncmp is provided here. + + Note - these macros do NOT work if STR2 is not a constant string. */ +#define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0) + /* strcpy() can have a similar problem, but since we know we are + copying a constant string, we can use memcpy which will be faster + since there is no need to check for a NUL byte inside STR. We + can also save time if we do not need to copy the terminating NUL. */ +#define LITMEMCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2) - 1) +#define LITSTRCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2)) + + /* The word size used by BFD on the host. This may be 64 with a 32 bit target if the host is 64 bit, or if other 64 bit targets have been selected with --enable-targets, or if --enable-64-bit-bfd. */ @@ -333,7 +357,15 @@ typedef struct bfd_section *sec_ptr; (((sec)->rawsize ? (sec)->rawsize : (sec)->size) \ / bfd_octets_per_byte (bfd)) -typedef struct stat stat_type; +/* Return TRUE if section has been discarded. */ +#define elf_discarded_section(sec) \ + (!bfd_is_abs_section (sec) \ + && bfd_is_abs_section ((sec)->output_section) \ + && (sec)->sec_info_type != ELF_INFO_TYPE_MERGE \ + && (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS) + +/* Forward define. */ +struct stat; typedef enum bfd_print_symbol { @@ -381,10 +413,6 @@ struct bfd_hash_table { /* The hash array. */ struct bfd_hash_entry **table; - /* The number of slots in the hash table. */ - unsigned int size; - /* The size of elements. */ - unsigned int entsize; /* A function used to create new elements in the hash table. The first entry is itself a pointer to an element. When this function is first invoked, this pointer will be NULL. However, @@ -397,6 +425,14 @@ struct bfd_hash_table /* An objalloc for this hash table. This is a struct objalloc *, but we use void * to avoid requiring the inclusion of objalloc.h. */ void *memory; + /* The number of slots in the hash table. */ + unsigned int size; + /* The number of entries in the hash table. */ + unsigned int count; + /* The size of elements. */ + unsigned int entsize; + /* If non-zero, don't grow the hash table. */ + unsigned int frozen:1; }; /* Initialize a hash table. */ @@ -667,7 +703,7 @@ extern void bfd_elf_set_dt_needed_name extern const char *bfd_elf_get_dt_soname (bfd *); extern void bfd_elf_set_dyn_lib_class - (bfd *, int); + (bfd *, enum dynamic_lib_link_class); extern int bfd_elf_get_dyn_lib_class (bfd *); extern struct bfd_link_needed_list *bfd_elf_get_runpath_list @@ -824,6 +860,27 @@ extern bfd_boolean bfd_coff_set_symbol_class extern bfd_boolean bfd_m68k_coff_create_embedded_relocs (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); +/* ARM VFP11 erratum workaround support. */ +typedef enum +{ + BFD_ARM_VFP11_FIX_DEFAULT, + BFD_ARM_VFP11_FIX_NONE, + BFD_ARM_VFP11_FIX_SCALAR, + BFD_ARM_VFP11_FIX_VECTOR +} bfd_arm_vfp11_fix; + +extern void bfd_elf32_arm_init_maps + (bfd *); + +extern void bfd_elf32_arm_set_vfp11_fix + (bfd *, struct bfd_link_info *); + +extern bfd_boolean bfd_elf32_arm_vfp11_erratum_scan + (bfd *, struct bfd_link_info *); + +extern void bfd_elf32_arm_vfp11_fix_veneer_locations + (bfd *, struct bfd_link_info *); + /* ARM Interworking support. Called from linker. */ extern bfd_boolean bfd_arm_allocate_interworking_sections (struct bfd_link_info *); @@ -849,10 +906,11 @@ extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections (struct bfd_link_info *); extern bfd_boolean bfd_elf32_arm_process_before_allocation - (bfd *, struct bfd_link_info *, int); + (bfd *, struct bfd_link_info *); void bfd_elf32_arm_set_target_relocs - (struct bfd_link_info *, int, char *, int, int); + (bfd *, struct bfd_link_info *, int, char *, int, int, bfd_arm_vfp11_fix, + int, int); extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking (bfd *, struct bfd_link_info *); @@ -861,8 +919,14 @@ extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd (bfd *, struct bfd_link_info *); /* ELF ARM mapping symbol support */ -extern bfd_boolean bfd_is_arm_mapping_symbol_name - (const char * name); +#define BFD_ARM_SPECIAL_SYM_TYPE_MAP (1 << 0) +#define BFD_ARM_SPECIAL_SYM_TYPE_TAG (1 << 1) +#define BFD_ARM_SPECIAL_SYM_TYPE_OTHER (1 << 2) +#define BFD_ARM_SPECIAL_SYM_TYPE_ANY (~0) +extern bfd_boolean bfd_is_arm_special_symbol_name + (const char * name, int type); + +extern void bfd_elf32_arm_set_byteswap_code (struct bfd_link_info *, int); /* ARM Note section processing. */ extern bfd_boolean bfd_arm_merge_machines @@ -935,7 +999,10 @@ bfd *bfd_openr_iovec (const char *filename, const char *target, file_ptr nbytes, file_ptr offset), int (*close) (struct bfd *nbfd, - void *stream)); + void *stream), + int (*stat) (struct bfd *abfd, + void *stream, + struct stat *sb)); bfd *bfd_openw (const char *filename, const char *target); @@ -1076,7 +1143,7 @@ bfd_boolean bfd_fill_in_gnu_debuglink_section /* Extracted from bfdio.c. */ long bfd_get_mtime (bfd *abfd); -long bfd_get_size (bfd *abfd); +file_ptr bfd_get_size (bfd *abfd); /* Extracted from bfdwin.c. */ /* Extracted from section.c. */ @@ -1225,7 +1292,9 @@ typedef struct bfd_section else up the line will take care of it later. */ #define SEC_LINKER_CREATED 0x200000 - /* This section should not be subject to garbage collection. */ + /* This section should not be subject to garbage collection. + Also set to inform the linker that this section should not be + listed in the link map as discarded. */ #define SEC_KEEP 0x400000 /* This section contains "short" data, and should be placed @@ -1471,11 +1540,6 @@ extern asection bfd_ind_section; || ((SEC) == bfd_com_section_ptr) \ || ((SEC) == bfd_ind_section_ptr)) -extern const struct bfd_symbol * const bfd_abs_symbol; -extern const struct bfd_symbol * const bfd_com_symbol; -extern const struct bfd_symbol * const bfd_und_symbol; -extern const struct bfd_symbol * const bfd_ind_symbol; - /* Macros to handle insertion and deletion of a bfd's sections. These only handle the list pointers, ie. do not adjust section_count, target_index etc. */ @@ -1566,7 +1630,7 @@ extern const struct bfd_symbol * const bfd_ind_symbol; #define bfd_section_removed_from_list(ABFD, S) \ ((S)->next == NULL ? (ABFD)->section_last != (S) : (S)->next->prev != (S)) -#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, SYM_PTR, NAME, IDX) \ +#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, NAME, IDX) \ /* name, id, index, next, prev, flags, user_set_vma, */ \ { NAME, IDX, 0, NULL, NULL, FLAGS, 0, \ \ @@ -1597,11 +1661,8 @@ extern const struct bfd_symbol * const bfd_ind_symbol; /* target_index, used_by_bfd, constructor_chain, owner, */ \ 0, NULL, NULL, NULL, \ \ - /* symbol, */ \ - (struct bfd_symbol *) SYM, \ - \ - /* symbol_ptr_ptr, */ \ - (struct bfd_symbol **) SYM_PTR, \ + /* symbol, symbol_ptr_ptr, */ \ + (struct bfd_symbol *) SYM, &SEC.symbol, \ \ /* map_head, map_tail */ \ { NULL }, { NULL } \ @@ -1683,22 +1744,26 @@ enum bfd_architecture #define bfd_mach_m68040 6 #define bfd_mach_m68060 7 #define bfd_mach_cpu32 8 -#define bfd_mach_mcf_isa_a_nodiv 9 -#define bfd_mach_mcf_isa_a 10 -#define bfd_mach_mcf_isa_a_mac 11 -#define bfd_mach_mcf_isa_a_emac 12 -#define bfd_mach_mcf_isa_aplus 13 -#define bfd_mach_mcf_isa_aplus_mac 14 -#define bfd_mach_mcf_isa_aplus_emac 15 -#define bfd_mach_mcf_isa_b_nousp 16 -#define bfd_mach_mcf_isa_b_nousp_mac 17 -#define bfd_mach_mcf_isa_b_nousp_emac 18 -#define bfd_mach_mcf_isa_b 19 -#define bfd_mach_mcf_isa_b_mac 20 -#define bfd_mach_mcf_isa_b_emac 21 -#define bfd_mach_mcf_isa_b_float 22 -#define bfd_mach_mcf_isa_b_float_mac 23 -#define bfd_mach_mcf_isa_b_float_emac 24 +#define bfd_mach_fido 9 +#define bfd_mach_mcf_isa_a_nodiv 10 +#define bfd_mach_mcf_isa_a 11 +#define bfd_mach_mcf_isa_a_mac 12 +#define bfd_mach_mcf_isa_a_emac 13 +#define bfd_mach_mcf_isa_aplus 14 +#define bfd_mach_mcf_isa_aplus_mac 15 +#define bfd_mach_mcf_isa_aplus_emac 16 +#define bfd_mach_mcf_isa_b_nousp 17 +#define bfd_mach_mcf_isa_b_nousp_mac 18 +#define bfd_mach_mcf_isa_b_nousp_emac 19 +#define bfd_mach_mcf_isa_b 20 +#define bfd_mach_mcf_isa_b_mac 21 +#define bfd_mach_mcf_isa_b_emac 22 +#define bfd_mach_mcf_isa_b_float 23 +#define bfd_mach_mcf_isa_b_float_mac 24 +#define bfd_mach_mcf_isa_b_float_emac 25 +#define bfd_mach_mcf_isa_c 26 +#define bfd_mach_mcf_isa_c_mac 27 +#define bfd_mach_mcf_isa_c_emac 28 bfd_arch_vax, /* DEC Vax */ bfd_arch_i960, /* Intel 960 */ /* The order of the following is important. @@ -1739,6 +1804,8 @@ enum bfd_architecture /* Nonzero if MACH is a 64 bit sparc architecture. */ #define bfd_mach_sparc_64bit_p(mach) \ ((mach) >= bfd_mach_sparc_v9 && (mach) != bfd_mach_sparc_v8plusb) + bfd_arch_spu, /* PowerPC SPU */ +#define bfd_mach_spu 256 bfd_arch_mips, /* MIPS Rxxxx */ #define bfd_mach_mips3000 3000 #define bfd_mach_mips3900 3900 @@ -1876,6 +1943,7 @@ enum bfd_architecture #define bfd_mach_arm_XScale 10 #define bfd_mach_arm_ep9312 11 #define bfd_mach_arm_iWMMXt 12 +#define bfd_mach_arm_iWMMXt2 13 bfd_arch_ns32k, /* National Semiconductors ns32000 */ bfd_arch_w65, /* WDC 65816 */ bfd_arch_tic30, /* Texas Instruments TMS320C30 */ @@ -1917,6 +1985,9 @@ enum bfd_architecture #define bfd_mach_fr500 500 #define bfd_mach_fr550 550 bfd_arch_mcore, + bfd_arch_mep, +#define bfd_mach_mep 1 +#define bfd_mach_mep_h1 0x6831 bfd_arch_ia64, /* HP/Intel ia64 */ #define bfd_mach_ia64_elf64 64 #define bfd_mach_ia64_elf32 32 @@ -1937,8 +2008,11 @@ enum bfd_architecture #define bfd_mach_avr3 3 #define bfd_mach_avr4 4 #define bfd_mach_avr5 5 +#define bfd_mach_avr6 6 bfd_arch_bfin, /* ADI Blackfin */ #define bfd_mach_bfin 1 + bfd_arch_cr16, /* National Semiconductor CompactRISC (ie CR16). */ +#define bfd_mach_cr16 1 bfd_arch_cr16c, /* National Semiconductor CompactRISC. */ #define bfd_mach_cr16c 1 bfd_arch_crx, /* National Semiconductor CRX. */ @@ -1950,6 +2024,7 @@ enum bfd_architecture bfd_arch_s390, /* IBM s390 */ #define bfd_mach_s390_31 31 #define bfd_mach_s390_64 64 + bfd_arch_score, /* Sunplus score */ bfd_arch_openrisc, /* OpenRISC */ bfd_arch_mmix, /* Donald Knuth's educational processor. */ bfd_arch_xstormy16, @@ -2427,6 +2502,22 @@ relocation types already defined. */ BFD_RELOC_SPARC_TLS_TPOFF32, BFD_RELOC_SPARC_TLS_TPOFF64, +/* SPU Relocations. */ + BFD_RELOC_SPU_IMM7, + BFD_RELOC_SPU_IMM8, + BFD_RELOC_SPU_IMM10, + BFD_RELOC_SPU_IMM10W, + BFD_RELOC_SPU_IMM16, + BFD_RELOC_SPU_IMM16W, + BFD_RELOC_SPU_IMM18, + BFD_RELOC_SPU_PCREL9a, + BFD_RELOC_SPU_PCREL9b, + BFD_RELOC_SPU_PCREL16, + BFD_RELOC_SPU_LO16, + BFD_RELOC_SPU_HI16, + BFD_RELOC_SPU_PPU32, + BFD_RELOC_SPU_PPU64, + /* Alpha ECOFF and ELF relocations. Some of these treat the symbol or "addend" in some special way. For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when @@ -2909,6 +3000,16 @@ pc-relative or some form of GOT-indirect relocation. */ /* 31-bit PC relative address. */ BFD_RELOC_ARM_PREL31, +/* Low and High halfword relocations for MOVW and MOVT instructions. */ + BFD_RELOC_ARM_MOVW, + BFD_RELOC_ARM_MOVT, + BFD_RELOC_ARM_MOVW_PCREL, + BFD_RELOC_ARM_MOVT_PCREL, + BFD_RELOC_ARM_THUMB_MOVW, + BFD_RELOC_ARM_THUMB_MOVT, + BFD_RELOC_ARM_THUMB_MOVW_PCREL, + BFD_RELOC_ARM_THUMB_MOVT_PCREL, + /* Relocations for setting up GOTs and PLTs for shared libraries. */ BFD_RELOC_ARM_JUMP_SLOT, BFD_RELOC_ARM_GLOB_DAT, @@ -2928,11 +3029,42 @@ pc-relative or some form of GOT-indirect relocation. */ BFD_RELOC_ARM_TLS_IE32, BFD_RELOC_ARM_TLS_LE32, +/* ARM group relocations. */ + BFD_RELOC_ARM_ALU_PC_G0_NC, + BFD_RELOC_ARM_ALU_PC_G0, + BFD_RELOC_ARM_ALU_PC_G1_NC, + BFD_RELOC_ARM_ALU_PC_G1, + BFD_RELOC_ARM_ALU_PC_G2, + BFD_RELOC_ARM_LDR_PC_G0, + BFD_RELOC_ARM_LDR_PC_G1, + BFD_RELOC_ARM_LDR_PC_G2, + BFD_RELOC_ARM_LDRS_PC_G0, + BFD_RELOC_ARM_LDRS_PC_G1, + BFD_RELOC_ARM_LDRS_PC_G2, + BFD_RELOC_ARM_LDC_PC_G0, + BFD_RELOC_ARM_LDC_PC_G1, + BFD_RELOC_ARM_LDC_PC_G2, + BFD_RELOC_ARM_ALU_SB_G0_NC, + BFD_RELOC_ARM_ALU_SB_G0, + BFD_RELOC_ARM_ALU_SB_G1_NC, + BFD_RELOC_ARM_ALU_SB_G1, + BFD_RELOC_ARM_ALU_SB_G2, + BFD_RELOC_ARM_LDR_SB_G0, + BFD_RELOC_ARM_LDR_SB_G1, + BFD_RELOC_ARM_LDR_SB_G2, + BFD_RELOC_ARM_LDRS_SB_G0, + BFD_RELOC_ARM_LDRS_SB_G1, + BFD_RELOC_ARM_LDRS_SB_G2, + BFD_RELOC_ARM_LDC_SB_G0, + BFD_RELOC_ARM_LDC_SB_G1, + BFD_RELOC_ARM_LDC_SB_G2, + /* These relocs are only used within the ARM assembler. They are not (at present) written to any object files. */ BFD_RELOC_ARM_IMMEDIATE, BFD_RELOC_ARM_ADRL_IMMEDIATE, BFD_RELOC_ARM_T32_IMMEDIATE, + BFD_RELOC_ARM_T32_ADD_IMM, BFD_RELOC_ARM_T32_IMM12, BFD_RELOC_ARM_T32_ADD_PC12, BFD_RELOC_ARM_SHIFT_IMM, @@ -3446,6 +3578,29 @@ short offset into 11 bits. */ BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2, BFD_RELOC_MCORE_RVA, +/* Toshiba Media Processor Relocations. */ + BFD_RELOC_MEP_8, + BFD_RELOC_MEP_16, + BFD_RELOC_MEP_32, + BFD_RELOC_MEP_PCREL8A2, + BFD_RELOC_MEP_PCREL12A2, + BFD_RELOC_MEP_PCREL17A2, + BFD_RELOC_MEP_PCREL24A2, + BFD_RELOC_MEP_PCABS24A2, + BFD_RELOC_MEP_LOW16, + BFD_RELOC_MEP_HI16U, + BFD_RELOC_MEP_HI16S, + BFD_RELOC_MEP_GPREL, + BFD_RELOC_MEP_TPREL, + BFD_RELOC_MEP_TPREL7, + BFD_RELOC_MEP_TPREL7A2, + BFD_RELOC_MEP_TPREL7A4, + BFD_RELOC_MEP_UIMM24, + BFD_RELOC_MEP_ADDR24A4, + BFD_RELOC_MEP_GNU_VTINHERIT, + BFD_RELOC_MEP_GNU_VTENTRY, + + /* These are relocations for the GETA instruction. */ BFD_RELOC_MMIX_GETA, BFD_RELOC_MMIX_GETA_1, @@ -3545,10 +3700,22 @@ of 32 bit value) into 8 bit immediate value of LDI insn. */ command address) into 8 bit immediate value of LDI insn. */ BFD_RELOC_AVR_LO8_LDI_PM, +/* This is a 16 bit reloc for the AVR that stores 8 bit value +(command address) into 8 bit immediate value of LDI insn. If the address +is beyond the 128k boundary, the linker inserts a jump stub for this reloc +in the lower 128k. */ + BFD_RELOC_AVR_LO8_LDI_GS, + /* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit of command address) into 8 bit immediate value of LDI insn. */ BFD_RELOC_AVR_HI8_LDI_PM, +/* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit +of command address) into 8 bit immediate value of LDI insn. If the address +is beyond the 128k boundary, the linker inserts a jump stub for this reloc +below 128k. */ + BFD_RELOC_AVR_HI8_LDI_GS, + /* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit of command address) into 8 bit immediate value of LDI insn. */ BFD_RELOC_AVR_HH8_LDI_PM, @@ -3689,6 +3856,31 @@ instructions */ BFD_RELOC_390_GOTPLT20, BFD_RELOC_390_TLS_GOTIE20, +/* Score relocations */ + BFD_RELOC_SCORE_DUMMY1, + +/* Low 16 bit for load/store */ + BFD_RELOC_SCORE_GPREL15, + +/* This is a 24-bit reloc with the right 1 bit assumed to be 0 */ + BFD_RELOC_SCORE_DUMMY2, + BFD_RELOC_SCORE_JMP, + +/* This is a 19-bit reloc with the right 1 bit assumed to be 0 */ + BFD_RELOC_SCORE_BRANCH, + +/* This is a 11-bit reloc with the right 1 bit assumed to be 0 */ + BFD_RELOC_SCORE16_JMP, + +/* This is a 8-bit reloc with the right 1 bit assumed to be 0 */ + BFD_RELOC_SCORE16_BRANCH, + +/* Undocumented Score relocs */ + BFD_RELOC_SCORE_GOT15, + BFD_RELOC_SCORE_GOT_LO16, + BFD_RELOC_SCORE_CALL15, + BFD_RELOC_SCORE_DUMMY_HI16, + /* Scenix IP2K - 9-bit register number / data address */ BFD_RELOC_IP2K_FR9, @@ -3913,6 +4105,35 @@ This is the 5 bits of a value. */ BFD_RELOC_16C_IMM32, BFD_RELOC_16C_IMM32_C, +/* NS CR16 Relocations. */ + BFD_RELOC_CR16_NUM8, + BFD_RELOC_CR16_NUM16, + BFD_RELOC_CR16_NUM32, + BFD_RELOC_CR16_NUM32a, + BFD_RELOC_CR16_REGREL0, + BFD_RELOC_CR16_REGREL4, + BFD_RELOC_CR16_REGREL4a, + BFD_RELOC_CR16_REGREL14, + BFD_RELOC_CR16_REGREL14a, + BFD_RELOC_CR16_REGREL16, + BFD_RELOC_CR16_REGREL20, + BFD_RELOC_CR16_REGREL20a, + BFD_RELOC_CR16_ABS20, + BFD_RELOC_CR16_ABS24, + BFD_RELOC_CR16_IMM4, + BFD_RELOC_CR16_IMM8, + BFD_RELOC_CR16_IMM16, + BFD_RELOC_CR16_IMM20, + BFD_RELOC_CR16_IMM24, + BFD_RELOC_CR16_IMM32, + BFD_RELOC_CR16_IMM32a, + BFD_RELOC_CR16_DISP4, + BFD_RELOC_CR16_DISP8, + BFD_RELOC_CR16_DISP16, + BFD_RELOC_CR16_DISP20, + BFD_RELOC_CR16_DISP24, + BFD_RELOC_CR16_DISP24a, + /* NS CRX Relocations. */ BFD_RELOC_CRX_REL4, BFD_RELOC_CRX_REL8, @@ -4026,6 +4247,10 @@ This is the 5 bits of a value. */ BFD_RELOC_XSTORMY16_24, BFD_RELOC_XSTORMY16_FPTR16, +/* Self-describing complex relocations. */ + BFD_RELOC_RELC, + + /* Infineon Relocations. */ BFD_RELOC_XC16X_PAG, BFD_RELOC_XC16X_POF, @@ -4163,6 +4388,8 @@ BFD_RELOC_XTENSA_ASM_EXPAND. */ typedef enum bfd_reloc_code_real bfd_reloc_code_real_type; reloc_howto_type *bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code); +reloc_howto_type *bfd_reloc_name_lookup + (bfd *abfd, const char *reloc_name); const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code); @@ -4275,6 +4502,14 @@ typedef struct bfd_symbol /* This symbol is thread local. Used in ELF. */ #define BSF_THREAD_LOCAL 0x40000 + /* This symbol represents a complex relocation expression, + with the expression tree serialized in the symbol name. */ +#define BSF_RELC 0x80000 + + /* This symbol represents a signed complex relocation expression, + with the expression tree serialized in the symbol name. */ +#define BSF_SRELC 0x100000 + flagword flags; /* A pointer to the section to which this symbol is @@ -4442,7 +4677,7 @@ struct bfd /* Stuff only useful for archives. */ void *arelt_data; struct bfd *my_archive; /* The containing archive BFD. */ - struct bfd *next; /* The next BFD in the archive. */ + struct bfd *archive_next; /* The next BFD in the archive. */ struct bfd *archive_head; /* The first BFD in the archive. */ bfd_boolean has_armap; @@ -4524,13 +4759,14 @@ typedef enum bfd_error bfd_error_bad_value, bfd_error_file_truncated, bfd_error_file_too_big, + bfd_error_on_input, bfd_error_invalid_error_code } bfd_error_type; bfd_error_type bfd_get_error (void); -void bfd_set_error (bfd_error_type error_tag); +void bfd_set_error (bfd_error_type error_tag, ...); const char *bfd_errmsg (bfd_error_type error_tag); @@ -4585,8 +4821,8 @@ bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags); #define bfd_set_private_flags(abfd, flags) \ BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags)) -#define bfd_sizeof_headers(abfd, reloc) \ - BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc)) +#define bfd_sizeof_headers(abfd, info) \ + BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, info)) #define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \ BFD_SEND (abfd, _bfd_find_nearest_line, \ @@ -4694,6 +4930,16 @@ void bfd_preserve_restore (bfd *, struct bfd_preserve *); void bfd_preserve_finish (bfd *, struct bfd_preserve *); +bfd_vma bfd_emul_get_maxpagesize (const char *); + +void bfd_emul_set_maxpagesize (const char *, bfd_vma); + +bfd_vma bfd_emul_get_commonpagesize (const char *); + +void bfd_emul_set_commonpagesize (const char *, bfd_vma); + +char *bfd_demangle (bfd *, const char *, int); + /* Extracted from archive.c. */ symindex bfd_get_next_mapent (bfd *abfd, symindex previous, carsym **sym); @@ -4992,7 +5238,8 @@ typedef struct bfd_target #define BFD_JUMP_TABLE_RELOCS(NAME) \ NAME##_get_reloc_upper_bound, \ NAME##_canonicalize_reloc, \ - NAME##_bfd_reloc_type_lookup + NAME##_bfd_reloc_type_lookup, \ + NAME##_bfd_reloc_name_lookup long (*_get_reloc_upper_bound) (bfd *, sec_ptr); long (*_bfd_canonicalize_reloc) @@ -5000,6 +5247,9 @@ typedef struct bfd_target /* See documentation on reloc types. */ reloc_howto_type * (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); + reloc_howto_type * + (*reloc_name_lookup) (bfd *, const char *); + /* Routines used when writing an object file. */ #define BFD_JUMP_TABLE_WRITE(NAME) \ @@ -5028,7 +5278,7 @@ typedef struct bfd_target NAME##_bfd_discard_group, \ NAME##_section_already_linked \ - int (*_bfd_sizeof_headers) (bfd *, bfd_boolean); + int (*_bfd_sizeof_headers) (bfd *, struct bfd_link_info *); bfd_byte * (*_bfd_get_relocated_section_contents) (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *, bfd_boolean, struct bfd_symbol **); @@ -5071,7 +5321,8 @@ typedef struct bfd_target /* Check if SEC has been already linked during a reloceatable or final link. */ - void (*_section_already_linked) (bfd *, struct bfd_section *); + void (*_section_already_linked) (bfd *, struct bfd_section *, + struct bfd_link_info *); /* Routines to handle dynamic symbols and relocs. */ #define BFD_JUMP_TABLE_DYNAMIC(NAME) \ @@ -5131,10 +5382,11 @@ bfd_boolean bfd_link_split_section (bfd *abfd, asection *sec); #define bfd_link_split_section(abfd, sec) \ BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec)) -void bfd_section_already_linked (bfd *abfd, asection *sec); +void bfd_section_already_linked (bfd *abfd, asection *sec, + struct bfd_link_info *info); -#define bfd_section_already_linked(abfd, sec) \ - BFD_SEND (abfd, _section_already_linked, (abfd, sec)) +#define bfd_section_already_linked(abfd, sec, info) \ + BFD_SEND (abfd, _section_already_linked, (abfd, sec, info)) /* Extracted from simple.c. */ bfd_byte *bfd_simple_get_relocated_section_contents diff --git a/contrib/binutils/bfd/bfd.c b/contrib/binutils/bfd/bfd.c index 733f6ee0272d..510df0ab27f5 100644 --- a/contrib/binutils/bfd/bfd.c +++ b/contrib/binutils/bfd/bfd.c @@ -1,6 +1,6 @@ /* Generic BFD library interface and support routines. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -139,7 +139,7 @@ CODE_FRAGMENT . {* Stuff only useful for archives. *} . void *arelt_data; . struct bfd *my_archive; {* The containing archive BFD. *} -. struct bfd *next; {* The next BFD in the archive. *} +. struct bfd *archive_next; {* The next BFD in the archive. *} . struct bfd *archive_head; {* The first BFD in the archive. *} . bfd_boolean has_armap; . @@ -202,11 +202,12 @@ CODE_FRAGMENT . */ -#include "bfd.h" -#include "bfdver.h" #include "sysdep.h" #include <stdarg.h> +#include "bfd.h" +#include "bfdver.h" #include "libiberty.h" +#include "demangle.h" #include "safe-ctype.h" #include "bfdlink.h" #include "libbfd.h" @@ -271,6 +272,7 @@ CODE_FRAGMENT . bfd_error_bad_value, . bfd_error_file_truncated, . bfd_error_file_too_big, +. bfd_error_on_input, . bfd_error_invalid_error_code .} .bfd_error_type; @@ -278,6 +280,8 @@ CODE_FRAGMENT */ static bfd_error_type bfd_error = bfd_error_no_error; +static bfd *input_bfd = NULL; +static bfd_error_type input_error = bfd_error_no_error; const char *const bfd_errmsgs[] = { @@ -300,6 +304,7 @@ const char *const bfd_errmsgs[] = N_("Bad value"), N_("File truncated"), N_("File too big"), + N_("Error reading %s: %s"), N_("#<Invalid error code>") }; @@ -325,16 +330,32 @@ FUNCTION bfd_set_error SYNOPSIS - void bfd_set_error (bfd_error_type error_tag); + void bfd_set_error (bfd_error_type error_tag, ...); DESCRIPTION Set the BFD error condition to be @var{error_tag}. + If @var{error_tag} is bfd_error_on_input, then this function + takes two more parameters, the input bfd where the error + occurred, and the bfd_error_type error. */ void -bfd_set_error (bfd_error_type error_tag) +bfd_set_error (bfd_error_type error_tag, ...) { bfd_error = error_tag; + if (error_tag == bfd_error_on_input) + { + /* This is an error that occurred during bfd_close when + writing an archive, but on one of the input files. */ + va_list ap; + + va_start (ap, error_tag); + input_bfd = va_arg (ap, bfd *); + input_error = va_arg (ap, int); + if (input_error >= bfd_error_on_input) + abort (); + va_end (ap); + } } /* @@ -355,6 +376,19 @@ bfd_errmsg (bfd_error_type error_tag) #ifndef errno extern int errno; #endif + if (error_tag == bfd_error_on_input) + { + char *buf; + const char *msg = bfd_errmsg (input_error); + + if (asprintf (&buf, _(bfd_errmsgs [error_tag]), input_bfd->filename, msg) + != -1) + return buf; + + /* Ick, what to do on out of memory? */ + return msg; + } + if (error_tag == bfd_error_system_call) return xstrerror (errno); @@ -382,16 +416,10 @@ DESCRIPTION void bfd_perror (const char *message) { - if (bfd_get_error () == bfd_error_system_call) - /* Must be a system error then. */ - perror ((char *) message); + if (message == NULL || *message == '\0') + fprintf (stderr, "%s\n", bfd_errmsg (bfd_get_error ())); else - { - if (message == NULL || *message == '\0') - fprintf (stderr, "%s\n", bfd_errmsg (bfd_get_error ())); - else - fprintf (stderr, "%s: %s\n", message, bfd_errmsg (bfd_get_error ())); - } + fprintf (stderr, "%s: %s\n", message, bfd_errmsg (bfd_get_error ())); } /* @@ -419,6 +447,23 @@ static const char *_bfd_error_program_name; %A section name from section. For group components, print group name too. %B file name from bfd. For archive components, prints archive too. + + Note - because these two extra format specifiers require special handling + they are scanned for and processed in this function, before calling + vfprintf. This means that the *arguments* for these format specifiers + must be the first ones in the variable argument list, regardless of where + the specifiers appear in the format string. Thus for example calling + this function with a format string of: + + "blah %s blah %A blah %d blah %B" + + would involve passing the arguments as: + + "blah %s blah %A blah %d blah %B", + asection_for_the_%A, + bfd_for_the_%B, + string_for_the_%s, + integer_for_the_%d); */ void @@ -483,7 +528,11 @@ _bfd_default_error_handler (const char *fmt, ...) if (p[1] == 'B') { bfd *abfd = va_arg (ap, bfd *); - if (abfd->my_archive) + + if (abfd == NULL) + /* Invoking %B with a null bfd pointer is an internal error. */ + abort (); + else if (abfd->my_archive) snprintf (bufp, avail, "%s(%s)", abfd->my_archive->filename, abfd->filename); else @@ -492,10 +541,14 @@ _bfd_default_error_handler (const char *fmt, ...) else { asection *sec = va_arg (ap, asection *); - bfd *abfd = sec->owner; + bfd *abfd; const char *group = NULL; struct coff_comdat_info *ci; + if (sec == NULL) + /* Invoking %A with a null section pointer is an internal error. */ + abort (); + abfd = sec->owner; if (abfd != NULL && bfd_get_flavour (abfd) == bfd_target_elf_flavour && elf_next_in_group (sec) != NULL @@ -851,14 +904,16 @@ bfd_get_sign_extend_vma (bfd *abfd) name = bfd_get_target (abfd); - /* Return a proper value for DJGPP & PE COFF (x86 COFF variants). + /* Return a proper value for DJGPP & PE COFF. This function is required for DWARF2 support, but there is no place to store this information in the COFF back end. Should enough other COFF targets add support for DWARF2, a place will have to be found. Until then, this hack will do. */ - if (strncmp (name, "coff-go32", sizeof ("coff-go32") - 1) == 0 + if (CONST_STRNEQ (name, "coff-go32") || strcmp (name, "pe-i386") == 0 - || strcmp (name, "pei-i386") == 0) + || strcmp (name, "pei-i386") == 0 + || strcmp (name, "pe-arm-wince-little") == 0 + || strcmp (name, "pei-arm-wince-little") == 0) return 1; bfd_set_error (bfd_error_wrong_format); @@ -1158,8 +1213,8 @@ FUNCTION DESCRIPTION The following functions exist but have not yet been documented. -.#define bfd_sizeof_headers(abfd, reloc) \ -. BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc)) +.#define bfd_sizeof_headers(abfd, info) \ +. BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, info)) . .#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \ . BFD_SEND (abfd, _bfd_find_nearest_line, \ @@ -1298,11 +1353,10 @@ bfd_record_phdr (bfd *abfd, amt = sizeof (struct elf_segment_map); amt += ((bfd_size_type) count - 1) * sizeof (asection *); - m = bfd_alloc (abfd, amt); + m = bfd_zalloc (abfd, amt); if (m == NULL) return FALSE; - m->next = NULL; m->p_type = type; m->p_flags = flags; m->p_paddr = at; @@ -1335,6 +1389,15 @@ bfd_fprintf_vma (bfd *abfd, void *stream, bfd_vma value) { if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) get_elf_backend_data (abfd)->elf_backend_fprintf_vma (abfd, stream, value); +#ifdef BFD64 + /* fprintf_vma() on a 64-bit enabled host will always print a 64-bit + value, but really we want to display the address in the target's + address size. Since we do not have a field in the bfd structure + to tell us this, we take a guess, based on the target's name. */ + else if (strstr (bfd_get_target (abfd), "64") == NULL + && strcmp (bfd_get_target (abfd), "mmo") != 0) + fprintf ((FILE *) stream, "%08lx", (unsigned long) (value & 0xffffffff)); +#endif else fprintf_vma ((FILE *) stream, value); } @@ -1513,3 +1576,212 @@ bfd_preserve_finish (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_preserve *preserve) objalloc. */ bfd_hash_table_free (&preserve->section_htab); } + +/* +FUNCTION + bfd_emul_get_maxpagesize + +SYNOPSIS + bfd_vma bfd_emul_get_maxpagesize (const char *); + +DESCRIPTION + Returns the maximum page size, in bytes, as determined by + emulation. + +RETURNS + Returns the maximum page size in bytes for ELF, abort + otherwise. +*/ + +bfd_vma +bfd_emul_get_maxpagesize (const char *emul) +{ + const bfd_target *target; + + target = bfd_find_target (emul, NULL); + if (target != NULL + && target->flavour == bfd_target_elf_flavour) + return xvec_get_elf_backend_data (target)->maxpagesize; + + abort (); + return 0; +} + +static void +bfd_elf_set_pagesize (const bfd_target *target, bfd_vma size, + int offset, const bfd_target *orig_target) +{ + if (target->flavour == bfd_target_elf_flavour) + { + const struct elf_backend_data *bed; + + bed = xvec_get_elf_backend_data (target); + *((bfd_vma *) ((char *) bed + offset)) = size; + } + + if (target->alternative_target + && target->alternative_target != orig_target) + bfd_elf_set_pagesize (target->alternative_target, size, offset, + orig_target); +} + +/* +FUNCTION + bfd_emul_set_maxpagesize + +SYNOPSIS + void bfd_emul_set_maxpagesize (const char *, bfd_vma); + +DESCRIPTION + For ELF, set the maximum page size for the emulation. It is + a no-op for other formats. + +*/ + +void +bfd_emul_set_maxpagesize (const char *emul, bfd_vma size) +{ + const bfd_target *target; + + target = bfd_find_target (emul, NULL); + if (target) + bfd_elf_set_pagesize (target, size, + offsetof (struct elf_backend_data, + maxpagesize), target); +} + +/* +FUNCTION + bfd_emul_get_commonpagesize + +SYNOPSIS + bfd_vma bfd_emul_get_commonpagesize (const char *); + +DESCRIPTION + Returns the common page size, in bytes, as determined by + emulation. + +RETURNS + Returns the common page size in bytes for ELF, abort otherwise. +*/ + +bfd_vma +bfd_emul_get_commonpagesize (const char *emul) +{ + const bfd_target *target; + + target = bfd_find_target (emul, NULL); + if (target != NULL + && target->flavour == bfd_target_elf_flavour) + return xvec_get_elf_backend_data (target)->commonpagesize; + + abort (); + return 0; +} + +/* +FUNCTION + bfd_emul_set_commonpagesize + +SYNOPSIS + void bfd_emul_set_commonpagesize (const char *, bfd_vma); + +DESCRIPTION + For ELF, set the common page size for the emulation. It is + a no-op for other formats. + +*/ + +void +bfd_emul_set_commonpagesize (const char *emul, bfd_vma size) +{ + const bfd_target *target; + + target = bfd_find_target (emul, NULL); + if (target) + bfd_elf_set_pagesize (target, size, + offsetof (struct elf_backend_data, + commonpagesize), target); +} + +/* +FUNCTION + bfd_demangle + +SYNOPSIS + char *bfd_demangle (bfd *, const char *, int); + +DESCRIPTION + Wrapper around cplus_demangle. Strips leading underscores and + other such chars that would otherwise confuse the demangler. + If passed a g++ v3 ABI mangled name, returns a buffer allocated + with malloc holding the demangled name. Returns NULL otherwise + and on memory alloc failure. +*/ + +char * +bfd_demangle (bfd *abfd, const char *name, int options) +{ + char *res, *alloc; + const char *pre, *suf; + size_t pre_len; + + if (abfd != NULL + && *name != '\0' + && bfd_get_symbol_leading_char (abfd) == *name) + ++name; + + /* This is a hack for better error reporting on XCOFF, PowerPC64-ELF + or the MS PE format. These formats have a number of leading '.'s + on at least some symbols, so we remove all dots to avoid + confusing the demangler. */ + pre = name; + while (*name == '.' || *name == '$') + ++name; + pre_len = name - pre; + + /* Strip off @plt and suchlike too. */ + alloc = NULL; + suf = strchr (name, '@'); + if (suf != NULL) + { + alloc = bfd_malloc (suf - name + 1); + if (alloc == NULL) + return NULL; + memcpy (alloc, name, suf - name); + alloc[suf - name] = '\0'; + name = alloc; + } + + res = cplus_demangle (name, options); + + if (alloc != NULL) + free (alloc); + + if (res == NULL) + return NULL; + + /* Put back any prefix or suffix. */ + if (pre_len != 0 || suf != NULL) + { + size_t len; + size_t suf_len; + char *final; + + len = strlen (res); + if (suf == NULL) + suf = res + len; + suf_len = strlen (suf) + 1; + final = bfd_malloc (pre_len + len + suf_len); + if (final != NULL) + { + memcpy (final, pre, pre_len); + memcpy (final + pre_len, res, len); + memcpy (final + pre_len + len, suf, suf_len); + } + free (res); + res = final; + } + + return res; +} diff --git a/contrib/binutils/bfd/bfdio.c b/contrib/binutils/bfd/bfdio.c index 22ea886b5cb0..0df25c3baf80 100644 --- a/contrib/binutils/bfd/bfdio.c +++ b/contrib/binutils/bfd/bfdio.c @@ -1,7 +1,7 @@ /* Low-level I/O routines for BFDs. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -23,12 +23,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "sysdep.h" - +#include <limits.h> #include "bfd.h" #include "libbfd.h" -#include <limits.h> - #ifndef S_IXUSR #define S_IXUSR 0100 /* Execute by owner. */ #endif @@ -116,6 +114,15 @@ bfd_bread (void *ptr, bfd_size_type size, bfd *abfd) { size_t nread; + /* If this is an archive element, don't read past the end of + this element. */ + if (abfd->arelt_data != NULL) + { + size_t maxbytes = ((struct areltdata *) abfd->arelt_data)->parsed_size; + if (size > maxbytes) + size = maxbytes; + } + if ((abfd->flags & BFD_IN_MEMORY) != 0) { struct bfd_in_memory *bim; @@ -401,7 +408,7 @@ FUNCTION bfd_get_size SYNOPSIS - long bfd_get_size (bfd *abfd); + file_ptr bfd_get_size (bfd *abfd); DESCRIPTION Return the file size (as read from file system) for the file @@ -429,7 +436,7 @@ DESCRIPTION size reasonable?". */ -long +file_ptr bfd_get_size (bfd *abfd) { struct stat buf; diff --git a/contrib/binutils/bfd/binary.c b/contrib/binutils/bfd/binary.c index 458626f02a35..b5347dd4ba45 100644 --- a/contrib/binutils/bfd/binary.c +++ b/contrib/binutils/bfd/binary.c @@ -1,6 +1,6 @@ /* BFD back-end for binary objects. Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, - 2004, 2005 Free Software Foundation, Inc. + 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com> This file is part of BFD, the Binary File Descriptor library. @@ -32,8 +32,8 @@ the file. objcopy cooperates by specially setting the start address to zero by default. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "safe-ctype.h" #include "libbfd.h" @@ -63,6 +63,7 @@ binary_object_p (bfd *abfd) { struct stat statbuf; asection *sec; + flagword flags; if (abfd->target_defaulted) { @@ -80,10 +81,10 @@ binary_object_p (bfd *abfd) } /* One data section. */ - sec = bfd_make_section (abfd, ".data"); + flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS; + sec = bfd_make_section_with_flags (abfd, ".data", flags); if (sec == NULL) return NULL; - sec->flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS; sec->vma = 0; sec->size = statbuf.st_size; sec->filepos = 0; @@ -220,9 +221,6 @@ binary_get_symbol_info (bfd *ignore_abfd ATTRIBUTE_UNUSED, #define binary_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define binary_read_minisymbols _bfd_generic_read_minisymbols #define binary_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol -#define binary_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup -#define binary_get_reloc_upper_bound ((long (*) (bfd *, asection *)) bfd_0l) -#define binary_canonicalize_reloc ((long (*) (bfd *, asection *, arelent **, asymbol **)) bfd_0l) #define binary_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) /* Set the architecture of a binary file. */ @@ -305,7 +303,7 @@ binary_set_section_contents (bfd *abfd, static int binary_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, - bfd_boolean exec ATTRIBUTE_UNUSED) + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return 0; } @@ -367,7 +365,7 @@ const bfd_target binary_vec = BFD_JUMP_TABLE_CORE (_bfd_nocore), BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), BFD_JUMP_TABLE_SYMBOLS (binary), - BFD_JUMP_TABLE_RELOCS (binary), + BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), BFD_JUMP_TABLE_WRITE (binary), BFD_JUMP_TABLE_LINK (binary), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), diff --git a/contrib/binutils/bfd/bout.c b/contrib/binutils/bfd/bout.c index 5102ba776223..fe132129d67e 100644 --- a/contrib/binutils/bfd/bout.c +++ b/contrib/binutils/bfd/bout.c @@ -1,6 +1,6 @@ /* BFD back-end for Intel 960 b.out binaries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -20,8 +20,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "bfdlink.h" #include "genlink.h" @@ -635,7 +635,8 @@ callj_callback (bfd *abfd, } static reloc_howto_type * -b_out_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_type code) +b_out_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) { switch (code) { @@ -651,6 +652,20 @@ b_out_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_typ } } +static reloc_howto_type * +b_out_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + if (strcasecmp (howto_reloc_callj.name, r_name) == 0) + return &howto_reloc_callj; + if (strcasecmp (howto_reloc_abs32.name, r_name) == 0) + return &howto_reloc_abs32; + if (strcasecmp (howto_reloc_pcrel24.name, r_name) == 0) + return &howto_reloc_pcrel24; + + return NULL; +} + /* Allocate enough room for all the reloc entries, plus pointers to them all. */ static bfd_boolean @@ -990,7 +1005,8 @@ b_out_set_arch_mach (bfd *abfd, } static int -b_out_sizeof_headers (bfd *ignore_abfd ATTRIBUTE_UNUSED, bfd_boolean ignore ATTRIBUTE_UNUSED) +b_out_sizeof_headers (bfd *ignore_abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return sizeof (struct external_exec); } diff --git a/contrib/binutils/bfd/cache.c b/contrib/binutils/bfd/cache.c index 6db6a6b4d56d..5252cc9d1320 100644 --- a/contrib/binutils/bfd/cache.c +++ b/contrib/binutils/bfd/cache.c @@ -1,7 +1,7 @@ /* BFD library -- caching of file descriptors. Copyright 1990, 1991, 1992, 1993, 1994, 1996, 2000, 2001, 2002, - 2003, 2004, 2005 Free Software Foundation, Inc. + 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Hacked by Steve Chamberlain of Cygnus Support (steve@cygnus.com). @@ -40,8 +40,8 @@ SUBSECTION Caching functions */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "libiberty.h" diff --git a/contrib/binutils/bfd/coff-alpha.c b/contrib/binutils/bfd/coff-alpha.c index d9b890502d3f..dcb182bff9b5 100644 --- a/contrib/binutils/bfd/coff-alpha.c +++ b/contrib/binutils/bfd/coff-alpha.c @@ -1,6 +1,6 @@ /* BFD back-end for ALPHA Extended-Coff files. Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005 Free Software Foundation, Inc. + 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Modified from coff-mips.c by Steve Chamberlain <sac@cygnus.com> and Ian Lance Taylor <ian@cygnus.com>. @@ -20,8 +20,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "bfdlink.h" #include "libbfd.h" #include "coff/internal.h" @@ -1244,6 +1244,22 @@ alpha_bfd_reloc_type_lookup (abfd, code) return &alpha_howto_table[alpha_type]; } + +static reloc_howto_type * +alpha_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (alpha_howto_table) / sizeof (alpha_howto_table[0]); + i++) + if (alpha_howto_table[i].name != NULL + && strcasecmp (alpha_howto_table[i].name, r_name) == 0) + return &alpha_howto_table[i]; + + return NULL; +} /* A helper routine for alpha_relocate_section which converts an external reloc when generating relocatable output. Returns the @@ -2361,6 +2377,8 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data = /* Looking up a reloc type is Alpha specific. */ #define _bfd_ecoff_bfd_reloc_type_lookup alpha_bfd_reloc_type_lookup +#define _bfd_ecoff_bfd_reloc_name_lookup \ + alpha_bfd_reloc_name_lookup /* So is getting relocated section contents. */ #define _bfd_ecoff_bfd_get_relocated_section_contents \ diff --git a/contrib/binutils/bfd/coff-arm.c b/contrib/binutils/bfd/coff-arm.c index 6b83dc7af7fd..28cd4e736ea1 100644 --- a/contrib/binutils/bfd/coff-arm.c +++ b/contrib/binutils/bfd/coff-arm.c @@ -1,6 +1,6 @@ /* BFD back-end for ARM COFF files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -20,8 +20,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "coff/arm.h" #include "coff/internal.h" @@ -163,6 +163,19 @@ coff_arm_reloc (bfd *abfd, /* These most certainly belong somewhere else. Just had to get rid of the manifest constants in the code. */ + +#ifdef ARM_WINCE + +#define ARM_26D 0 +#define ARM_32 1 +#define ARM_RVA32 2 +#define ARM_26 3 +#define ARM_THUMB12 4 +#define ARM_SECTION 14 +#define ARM_SECREL 15 + +#else + #define ARM_8 0 #define ARM_16 1 #define ARM_32 2 @@ -179,20 +192,6 @@ coff_arm_reloc (bfd *abfd, #define ARM_THUMB12 13 #define ARM_THUMB23 14 -#ifdef ARM_WINCE -#undef ARM_32 -#undef ARM_RVA32 -#undef ARM_26 -#undef ARM_THUMB12 -#undef ARM_26D - -#define ARM_26D 0 -#define ARM_32 1 -#define ARM_RVA32 2 -#define ARM_26 3 -#define ARM_THUMB12 4 -#define ARM_SECTION 14 -#define ARM_SECREL 15 #endif static bfd_reloc_status_type aoutarm_fix_pcrel_26_done @@ -220,7 +219,7 @@ static reloc_howto_type aoutarm_std_reloc_howto[] = complain_overflow_dont, aoutarm_fix_pcrel_26_done, "ARM_26D", - FALSE, + TRUE, /* partial_inplace. */ 0x00ffffff, 0x0, PCRELOFFSET), @@ -233,7 +232,7 @@ static reloc_howto_type aoutarm_std_reloc_howto[] = complain_overflow_bitfield, coff_arm_reloc, "ARM_32", - FALSE, + TRUE, /* partial_inplace. */ 0xffffffff, 0xffffffff, PCRELOFFSET), @@ -246,7 +245,7 @@ static reloc_howto_type aoutarm_std_reloc_howto[] = complain_overflow_bitfield, coff_arm_reloc, "ARM_RVA32", - FALSE, + TRUE, /* partial_inplace. */ 0xffffffff, 0xffffffff, PCRELOFFSET), @@ -294,7 +293,7 @@ static reloc_howto_type aoutarm_std_reloc_howto[] = complain_overflow_bitfield, coff_arm_reloc, "ARM_SECTION", - FALSE, + TRUE, /* partial_inplace. */ 0x0000ffff, 0x0000ffff, PCRELOFFSET), @@ -307,7 +306,7 @@ static reloc_howto_type aoutarm_std_reloc_howto[] = complain_overflow_bitfield, coff_arm_reloc, "ARM_SECREL", - FALSE, + TRUE, /* partial_inplace. */ 0xffffffff, 0xffffffff, PCRELOFFSET), @@ -539,6 +538,32 @@ coff_arm_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, if (rel->r_type == ARM_RVA32) *addendp -= pe_data (sec->output_section->owner)->pe_opthdr.ImageBase; +#if defined COFF_WITH_PE && defined ARM_WINCE + if (rel->r_type == ARM_SECREL) + { + bfd_vma osect_vma; + + if (h && (h->type == bfd_link_hash_defined + || h->type == bfd_link_hash_defweak)) + osect_vma = h->root.u.def.section->output_section->vma; + else + { + asection *sec; + int i; + + /* Sigh, the only way to get the section to offset against + is to find it the hard way. */ + + for (sec = abfd->sections, i = 1; i < sym->n_scnum; i++) + sec = sec->next; + + osect_vma = sec->output_section->vma; + } + + *addendp -= osect_vma; + } +#endif + return howto; } @@ -808,6 +833,7 @@ coff_arm_reloc_type_lookup (bfd * abfd, bfd_reloc_code_real_type code) ASTD (BFD_RELOC_RVA, ARM_RVA32); ASTD (BFD_RELOC_ARM_PCREL_BRANCH, ARM_26); ASTD (BFD_RELOC_THUMB_PCREL_BRANCH12, ARM_THUMB12); + ASTD (BFD_RELOC_32_SECREL, ARM_SECREL); #else ASTD (BFD_RELOC_8, ARM_8); ASTD (BFD_RELOC_16, ARM_16); @@ -827,6 +853,23 @@ coff_arm_reloc_type_lookup (bfd * abfd, bfd_reloc_code_real_type code) } } +static reloc_howto_type * +coff_arm_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (aoutarm_std_reloc_howto) + / sizeof (aoutarm_std_reloc_howto[0])); + i++) + if (aoutarm_std_reloc_howto[i].name != NULL + && strcasecmp (aoutarm_std_reloc_howto[i].name, r_name) == 0) + return &aoutarm_std_reloc_howto[i]; + + return NULL; +} + #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 2 #define COFF_PAGE_SIZE 0x1000 @@ -1209,12 +1252,14 @@ coff_arm_relocate_section (bfd *output_bfd, generation of bl's instruction offset. */ addend -= 8; #endif - howto = &fake_arm26_reloc; + howto = & fake_arm26_reloc; } #ifdef ARM_WINCE /* MS ARM-CE makes the reloc relative to the opcode's pc, not the next opcode's pc, so is off by one. */ + if (howto->pc_relative && !info->relocatable) + addend -= 8; #endif /* If we are doing a relocatable link, then we can just ignore @@ -1938,12 +1983,11 @@ bfd_arm_get_bfd_for_interworking (bfd * abfd, if (sec == NULL) { - flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY; - - sec = bfd_make_section (abfd, ARM2THUMB_GLUE_SECTION_NAME); - + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_CODE | SEC_READONLY); + sec = bfd_make_section_with_flags (abfd, ARM2THUMB_GLUE_SECTION_NAME, + flags); if (sec == NULL - || ! bfd_set_section_flags (abfd, sec, flags) || ! bfd_set_section_alignment (abfd, sec, 2)) return FALSE; } @@ -1952,12 +1996,12 @@ bfd_arm_get_bfd_for_interworking (bfd * abfd, if (sec == NULL) { - flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY; - - sec = bfd_make_section (abfd, THUMB2ARM_GLUE_SECTION_NAME); + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_CODE | SEC_READONLY); + sec = bfd_make_section_with_flags (abfd, THUMB2ARM_GLUE_SECTION_NAME, + flags); if (sec == NULL - || ! bfd_set_section_flags (abfd, sec, flags) || ! bfd_set_section_alignment (abfd, sec, 2)) return FALSE; } @@ -2085,6 +2129,7 @@ bfd_arm_process_before_allocation (bfd * abfd, #endif /* ! defined (COFF_IMAGE_WITH_PE) */ #define coff_bfd_reloc_type_lookup coff_arm_reloc_type_lookup +#define coff_bfd_reloc_name_lookup coff_arm_reloc_name_lookup #define coff_relocate_section coff_arm_relocate_section #define coff_bfd_is_local_label_name coff_arm_is_local_label_name #define coff_adjust_symndx coff_arm_adjust_symndx @@ -2397,7 +2442,9 @@ Warning: Clearing the interworking flag of %B because non-interworking code in % /* Note: the definitions here of LOCAL_LABEL_PREFIX and USER_LABEL_PREIFX *must* match the definitions in gcc/config/arm/{coff|semi|aout}.h. */ +#ifndef LOCAL_LABEL_PREFIX #define LOCAL_LABEL_PREFIX "" +#endif #ifndef USER_LABEL_PREFIX #define USER_LABEL_PREFIX "_" #endif diff --git a/contrib/binutils/bfd/coff-aux.c b/contrib/binutils/bfd/coff-aux.c index e22d85566a69..f28a9483fd5d 100644 --- a/contrib/binutils/bfd/coff-aux.c +++ b/contrib/binutils/bfd/coff-aux.c @@ -1,5 +1,5 @@ /* BFD back-end for Apple M68K COFF A/UX 3.x files. - Copyright 1996, 1997, 2000, 2002 Free Software Foundation, Inc. + Copyright 1996, 1997, 2000, 2002, 2007 Free Software Foundation, Inc. Written by Richard Henderson <rth@tamu.edu>. This file is part of BFD, the Binary File Descriptor library. @@ -37,8 +37,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. #define COFF_COMMON_ADDEND -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" static bfd_boolean coff_m68k_aux_link_add_one_symbol PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, diff --git a/contrib/binutils/bfd/coff-i386.c b/contrib/binutils/bfd/coff-i386.c index 0d71cd000657..81d380012336 100644 --- a/contrib/binutils/bfd/coff-i386.c +++ b/contrib/binutils/bfd/coff-i386.c @@ -1,6 +1,6 @@ /* BFD back-end for Intel 386 COFF files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004 + 2000, 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -20,8 +20,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "coff/i386.h" @@ -546,6 +546,7 @@ coff_i386_rtype_to_howto (abfd, sec, rel, h, sym, addendp) } #define coff_bfd_reloc_type_lookup coff_i386_reloc_type_lookup +#define coff_bfd_reloc_name_lookup coff_i386_reloc_name_lookup static reloc_howto_type * coff_i386_reloc_type_lookup (abfd, code) @@ -578,6 +579,20 @@ coff_i386_reloc_type_lookup (abfd, code) } } +static reloc_howto_type * +coff_i386_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; i < sizeof (howto_table) / sizeof (howto_table[0]); i++) + if (howto_table[i].name != NULL + && strcasecmp (howto_table[i].name, r_name) == 0) + return &howto_table[i]; + + return NULL; +} + #define coff_rtype_to_howto coff_i386_rtype_to_howto #ifdef TARGET_UNDERSCORE diff --git a/contrib/binutils/bfd/coff-ia64.c b/contrib/binutils/bfd/coff-ia64.c index 1e3b3440f2ef..32702a8f6ff1 100644 --- a/contrib/binutils/bfd/coff-ia64.c +++ b/contrib/binutils/bfd/coff-ia64.c @@ -1,5 +1,5 @@ /* BFD back-end for HP/Intel IA-64 COFF files. - Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2007 Free Software Foundation, Inc. Contributed by David Mosberger <davidm@hpl.hp.com> This file is part of BFD, the Binary File Descriptor library. @@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "coff/ia64.h" #include "coff/internal.h" diff --git a/contrib/binutils/bfd/coff-mips.c b/contrib/binutils/bfd/coff-mips.c index 34b072c4138e..d5dafc7bf35f 100644 --- a/contrib/binutils/bfd/coff-mips.c +++ b/contrib/binutils/bfd/coff-mips.c @@ -1,6 +1,6 @@ /* BFD back-end for MIPS Extended-Coff files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004 + 2000, 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc. Original version by Per Bothner. Full support added by Ian Lance Taylor, ian@cygnus.com. @@ -21,8 +21,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "bfdlink.h" #include "libbfd.h" #include "coff/internal.h" @@ -769,6 +769,22 @@ mips_bfd_reloc_type_lookup (abfd, code) return &mips_howto_table[mips_type]; } + +static reloc_howto_type * +mips_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (mips_howto_table) / sizeof (mips_howto_table[0]); + i++) + if (mips_howto_table[i].name != NULL + && strcasecmp (mips_howto_table[i].name, r_name) == 0) + return &mips_howto_table[i]; + + return NULL; +} /* A helper routine for mips_relocate_section which handles the REFHI relocations. The REFHI relocation must be followed by a REFLO @@ -1375,6 +1391,7 @@ static const struct ecoff_backend_data mips_ecoff_backend_data = /* Looking up a reloc type is MIPS specific. */ #define _bfd_ecoff_bfd_reloc_type_lookup mips_bfd_reloc_type_lookup +#define _bfd_ecoff_bfd_reloc_name_lookup mips_bfd_reloc_name_lookup /* Getting relocated section contents is generic. */ #define _bfd_ecoff_bfd_get_relocated_section_contents \ diff --git a/contrib/binutils/bfd/coff-ppc.c b/contrib/binutils/bfd/coff-ppc.c index b4427936933a..72ade4e8ad25 100644 --- a/contrib/binutils/bfd/coff-ppc.c +++ b/contrib/binutils/bfd/coff-ppc.c @@ -1,6 +1,6 @@ /* BFD back-end for PowerPC Microsoft Portable Executable files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Original version pieced together by Kim Knuttila (krk@cygnus.com) @@ -33,9 +33,8 @@ - dlltool will not produce correct output in some .reloc cases, and will not produce the right glue code for dll function calls. */ -#include "bfd.h" #include "sysdep.h" - +#include "bfd.h" #include "libbfd.h" #include "coff/powerpc.h" @@ -1332,7 +1331,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section, DUMP_RELOC2 (howto->name, rel); - if (strncmp(".idata$2",input_section->name,8) == 0 && first_thunk_address == 0) + if (CONST_STRNEQ (input_section->name, ".idata$2") && first_thunk_address == 0) { /* Set magic values. */ int idata5offset; @@ -1961,8 +1960,23 @@ ppc_coff_reloc_type_lookup (abfd, code) return NULL; } } - #undef HOW2MAP + +static reloc_howto_type * +ppc_coff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (ppc_coff_howto_table) / sizeof (ppc_coff_howto_table[0]); + i++) + if (ppc_coff_howto_table[i].name != NULL + && strcasecmp (ppc_coff_howto_table[i].name, r_name) == 0) + return &ppc_coff_howto_table[i]; + + return NULL; +} /* Tailor coffcode.h -- macro heaven. */ @@ -1971,6 +1985,7 @@ ppc_coff_reloc_type_lookup (abfd, code) /* We use the special COFF backend linker, with our own special touch. */ #define coff_bfd_reloc_type_lookup ppc_coff_reloc_type_lookup +#define coff_bfd_reloc_name_lookup ppc_coff_reloc_name_lookup #define coff_rtype_to_howto coff_ppc_rtype_to_howto #define coff_relocate_section coff_ppc_relocate_section #define coff_bfd_final_link ppc_bfd_coff_final_link diff --git a/contrib/binutils/bfd/coff-rs6000.c b/contrib/binutils/bfd/coff-rs6000.c index 951587f99b1e..f446f497306a 100644 --- a/contrib/binutils/bfd/coff-rs6000.c +++ b/contrib/binutils/bfd/coff-rs6000.c @@ -1,12 +1,7 @@ /* BFD back-end for IBM RS/6000 "XCOFF" files. - Copyright 1990-1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Copyright 1990-1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. - FIXME: Can someone provide a transliteration of this name into ASCII? - Using the following chars caused a compiler warning on HIUX (so I replaced - them with octal escapes), and isn't useful without an understanding of what - character set it is. - Written by Metin G. Ozisik, Mimi Ph\373\364ng-Th\345o V\365, - and John Gilmore. + Written by Metin G. Ozisik, Mimi Phuong-Thao Vo, and John Gilmore. Archive support from Damon A. Permezel. Contributed by IBM Corporation and Cygnus Support. @@ -26,8 +21,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "bfdlink.h" #include "libbfd.h" #include "coff/internal.h" @@ -59,7 +54,7 @@ extern bfd_boolean _bfd_xcoff_write_armap extern bfd_boolean _bfd_xcoff_write_archive_contents PARAMS ((bfd *)); extern int _bfd_xcoff_sizeof_headers - PARAMS ((bfd *, bfd_boolean)); + PARAMS ((bfd *, struct bfd_link_info *)); extern void _bfd_xcoff_swap_sym_in PARAMS ((bfd *, PTR, PTR)); extern unsigned int _bfd_xcoff_swap_sym_out @@ -98,6 +93,7 @@ void xcoff_rtype2howto #define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data #define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name #define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup +#define coff_bfd_reloc_name_lookup _bfd_xcoff_reloc_name_lookup #ifdef AIX_CORE extern const bfd_target * rs6000coff_core_p PARAMS ((bfd *abfd)); @@ -1051,6 +1047,21 @@ _bfd_xcoff_reloc_type_lookup (abfd, code) } } +static reloc_howto_type * +_bfd_xcoff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (xcoff_howto_table) / sizeof (xcoff_howto_table[0]); + i++) + if (xcoff_howto_table[i].name != NULL + && strcasecmp (xcoff_howto_table[i].name, r_name) == 0) + return &xcoff_howto_table[i]; + + return NULL; +} /* XCOFF archive support. The original version of this code was by Damon A. Permezel. It was enhanced to permit cross support, and @@ -1638,7 +1649,7 @@ xcoff_write_armap_old (abfd, elength, map, orl_count, stridx) + SXCOFFARFMAG + arelt_size (sub)); fileoff = (fileoff + 1) &~ 1; - sub = sub->next; + sub = sub->archive_next; } for (i = 0; i < orl_count; i++) @@ -1809,7 +1820,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) } i++; } - current_bfd = current_bfd->next; + current_bfd = current_bfd->archive_next; if (current_bfd != NULL) arch_info = bfd_get_arch_info (current_bfd); } @@ -1913,7 +1924,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) + SXCOFFARFMAG + arelt_size (current_bfd)); fileoff += fileoff & 1; - current_bfd = current_bfd->next; + current_bfd = current_bfd->archive_next; if (current_bfd != NULL) arch_info = bfd_get_arch_info (current_bfd); } @@ -1934,7 +1945,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) } i++; } - current_bfd = current_bfd->next; + current_bfd = current_bfd->archive_next; if (current_bfd != NULL) arch_info = bfd_get_arch_info (current_bfd); } @@ -2009,7 +2020,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) + SXCOFFARFMAG + arelt_size (current_bfd)); fileoff += fileoff & 1; - current_bfd = current_bfd->next; + current_bfd = current_bfd->archive_next; if (current_bfd != NULL) arch_info = bfd_get_arch_info (current_bfd); } @@ -2030,7 +2041,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) } i++; } - current_bfd = current_bfd->next; + current_bfd = current_bfd->archive_next; if (current_bfd != NULL) arch_info = bfd_get_arch_info (current_bfd); } @@ -2089,7 +2100,7 @@ xcoff_write_archive_contents_old (abfd) count = 0; total_namlen = 0; - for (sub = abfd->archive_head; sub != NULL; sub = sub->next) + for (sub = abfd->archive_head; sub != NULL; sub = sub->archive_next) { ++count; total_namlen += strlen (normalize_filename (sub)) + 1; @@ -2105,7 +2116,9 @@ xcoff_write_archive_contents_old (abfd) hasobjects = FALSE; prevoff = 0; nextoff = SIZEOF_AR_FILE_HDR; - for (sub = abfd->archive_head, i = 0; sub != NULL; sub = sub->next, i++) + for (sub = abfd->archive_head, i = 0; + sub != NULL; + sub = sub->archive_next, i++) { const char *name; bfd_size_type namlen; @@ -2253,7 +2266,7 @@ xcoff_write_archive_contents_old (abfd) abfd) != XCOFFARMAG_ELEMENT_SIZE) return FALSE; } - for (sub = abfd->archive_head; sub != NULL; sub = sub->next) + for (sub = abfd->archive_head; sub != NULL; sub = sub->archive_next) { const char *name; bfd_size_type namlen; @@ -2323,7 +2336,7 @@ xcoff_write_archive_contents_big (abfd) hasobjects = FALSE; for (current_bfd = abfd->archive_head, count = 0, total_namlen = 0; current_bfd != NULL; - current_bfd = current_bfd->next, count++) + current_bfd = current_bfd->archive_next, count++) { total_namlen += strlen (normalize_filename (current_bfd)) + 1; @@ -2345,7 +2358,7 @@ xcoff_write_archive_contents_big (abfd) nextoff = SIZEOF_AR_FILE_HDR_BIG; for (current_bfd = abfd->archive_head, i = 0; current_bfd != NULL; - current_bfd = current_bfd->next, i++) + current_bfd = current_bfd->archive_next, i++) { const char *name; bfd_size_type namlen; @@ -2512,8 +2525,9 @@ xcoff_write_archive_contents_big (abfd) offsets = NULL; } - for (current_bfd = abfd->archive_head; current_bfd != NULL; - current_bfd = current_bfd->next) + for (current_bfd = abfd->archive_head; + current_bfd != NULL; + current_bfd = current_bfd->archive_next) { const char *name; size_t namlen; @@ -2573,9 +2587,8 @@ _bfd_xcoff_write_archive_contents (abfd) always uses an a.out header. */ int -_bfd_xcoff_sizeof_headers (abfd, reloc) - bfd *abfd; - bfd_boolean reloc ATTRIBUTE_UNUSED; +_bfd_xcoff_sizeof_headers (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { int size; @@ -4179,6 +4192,7 @@ const bfd_target rs6000coff_vec = coff_get_reloc_upper_bound, coff_canonicalize_reloc, _bfd_xcoff_reloc_type_lookup, + _bfd_xcoff_reloc_name_lookup, /* Write */ coff_set_arch_mach, @@ -4429,6 +4443,7 @@ const bfd_target pmac_xcoff_vec = coff_get_reloc_upper_bound, coff_canonicalize_reloc, _bfd_xcoff_reloc_type_lookup, + _bfd_xcoff_reloc_name_lookup, /* Write */ coff_set_arch_mach, diff --git a/contrib/binutils/bfd/coff-sparc.c b/contrib/binutils/bfd/coff-sparc.c index 0236f525e66f..236c7bfd4e38 100644 --- a/contrib/binutils/bfd/coff-sparc.c +++ b/contrib/binutils/bfd/coff-sparc.c @@ -1,6 +1,6 @@ /* BFD back-end for Sparc COFF files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001, - 2002, 2003, 2005 Free Software Foundation, Inc. + 2002, 2003, 2005, 2007 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -19,8 +19,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "coff/sparc.h" #include "coff/internal.h" @@ -158,6 +158,24 @@ coff_sparc_reloc_type_lookup (abfd, code) } #define coff_bfd_reloc_type_lookup coff_sparc_reloc_type_lookup +static reloc_howto_type * +coff_sparc_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (coff_sparc_howto_table) + / sizeof (coff_sparc_howto_table[0])); + i++) + if (coff_sparc_howto_table[i].name != NULL + && strcasecmp (coff_sparc_howto_table[i].name, r_name) == 0) + return &coff_sparc_howto_table[i]; + + return NULL; +} +#define coff_bfd_reloc_name_lookup coff_sparc_reloc_name_lookup + static void rtype2howto (cache_ptr, dst) arelent *cache_ptr; diff --git a/contrib/binutils/bfd/coff64-rs6000.c b/contrib/binutils/bfd/coff64-rs6000.c index e0aa87ef6775..5e0804f00fc7 100644 --- a/contrib/binutils/bfd/coff64-rs6000.c +++ b/contrib/binutils/bfd/coff64-rs6000.c @@ -1,5 +1,5 @@ /* BFD back-end for IBM RS/6000 "XCOFF64" files. - Copyright 2000, 2001, 2002, 2003, 2004, 2005 + Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written Clinton Popetz. Contributed by Cygnus Support. @@ -20,8 +20,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "bfdlink.h" #include "libbfd.h" #include "coff/internal.h" @@ -127,7 +127,7 @@ extern bfd_boolean _bfd_xcoff_write_armap extern bfd_boolean _bfd_xcoff_write_archive_contents PARAMS ((bfd *)); extern int _bfd_xcoff_sizeof_headers - PARAMS ((bfd *, bfd_boolean)); + PARAMS ((bfd *, struct bfd_link_info *)); extern void _bfd_xcoff_swap_sym_in PARAMS ((bfd *, PTR, PTR)); extern unsigned int _bfd_xcoff_swap_sym_out @@ -161,7 +161,7 @@ static const bfd_target *xcoff64_archive_p static bfd *xcoff64_openr_next_archived_file PARAMS ((bfd *, bfd *)); static int xcoff64_sizeof_headers - PARAMS ((bfd *, bfd_boolean)); + PARAMS ((bfd *, struct bfd_link_info *)); static asection *xcoff64_create_csect_from_smclas PARAMS ((bfd *, union internal_auxent *, const char *)); static bfd_boolean xcoff64_is_lineno_count_overflow @@ -237,6 +237,7 @@ bfd_boolean (*xcoff64_calculate_relocation[XCOFF_MAX_CALCULATE_RELOCATION]) #define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data #define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name #define coff_bfd_reloc_type_lookup xcoff64_reloc_type_lookup +#define coff_bfd_reloc_name_lookup xcoff64_reloc_name_lookup #ifdef AIX_CORE extern const bfd_target * rs6000coff_core_p PARAMS ((bfd *abfd)); @@ -1843,6 +1844,22 @@ xcoff64_reloc_type_lookup (abfd, code) } } +static reloc_howto_type * +xcoff64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (xcoff64_howto_table) / sizeof (xcoff64_howto_table[0]); + i++) + if (xcoff64_howto_table[i].name != NULL + && strcasecmp (xcoff64_howto_table[i].name, r_name) == 0) + return &xcoff64_howto_table[i]; + + return NULL; +} + /* Read in the armap of an XCOFF archive. */ static bfd_boolean @@ -2056,9 +2073,8 @@ xcoff64_openr_next_archived_file (archive, last_file) always uses an a.out header. */ static int -xcoff64_sizeof_headers (abfd, reloc) - bfd *abfd; - bfd_boolean reloc ATTRIBUTE_UNUSED; +xcoff64_sizeof_headers (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { int size; @@ -2726,6 +2742,7 @@ const bfd_target rs6000coff64_vec = coff_get_reloc_upper_bound, coff_canonicalize_reloc, xcoff64_reloc_type_lookup, + xcoff64_reloc_name_lookup, /* Write */ coff_set_arch_mach, @@ -2977,6 +2994,7 @@ const bfd_target aix5coff64_vec = coff_get_reloc_upper_bound, coff_canonicalize_reloc, xcoff64_reloc_type_lookup, + xcoff64_reloc_name_lookup, /* Write */ coff_set_arch_mach, diff --git a/contrib/binutils/bfd/coffcode.h b/contrib/binutils/bfd/coffcode.h index 256732c314d4..a2aac5f63b4c 100644 --- a/contrib/binutils/bfd/coffcode.h +++ b/contrib/binutils/bfd/coffcode.h @@ -1,6 +1,6 @@ /* Support for the generic parts of most COFF variants, for BFD. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -427,7 +427,7 @@ sec_to_styp_flags (const char *sec_name, flagword sec_flags) styp_flags = STYP_LIT; #endif /* _LIT */ } - else if (!strncmp (sec_name, DOT_DEBUG, sizeof (DOT_DEBUG) - 1)) + else if (CONST_STRNEQ (sec_name, DOT_DEBUG)) { /* Handle the XCOFF debug section and DWARF2 debug sections. */ if (!sec_name[6]) @@ -435,12 +435,12 @@ sec_to_styp_flags (const char *sec_name, flagword sec_flags) else styp_flags = STYP_DEBUG_INFO; } - else if (!strncmp (sec_name, ".stab", 5)) + else if (CONST_STRNEQ (sec_name, ".stab")) { styp_flags = STYP_DEBUG_INFO; } #ifdef COFF_LONG_SECTION_NAMES - else if (!strncmp (sec_name, GNU_LINKONCE_WI, sizeof (GNU_LINKONCE_WI) - 1)) + else if (CONST_STRNEQ (sec_name, GNU_LINKONCE_WI)) { styp_flags = STYP_DEBUG_INFO; } @@ -529,8 +529,8 @@ sec_to_styp_flags (const char *sec_name, flagword sec_flags) but there are more IMAGE_SCN_* flags. */ /* FIXME: There is no gas syntax to specify the debug section flag. */ - if (strncmp (sec_name, DOT_DEBUG, sizeof (DOT_DEBUG) - 1) == 0 - || strncmp (sec_name, GNU_LINKONCE_WI, sizeof (GNU_LINKONCE_WI) - 1) == 0) + if (CONST_STRNEQ (sec_name, DOT_DEBUG) + || CONST_STRNEQ (sec_name, GNU_LINKONCE_WI)) sec_flags = SEC_DEBUGGING; /* skip LOAD */ @@ -674,14 +674,14 @@ styp_to_sec_flags (bfd *abfd ATTRIBUTE_UNUSED, #endif sec_flags |= SEC_ALLOC; } - else if (strncmp (name, DOT_DEBUG, sizeof (DOT_DEBUG) - 1) == 0 + else if (CONST_STRNEQ (name, DOT_DEBUG) #ifdef _COMMENT || strcmp (name, _COMMENT) == 0 #endif #ifdef COFF_LONG_SECTION_NAMES - || strncmp (name, GNU_LINKONCE_WI, sizeof (GNU_LINKONCE_WI) - 1) == 0 + || CONST_STRNEQ (name, GNU_LINKONCE_WI) #endif - || strncmp (name, ".stab", 5) == 0) + || CONST_STRNEQ (name, ".stab")) { #ifdef COFF_PAGE_SIZE sec_flags |= SEC_DEBUGGING; @@ -715,7 +715,7 @@ styp_to_sec_flags (bfd *abfd ATTRIBUTE_UNUSED, The symbols will be defined as weak, so that multiple definitions are permitted. The GNU linker extension is to actually discard all but one of the sections. */ - if (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0) + if (CONST_STRNEQ (name, ".gnu.linkonce")) sec_flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD; #endif @@ -1071,7 +1071,7 @@ styp_to_sec_flags (bfd *abfd, /* The MS PE spec sets the DISCARDABLE flag on .reloc sections but we do not want them to be labelled as debug section, since then strip would remove them. */ - if (strncmp (name, ".reloc", sizeof ".reloc" - 1) != 0) + if (! CONST_STRNEQ (name, ".reloc")) sec_flags |= SEC_DEBUGGING; break; case IMAGE_SCN_MEM_SHARED: @@ -1126,7 +1126,7 @@ styp_to_sec_flags (bfd *abfd, The symbols will be defined as weak, so that multiple definitions are permitted. The GNU linker extension is to actually discard all but one of the sections. */ - if (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0) + if (CONST_STRNEQ (name, ".gnu.linkonce")) sec_flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD; #endif @@ -1546,6 +1546,9 @@ static const unsigned int coff_section_alignment_table_size = static bfd_boolean coff_new_section_hook (bfd * abfd, asection * section) { + combined_entry_type *native; + bfd_size_type amt; + section->alignment_power = COFF_DEFAULT_SECTION_ALIGNMENT_POWER; #ifdef RS6000COFF_C @@ -1557,34 +1560,31 @@ coff_new_section_hook (bfd * abfd, asection * section) section->alignment_power = bfd_xcoff_data_align_power (abfd); #endif - /* PR binutils/2724: Only real sections have a symbol that - has the coff_symbol_type structure allocated for it. */ - if (! bfd_is_const_section (section)) - { - combined_entry_type *native; - bfd_size_type amt; + /* Set up the section symbol. */ + if (!_bfd_generic_new_section_hook (abfd, section)) + return FALSE; - /* Allocate aux records for section symbols, to store size and - related info. + /* Allocate aux records for section symbols, to store size and + related info. - @@ The 10 is a guess at a plausible maximum number of aux entries - (but shouldn't be a constant). */ - amt = sizeof (combined_entry_type) * 10; - native = bfd_zalloc (abfd, amt); - if (native == NULL) - return FALSE; + @@ The 10 is a guess at a plausible maximum number of aux entries + (but shouldn't be a constant). */ + amt = sizeof (combined_entry_type) * 10; + native = bfd_zalloc (abfd, amt); + if (native == NULL) + return FALSE; - /* We don't need to set up n_name, n_value, or n_scnum in the native - symbol information, since they'll be overridden by the BFD symbol - anyhow. However, we do need to set the type and storage class, - in case this symbol winds up getting written out. The value 0 - for n_numaux is already correct. */ - native->u.syment.n_type = T_NULL; - native->u.syment.n_sclass = C_STAT; + /* We don't need to set up n_name, n_value, or n_scnum in the native + symbol information, since they'll be overridden by the BFD symbol + anyhow. However, we do need to set the type and storage class, + in case this symbol winds up getting written out. The value 0 + for n_numaux is already correct. */ + + native->u.syment.n_type = T_NULL; + native->u.syment.n_sclass = C_STAT; + + coffsymbol (section->symbol)->native = native; - coffsymbol (section->symbol)->native = native; - } - coff_set_custom_section_alignment (abfd, section, coff_section_alignment_table, coff_section_alignment_table_size); @@ -1882,9 +1882,15 @@ coff_set_arch_mach_hook (bfd *abfd, void * filehdr) #ifdef I386MAGIC case I386MAGIC: case I386PTXMAGIC: - case I386AIXMAGIC: /* Danbury PS/2 AIX C Compiler */ - case LYNXCOFFMAGIC: /* shadows the m68k Lynx number below, sigh */ + case I386AIXMAGIC: /* Danbury PS/2 AIX C Compiler. */ + case LYNXCOFFMAGIC: /* Shadows the m68k Lynx number below, sigh. */ + arch = bfd_arch_i386; + break; +#endif +#ifdef AMD64MAGIC + case AMD64MAGIC: arch = bfd_arch_i386; + machine = bfd_mach_x86_64; break; #endif #ifdef IA64MAGIC @@ -2532,11 +2538,15 @@ coff_write_relocs (bfd * abfd, int first_undef) else { n.r_symndx = get_index ((*(q->sym_ptr_ptr))); - /* Take notice if the symbol reloc points to a symbol - we don't have in our symbol table. What should we - do for this?? */ + /* Check to see if the symbol reloc points to a symbol + we don't have in our symbol table. */ if (n.r_symndx > obj_conv_table_size (abfd)) - abort (); + { + bfd_set_error (bfd_error_bad_value); + _bfd_error_handler (_("%B: reloc against a non-existant symbol index: %ld"), + abfd, n.r_symndx); + return FALSE; + } } } @@ -2717,13 +2727,18 @@ coff_set_flags (bfd * abfd, return TRUE; #endif -#ifdef I386MAGIC +#if defined(I386MAGIC) || defined(AMD64MAGIC) case bfd_arch_i386: +#if defined(I386MAGIC) *magicp = I386MAGIC; -#ifdef LYNXOS +#endif +#if defined LYNXOS /* Just overwrite the usual value if we're doing Lynx. */ *magicp = LYNXCOFFMAGIC; #endif +#if defined AMD64MAGIC + *magicp = AMD64MAGIC; +#endif return TRUE; #endif @@ -3755,6 +3770,7 @@ coff_write_object_contents (bfd * abfd) internal_f.f_flags |= IMAGE_FILE_LARGE_ADDRESS_AWARE; #endif +#ifndef COFF_WITH_pex64 #ifdef COFF_WITH_PE internal_f.f_flags |= IMAGE_FILE_32BIT_MACHINE; #else @@ -3763,6 +3779,7 @@ coff_write_object_contents (bfd * abfd) else internal_f.f_flags |= F_AR32W; #endif +#endif #ifdef TI_TARGET_ID /* Target id is used in TI COFF v1 and later; COFF0 won't use this field, @@ -3856,16 +3873,18 @@ coff_write_object_contents (bfd * abfd) #if defined(I386) #define __A_MAGIC_SET__ -#if defined(LYNXOS) +#if defined LYNXOS internal_a.magic = LYNXCOFFMAGIC; -#else /* LYNXOS */ +#elif defined AMD64 + internal_a.magic = IMAGE_NT_OPTIONAL_HDR64_MAGIC; +#else internal_a.magic = ZMAGIC; -#endif /* LYNXOS */ +#endif #endif /* I386 */ #if defined(IA64) #define __A_MAGIC_SET__ - internal_a.magic = ZMAGIC; + internal_a.magic = PE32PMAGIC; #endif /* IA64 */ #if defined(SPARC) @@ -4851,6 +4870,7 @@ coff_slurp_reloc_table (bfd * abfd, sec_ptr asect, asymbol ** symbols) cache_ptr = reloc_cache + idx; src = native_relocs + idx; + dst.r_offset = 0; coff_swap_reloc_in (abfd, src, &dst); #ifdef RELOC_PROCESSING @@ -4931,6 +4951,7 @@ coff_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, { arelent genrel; + genrel.howto = NULL; RTYPE2HOWTO (&genrel, rel); return genrel.howto; } @@ -5314,6 +5335,9 @@ static const bfd_coff_backend_data ticoff1_swap_table = #ifndef coff_bfd_reloc_type_lookup #define coff_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup #endif +#ifndef coff_bfd_reloc_name_lookup +#define coff_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup +#endif #ifndef coff_bfd_get_relocated_section_contents #define coff_bfd_get_relocated_section_contents \ diff --git a/contrib/binutils/bfd/coffgen.c b/contrib/binutils/bfd/coffgen.c index c541e6a590eb..8884a7f14db5 100644 --- a/contrib/binutils/bfd/coffgen.c +++ b/contrib/binutils/bfd/coffgen.c @@ -1,6 +1,6 @@ /* Support for the generic parts of COFF, for BFD. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005 + 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -37,8 +37,8 @@ Those functions may not use any COFF specific information, such as coff_data (abfd). */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "coff/internal.h" #include "libcoff.h" @@ -1901,7 +1901,16 @@ coff_print_symbol (bfd *abfd, combined->u.syment.n_type, combined->u.syment.n_sclass, combined->u.syment.n_numaux); - fprintf_vma (file, val); +#ifdef BFD64 + /* fprintf_vma() on a 64-bit enabled host will always print a 64-bit + value, but really we want to display the address in the target's + address size. Since we do not have a field in the bfd structure + to tell us this, we take a guess, based on the target's name. */ + if (strstr (bfd_get_target (abfd), "64") == NULL) + fprintf (file, "%08lx", (unsigned long) (val & 0xffffffff)); + else +#endif + fprintf_vma (file, val); fprintf (file, " %s", symbol->name); for (aux = 0; aux < combined->u.syment.n_numaux; aux++) @@ -2238,11 +2247,11 @@ coff_find_inliner_info (bfd *abfd, } int -coff_sizeof_headers (bfd *abfd, bfd_boolean reloc) +coff_sizeof_headers (bfd *abfd, struct bfd_link_info *info) { size_t size; - if (! reloc) + if (!info->relocatable) size = bfd_coff_filhsz (abfd) + bfd_coff_aoutsz (abfd); else size = bfd_coff_filhsz (abfd); diff --git a/contrib/binutils/bfd/cofflink.c b/contrib/binutils/bfd/cofflink.c index a1f6684bb61c..1ed7107fc1dd 100644 --- a/contrib/binutils/bfd/cofflink.c +++ b/contrib/binutils/bfd/cofflink.c @@ -1,6 +1,6 @@ /* COFF specific linker code. Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, - 2004, 2005, 2006 Free Software Foundation, Inc. + 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -21,8 +21,8 @@ /* This file contains the COFF backend linker code. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "bfdlink.h" #include "libbfd.h" #include "coff/internal.h" @@ -232,7 +232,7 @@ coff_link_check_ar_symbols (bfd *abfd, /* Auto import. */ if (!h && info->pei386_auto_import - && !strncmp (name,"__imp_", 6)) + && CONST_STRNEQ (name, "__imp_")) h = bfd_link_hash_lookup (info->hash, name + 6, FALSE, FALSE, TRUE); /* We are only interested in symbols that are currently @@ -439,7 +439,7 @@ coff_link_add_symbols (bfd *abfd, || classification == COFF_SYMBOL_PE_SECTION) && coff_section_data (abfd, section) != NULL && coff_section_data (abfd, section)->comdat != NULL - && strncmp (name, "??_", 3) == 0 + && CONST_STRNEQ (name, "??_") && strcmp (name, coff_section_data (abfd, section)->comdat->name) == 0) { if (*sym_hash == NULL) @@ -583,7 +583,7 @@ coff_link_add_symbols (bfd *abfd, asection *stab; for (stab = abfd->sections; stab; stab = stab->next) - if (strncmp (".stab", stab->name, 5) == 0 + if (CONST_STRNEQ (stab->name, ".stab") && (!stab->name[5] || (stab->name[5] == '.' && ISDIGIT (stab->name[6])))) { @@ -1232,16 +1232,14 @@ process_embedded_commands (bfd *output_bfd, s++; continue; } - if (strncmp (s, "-attr", 5) == 0) + if (CONST_STRNEQ (s, "-attr")) { char *name; char *attribs; asection *asec; int loop = 1; int had_write = 0; - int had_read = 0; int had_exec= 0; - int had_shared= 0; s += 5; s = get_name (s, &name); @@ -1255,10 +1253,8 @@ process_embedded_commands (bfd *output_bfd, had_write = 1; break; case 'R': - had_read = 1; break; case 'S': - had_shared = 1; break; case 'X': had_exec = 1; @@ -1276,11 +1272,11 @@ process_embedded_commands (bfd *output_bfd, asec->flags |= SEC_READONLY; } } - else if (strncmp (s,"-heap", 5) == 0) - s = dores_com (s+5, output_bfd, 1); + else if (CONST_STRNEQ (s, "-heap")) + s = dores_com (s + 5, output_bfd, 1); - else if (strncmp (s,"-stack", 6) == 0) - s = dores_com (s+6, output_bfd, 0); + else if (CONST_STRNEQ (s, "-stack")) + s = dores_com (s + 6, output_bfd, 0); else s++; @@ -1925,6 +1921,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd) generate two symbols with the same name, but only one will have aux entries. */ BFD_ASSERT (isymp->n_numaux == 0 + || h->numaux == 0 || h->numaux == isymp->n_numaux); } @@ -1940,7 +1937,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd) union internal_auxent aux; union internal_auxent *auxp; - if (h != NULL) + if (h != NULL && h->aux != NULL && (h->numaux > i)) auxp = h->aux + i; else { diff --git a/contrib/binutils/bfd/config.bfd b/contrib/binutils/bfd/config.bfd index b112f4b656ff..92539963a6ef 100755 --- a/contrib/binutils/bfd/config.bfd +++ b/contrib/binutils/bfd/config.bfd @@ -31,12 +31,7 @@ targ_underscore=no # Catch obsolete configurations. case $targ in - m68*-apple-aux* | \ - m68*-apollo-* | \ - m68*-bull-sysv* | \ - m68*-*-rtemscoff* | \ - i960-*-rtems* | \ - or32-*-rtems* | \ + maxq-*-coff | \ null) if test "x$enable_obsolete" != xyes; then echo "*** Configuration $targ is obsolete." >&2 @@ -48,6 +43,12 @@ case $targ in esac case $targ in + m68*-apple-aux* | \ + m68*-apollo-* | \ + m68*-bull-sysv* | \ + m68*-*-rtemscoff* | \ + i960-*-rtems* | \ + or32-*-rtems* | \ m68*-*-lynxos* | \ sparc-*-lynxos* | \ vax-*-vms* | \ @@ -75,9 +76,11 @@ bfin*) targ_archs=bfd_bfin_arch ;; c30*) targ_archs=bfd_tic30_arch ;; c4x*) targ_archs=bfd_tic4x_arch ;; c54x*) targ_archs=bfd_tic54x_arch ;; +cr16*) targ_archs=bfd_cr16_arch ;; crisv32) targ_archs=bfd_cris_arch ;; crx*) targ_archs=bfd_crx_arch ;; dlx*) targ_archs=bfd_dlx_arch ;; +fido*) targ_archs=bfd_m68k_arch ;; hppa*) targ_archs=bfd_hppa_arch ;; i[3-7]86) targ_archs=bfd_i386_arch ;; i370) targ_archs=bfd_i370_arch ;; @@ -95,10 +98,11 @@ rs6000) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;; s390*) targ_archs=bfd_s390_arch ;; sh*) targ_archs=bfd_sh_arch ;; sparc*) targ_archs=bfd_sparc_arch ;; +spu*) targ_archs=bfd_spu_arch ;; strongarm*) targ_archs=bfd_arm_arch ;; thumb*) targ_archs=bfd_arm_arch ;; v850*) targ_archs=bfd_v850_arch ;; -x86_64) targ_archs=bfd_i386_arch ;; +x86_64*) targ_archs=bfd_i386_arch ;; xscale*) targ_archs=bfd_arm_arch ;; xtensa*) targ_archs=bfd_xtensa_arch ;; z80|r800) targ_archs=bfd_z80_arch ;; @@ -137,6 +141,7 @@ case "${targ}" in alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu) targ_defvec=bfd_elf64_alpha_freebsd_vec targ_selvecs=ecoffalpha_little_vec + want64=true # FreeBSD <= 4.0 supports only the old nonstandard way of ABI labelling. case "${targ}" in alpha*-*-freebsd3* | alpha*-*-freebsd4 | alpha*-*-freebsd4.0*) @@ -146,36 +151,49 @@ case "${targ}" in alpha*-*-netbsd* | alpha*-*-openbsd*) targ_defvec=bfd_elf64_alpha_vec targ_selvecs=ecoffalpha_little_vec + want64=true ;; alpha*-*-netware*) targ_defvec=ecoffalpha_little_vec targ_selvecs=nlm32_alpha_vec + want64=true ;; alpha*-*-linuxecoff*) targ_defvec=ecoffalpha_little_vec targ_selvecs=bfd_elf64_alpha_vec + want64=true ;; alpha*-*-linux-* | alpha*-*-elf*) targ_defvec=bfd_elf64_alpha_vec targ_selvecs=ecoffalpha_little_vec + want64=true ;; alpha*-*-*vms*) targ_defvec=vms_alpha_vec + want64=true ;; alpha*-*-*) targ_defvec=ecoffalpha_little_vec + want64=true ;; ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu) targ_defvec=bfd_elf64_ia64_little_vec targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec" + want64=true ;; ia64*-*-hpux*) targ_defvec=bfd_elf32_ia64_hpux_big_vec targ_selvecs="bfd_elf64_ia64_hpux_big_vec" + want64=true ;; - sparc64-*-freebsd* | sparc64-*-netbsd* | sparc64-*-openbsd* | sparc64-*-kfreebsd*-gnu) + sparc64-*-freebsd* | sparc64-*-kfreebsd*-gnu) + targ_defvec=bfd_elf64_sparc_freebsd_vec + targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec" + ;; + sparc64-*-netbsd* | sparc64-*-openbsd*) targ_defvec=bfd_elf64_sparc_vec targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec" + want64=true ;; #endif /* BFD64 */ @@ -215,8 +233,8 @@ case "${targ}" in targ_cflags=-DARM_COFF_BUGFIX ;; arm-wince-pe | arm-*-wince) - targ_defvec=armpe_little_vec - targ_selvecs="armpe_little_vec armpe_big_vec armpei_little_vec armpei_big_vec" + targ_defvec=arm_wince_pe_little_vec + targ_selvecs="arm_wince_pe_little_vec arm_wince_pe_big_vec arm_wince_pei_little_vec arm_wince_pei_big_vec" targ_underscore=no targ_cflags="-DARM_WINCE -DARM_COFF_BUGFIX" ;; @@ -340,6 +358,11 @@ case "${targ}" in targ_underscore=yes ;; + cr16-*-elf*) + targ_defvec=bfd_elf32_cr16_vec + targ_underscore=yes + ;; + cr16c-*-elf*) targ_defvec=bfd_elf32_cr16c_vec targ_underscore=yes @@ -369,6 +392,11 @@ case "${targ}" in targ_defvec=bfd_elf32_d30v_vec ;; + fido-*-elf* ) + targ_defvec=bfd_elf32_m68k_vec + targ_selvecs="m68kcoff_vec ieee_vec" + ;; + fr30-*-elf) targ_defvec=bfd_elf32_fr30_vec ;; @@ -407,11 +435,13 @@ case "${targ}" in hppa*64*-*-linux-*) targ_defvec=bfd_elf64_hppa_linux_vec targ_selvecs=bfd_elf64_hppa_vec + want64=true ;; hppa*64*-*-hpux11*) targ_defvec=bfd_elf64_hppa_vec targ_selvecs=bfd_elf64_hppa_linux_vec targ_cflags=-DHPUX_LARGE_AR_IDS + want64=true ;; #endif @@ -553,18 +583,28 @@ case "${targ}" in x86_64-*-elf*) targ_defvec=bfd_elf64_x86_64_vec targ_selvecs="bfd_elf32_i386_vec i386coff_vec" + want64=true ;; x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu) - targ_defvec=bfd_elf64_x86_64_vec - targ_selvecs="bfd_elf32_i386_vec i386coff_vec bfd_efi_app_ia32_vec" + targ_defvec=bfd_elf64_x86_64_freebsd_vec + targ_selvecs="bfd_elf32_i386_freebsd_vec i386coff_vec bfd_efi_app_ia32_vec bfd_efi_app_x86_64_vec bfd_elf32_i386_vec bfd_elf64_x86_64_vec" + want64=true ;; x86_64-*-netbsd* | x86_64-*-openbsd*) targ_defvec=bfd_elf64_x86_64_vec - targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec bfd_efi_app_ia32_vec" + targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec bfd_efi_app_ia32_vec bfd_efi_app_x86_64_vec" + want64=true ;; x86_64-*-linux-*) targ_defvec=bfd_elf64_x86_64_vec - targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec" + targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec bfd_efi_app_x86_64_vec" + want64=true + ;; + x86_64-*-mingw*) + targ_defvec=x86_64pe_vec + targ_selvecs="x86_64pe_vec x86_64pei_vec x86_64coff_vec bfd_elf64_x86_64_vec" + want64=true + targ_underscore=yes ;; #endif i[3-7]86-*-lynxos*) @@ -644,7 +684,7 @@ case "${targ}" in targ_selvecs="b_out_vec_big_host icoff_little_vec icoff_big_vec ieee_vec" targ_underscore=yes ;; - i960-*-vxworks5.* | i960-*-coff* | i960-*-sysv* | i960-*-rtems*) + i960-*-vxworks5.* | i960-*-coff* | i960-*-sysv*) targ_defvec=icoff_little_vec targ_selvecs="icoff_big_vec b_out_vec_little_host b_out_vec_big_host ieee_vec" targ_underscore=yes @@ -675,17 +715,14 @@ case "${targ}" in targ_defvec=bfd_elf32_m32rlelin_vec targ_selvecs="bfd_elf32_m32rlin_vec bfd_elf32_m32rlelin_vec" ;; - m32r*-*-linux*) targ_defvec=bfd_elf32_m32rlin_vec targ_selvecs="bfd_elf32_m32rlin_vec bfd_elf32_m32rlelin_vec" ;; - m32r*le-*-*) targ_defvec=bfd_elf32_m32rle_vec targ_selvecs="bfd_elf32_m32r_vec bfd_elf32_m32rle_vec" ;; - m32r-*-*) targ_defvec=bfd_elf32_m32r_vec ;; @@ -699,13 +736,6 @@ case "${targ}" in targ_selvecs="bfd_elf32_m68hc11_vec bfd_elf32_m68hc12_vec" ;; - m68*-apollo-*) - targ_defvec=apollocoff_vec - ;; - m68*-bull-sysv*) - targ_defvec=m68kcoffun_vec - targ_underscore=yes - ;; m68*-motorola-sysv*) targ_defvec=m68ksysvcoff_vec ;; @@ -721,10 +751,6 @@ case "${targ}" in targ_selvecs="cisco_core_big_vec ieee_vec" targ_underscore=yes ;; - m68*-*-rtemscoff*) - targ_defvec=m68kcoff_vec - targ_selvecs="m68kcoff_vec versados_vec ieee_vec aout0_big_vec" - ;; m68*-*-elf* | m68*-*-sysv4* | m68*-*-uclinux*) targ_defvec=bfd_elf32_m68k_vec targ_selvecs="m68kcoff_vec ieee_vec" @@ -788,9 +814,6 @@ case "${targ}" in targ_defvec=bfd_elf32_m68k_vec targ_selvecs=m68kcoff_vec ;; - m68*-apple-aux*) - targ_defvec=m68kaux_coff_vec - ;; m68*-*-psos*) targ_defvec=bfd_elf32_m68k_vec targ_selvecs=ieee_vec @@ -827,6 +850,11 @@ case "${targ}" in targ_selvecs="mcore_pe_big_vec mcore_pe_little_vec mcore_pei_big_vec mcore_pei_little_vec" ;; + mep-*-elf) + targ_defvec=bfd_elf32_mep_vec + targ_selvecs=bfd_elf32_mep_little_vec + ;; + mips*-big-*) targ_defvec=ecoff_big_vec targ_selvecs=ecoff_little_vec @@ -855,6 +883,7 @@ case "${targ}" in mips*-*-irix6*) targ_defvec=bfd_elf32_nbigmips_vec targ_selvecs="bfd_elf32_nlittlemips_vec bfd_elf32_bigmips_vec bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec" + want64=true ;; #endif mips*-*-irix5*) @@ -881,12 +910,24 @@ case "${targ}" in mips*el-*-vxworks*) targ_defvec=bfd_elf32_littlemips_vxworks_vec targ_selvecs="bfd_elf32_littlemips_vec bfd_elf32_bigmips_vxworks_vec bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec" + want64=true ;; mips*-*-vxworks*) targ_defvec=bfd_elf32_bigmips_vxworks_vec targ_selvecs="bfd_elf32_bigmips_vec bfd_elf32_littlemips_vxworks_vec bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec" + want64=true ;; #endif + mips*el-sde-elf*) + targ_defvec=bfd_elf32_tradlittlemips_vec + targ_selvecs="bfd_elf32_tradbigmips_vec bfd_elf32_ntradbigmips_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec" + want64=true + ;; + mips*-sde-elf*) + targ_defvec=bfd_elf32_tradbigmips_vec + targ_selvecs="bfd_elf32_tradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec" + want64=true + ;; mips*el-*-elf* | mips*el-*-vxworks* | mips*-*-chorus*) targ_defvec=bfd_elf32_littlemips_vec targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec" @@ -903,6 +944,7 @@ case "${targ}" in mips64*-*-openbsd*) targ_defvec=bfd_elf64_tradbigmips_vec targ_selvecs="bfd_elf32_ntradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf64_tradlittlemips_vec" + want64=true ;; #endif mips*el-*-openbsd*) @@ -917,10 +959,12 @@ case "${targ}" in mips64*el-*-linux*) targ_defvec=bfd_elf32_ntradlittlemips_vec targ_selvecs="bfd_elf32_ntradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf64_tradbigmips_vec" + want64=true ;; mips64*-*-linux*) targ_defvec=bfd_elf32_ntradbigmips_vec targ_selvecs="bfd_elf32_ntradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec" + want64=true ;; #endif mips*el-*-linux*) @@ -937,6 +981,7 @@ case "${targ}" in mmix-*-*) targ_defvec=bfd_elf64_mmix_vec targ_selvecs=bfd_mmo_vec + want64=true ;; #endif mn10200-*-*) @@ -969,7 +1014,7 @@ case "${targ}" in targ_defvec=bfd_elf32_openrisc_vec ;; - or32-*-coff | or32-*-rtems* ) + or32-*-coff) targ_defvec=or32coff_big_vec targ_underscore=yes ;; @@ -1034,15 +1079,18 @@ case "${targ}" in powerpc64-*-aix*) targ_defvec=rs6000coff64_vec targ_selvecs=rs6000coff_vec + want64=true ;; powerpc64-*-elf* | powerpc-*-elf64* | powerpc64-*-linux* | \ powerpc64-*-*bsd*) targ_defvec=bfd_elf64_powerpc_vec targ_selvecs="bfd_elf64_powerpcle_vec bfd_elf32_powerpc_vec bfd_elf32_powerpcle_vec rs6000coff_vec rs6000coff64_vec" + want64=true ;; powerpc64le-*-elf* | powerpcle-*-elf64*) targ_defvec=bfd_elf64_powerpcle_vec targ_selvecs="bfd_elf64_powerpc_vec bfd_elf32_powerpcle_vec bfd_elf32_powerpc_vec rs6000coff_vec rs6000coff64_vec" + want64=true ;; #endif powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \ @@ -1107,40 +1155,49 @@ case "${targ}" in s390x-*-linux*) targ_defvec=bfd_elf64_s390_vec targ_selvecs=bfd_elf32_s390_vec + want64=true ;; s390x-*-tpf*) targ_defvec=bfd_elf64_s390_vec + want64=true ;; #endif + score*-*-elf*) + targ_defvec=bfd_elf32_bigscore_vec + targ_selvecs=bfd_elf32_littlescore_vec + ;; + #ifdef BFD64 sh64l*-*-elf*) targ_defvec=bfd_elf32_sh64l_vec targ_selvecs="bfd_elf32_sh64_vec bfd_elf64_sh64l_vec bfd_elf64_sh64_vec bfd_elf32_shl_vec bfd_elf32_sh_vec" targ_underscore=yes + want64=true ;; sh64-*-elf*) targ_defvec=bfd_elf32_sh64_vec targ_selvecs="bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec bfd_elf32_sh_vec bfd_elf32_shl_vec" targ_underscore=yes + want64=true ;; sh64eb-*-linux*) targ_defvec=bfd_elf32_sh64blin_vec targ_selvecs="bfd_elf32_sh64lin_vec bfd_elf64_sh64blin_vec bfd_elf64_sh64lin_vec bfd_elf32_shblin_vec bfd_elf32_shlin_vec" + want64=true ;; sh64-*-linux*) targ_defvec=bfd_elf32_sh64lin_vec targ_selvecs="bfd_elf32_sh64blin_vec bfd_elf64_sh64lin_vec bfd_elf64_sh64blin_vec bfd_elf32_shlin_vec bfd_elf32_shblin_vec" + want64=true ;; -#endif /* BFD64 */ - sh-*-linux*) targ_defvec=bfd_elf32_shblin_vec - targ_selvecs=bfd_elf32_shlin_vec -#ifdef BFD64 - targ_selvecs="${targ_selvecs} bfd_elf32_sh64lin_vec bfd_elf32_sh64blin_vec bfd_elf64_sh64lin_vec bfd_elf64_sh64blin_vec" -#endif + targ_selvecs="bfd_elf32_shlin_vec bfd_elf32_sh64lin_vec bfd_elf32_sh64blin_vec bfd_elf64_sh64lin_vec bfd_elf64_sh64blin_vec" + want64=true ;; +#endif /* BFD64 */ + sh*eb-*-linux*) targ_defvec=bfd_elf32_shblin_vec targ_selvecs=bfd_elf32_shlin_vec @@ -1150,40 +1207,49 @@ case "${targ}" in targ_selvecs=bfd_elf32_shblin_vec ;; + sh-*-uclinux* | sh[12]-*-uclinux*) + targ_defvec=bfd_elf32_sh_vec + targ_selvecs="bfd_elf32_shblin_vec bfd_elf32_shlin_vec" +#ifdef BFD64 + targ_selvecs="${targ_selvecs} bfd_elf32_sh64lin_vec bfd_elf32_sh64blin_vec bfd_elf64_sh64lin_vec bfd_elf64_sh64blin_vec" +#endif + ;; + #ifdef BFD64 sh5le-*-netbsd*) targ_defvec=bfd_elf32_sh64lnbsd_vec targ_selvecs="bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec bfd_elf32_shnbsd_vec bfd_elf32_shlnbsd_vec" + want64=true ;; sh5-*-netbsd*) targ_defvec=bfd_elf32_sh64nbsd_vec targ_selvecs="bfd_elf32_sh64lnbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec bfd_elf32_shnbsd_vec bfd_elf32_shlnbsd_vec" + want64=true ;; sh64le-*-netbsd*) targ_defvec=bfd_elf64_sh64lnbsd_vec targ_selvecs="bfd_elf64_sh64nbsd_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf32_shnbsd_vec bfd_elf32_shlnbsd_vec" + want64=true ;; sh64-*-netbsd*) targ_defvec=bfd_elf64_sh64nbsd_vec targ_selvecs="bfd_elf64_sh64lnbsd_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf32_shnbsd_vec bfd_elf32_shlnbsd_vec" + want64=true ;; -#endif sh*l*-*-netbsdelf*) targ_defvec=bfd_elf32_shlnbsd_vec - targ_selvecs="bfd_elf32_shnbsd_vec shcoff_vec shlcoff_vec" -#ifdef BFD64 - targ_selvecs="${targ_selvecs} bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec" -#endif + targ_selvecs="bfd_elf32_shnbsd_vec shcoff_vec shlcoff_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec" + want64=true ;; sh-*-netbsdelf*) targ_defvec=bfd_elf32_shnbsd_vec - targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec" -#ifdef BFD64 - targ_selvecs="${targ_selvecs} bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec" -#endif + targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec" + want64=true ;; +#endif + sh*-*-netbsdelf*) targ_defvec=bfd_elf32_shnbsd_vec targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec" @@ -1193,40 +1259,48 @@ case "${targ}" in targ_selvecs="shlcoff_vec shlcoff_small_vec" targ_underscore=yes ;; + +#ifdef BFD64 shl*-*-elf* | sh[1234]l*-*-elf* | sh3el*-*-elf* | shl*-*-kaos*) targ_defvec=bfd_elf32_shl_vec - targ_selvecs="bfd_elf32_sh_vec shlcoff_vec shcoff_vec shlcoff_small_vec shcoff_small_vec" -#ifdef BFD64 - targ_selvecs="${targ_selvecs} bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec" -#endif + targ_selvecs="bfd_elf32_sh_vec shlcoff_vec shcoff_vec shlcoff_small_vec shcoff_small_vec bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec" targ_underscore=yes + want64=true ;; +#endif + sh-*-rtemscoff*) targ_defvec=shcoff_vec targ_selvecs="shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec" targ_underscore=yes ;; + +#ifdef BFD64 sh-*-elf* | sh[1234]*-elf* | sh-*-rtems* | sh-*-kaos*) targ_defvec=bfd_elf32_sh_vec - targ_selvecs="bfd_elf32_shl_vec shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec" -#ifdef BFD64 - targ_selvecs="${targ_selvecs} bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec" -#endif + targ_selvecs="bfd_elf32_shl_vec shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec" targ_underscore=yes + want64=true ;; +#endif + sh-*-nto*) targ_defvec=bfd_elf32_sh_vec targ_selvecs="bfd_elf32_shl_vec shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec" targ_underscore=yes ;; + sh*-*-openbsd*) + targ_defvec=bfd_elf32_shlnbsd_vec + targ_selvecs="bfd_elf32_shnbsd_vec shcoff_vec shlcoff_vec" + ;; sh-*-pe) targ_defvec=shlpe_vec targ_selvecs="shlpe_vec shlpei_vec" 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. @@ -1287,6 +1361,7 @@ case "${targ}" in sparc-*-solaris2* | sparcv9-*-solaris2* | sparc64-*-solaris2*) targ_defvec=bfd_elf32_sparc_vec targ_selvecs="bfd_elf64_sparc_vec sunos_big_vec" + want64=true ;; #endif sparc-*-sysv4*) @@ -1304,14 +1379,17 @@ case "${targ}" in sparc64-*-aout*) targ_defvec=sunos_big_vec targ_underscore=yes + want64=true ;; sparc64-*-linux-*) targ_defvec=bfd_elf64_sparc_vec targ_selvecs="bfd_elf32_sparc_vec sparclinux_vec sunos_big_vec" + want64=true ;; sparc64-*-elf*) targ_defvec=bfd_elf64_sparc_vec targ_selvecs=bfd_elf32_sparc_vec + want64=true ;; #endif /* BFD64 */ sparc*-*-coff*) @@ -1326,6 +1404,10 @@ case "${targ}" in targ_underscore=yes ;; + spu-*-elf) + targ_defvec=bfd_elf32_spu_vec + ;; + #if HAVE_host_aout_vec tahoe-*-*) targ_defvec=host_aout_vec diff --git a/contrib/binutils/bfd/config.in b/contrib/binutils/bfd/config.in index 6c738257d982..aa91dd698881 100644 --- a/contrib/binutils/bfd/config.in +++ b/contrib/binutils/bfd/config.in @@ -1,29 +1,9 @@ /* config.in. Generated from configure.in by autoheader. */ -/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP - systems. This function is required for `alloca.c' support on those systems. - */ -#undef CRAY_STACKSEG_END - -/* Define to 1 if using `alloca.c'. */ -#undef C_ALLOCA - -/* Define to 1 if NLS is requested */ +/* Define to 1 if translation of program messages to the user's native + language is requested. */ #undef ENABLE_NLS -/* Define to 1 if you have `alloca', as a function or macro. */ -#undef HAVE_ALLOCA - -/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). - */ -#undef HAVE_ALLOCA_H - -/* Define to 1 if you have the <argz.h> header file. */ -#undef HAVE_ARGZ_H - -/* Define to 1 if you have the `dcgettext' function. */ -#undef HAVE_DCGETTEXT - /* Define to 1 if you have the declaration of `basename', and to 0 if you don't. */ #undef HAVE_DECL_BASENAME @@ -83,6 +63,9 @@ */ #undef HAVE_DIRENT_H +/* Define to 1 if you have the <dlfcn.h> header file. */ +#undef HAVE_DLFCN_H + /* Define to 1 if you have the `fcntl' function. */ #undef HAVE_FCNTL @@ -107,33 +90,18 @@ /* Define to 1 if you have the `ftello64' function. */ #undef HAVE_FTELLO64 -/* Define to 1 if you have the `getcwd' function. */ -#undef HAVE_GETCWD - /* Define to 1 if you have the `getgid' function. */ #undef HAVE_GETGID /* Define to 1 if you have the `getpagesize' function. */ #undef HAVE_GETPAGESIZE -/* Define as 1 if you have gettext and don't want to use GNU gettext. */ -#undef HAVE_GETTEXT - /* Define to 1 if you have the `getuid' function. */ #undef HAVE_GETUID /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H -/* Define if your locale.h file contains LC_MESSAGES. */ -#undef HAVE_LC_MESSAGES - -/* Define to 1 if you have the <limits.h> header file. */ -#undef HAVE_LIMITS_H - -/* Define to 1 if you have the <locale.h> header file. */ -#undef HAVE_LOCALE_H - /* Define if <sys/procfs.h> has lwpstatus_t. */ #undef HAVE_LWPSTATUS_T @@ -149,9 +117,6 @@ /* Define to 1 if you have the `madvise' function. */ #undef HAVE_MADVISE -/* Define to 1 if you have the <malloc.h> header file. */ -#undef HAVE_MALLOC_H - /* Define to 1 if you have the <memory.h> header file. */ #undef HAVE_MEMORY_H @@ -161,15 +126,9 @@ /* Define to 1 if you have the `mprotect' function. */ #undef HAVE_MPROTECT -/* Define to 1 if you have the `munmap' function. */ -#undef HAVE_MUNMAP - /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ #undef HAVE_NDIR_H -/* Define to 1 if you have the <nl_types.h> header file. */ -#undef HAVE_NL_TYPES_H - /* Define if <sys/procfs.h> has prpsinfo32_t. */ #undef HAVE_PRPSINFO32_T @@ -200,21 +159,12 @@ /* Define if <sys/procfs.h> has pstatus_t. */ #undef HAVE_PSTATUS_T -/* Define to 1 if you have the `putenv' function. */ -#undef HAVE_PUTENV - /* Define if <sys/procfs.h> has pxstatus_t. */ #undef HAVE_PXSTATUS_T -/* Define to 1 if you have the `setenv' function. */ -#undef HAVE_SETENV - /* Define to 1 if you have the `setitimer' function. */ #undef HAVE_SETITIMER -/* Define to 1 if you have the `setlocale' function. */ -#undef HAVE_SETLOCALE - /* Define to 1 if you have the <stddef.h> header file. */ #undef HAVE_STDDEF_H @@ -224,15 +174,6 @@ /* Define to 1 if you have the <stdlib.h> header file. */ #undef HAVE_STDLIB_H -/* Define if you have the stpcpy function */ -#undef HAVE_STPCPY - -/* Define to 1 if you have the `strcasecmp' function. */ -#undef HAVE_STRCASECMP - -/* Define to 1 if you have the `strchr' function. */ -#undef HAVE_STRCHR - /* Define to 1 if you have the <strings.h> header file. */ #undef HAVE_STRINGS_H @@ -259,9 +200,6 @@ */ #undef HAVE_SYS_NDIR_H -/* Define to 1 if you have the <sys/param.h> header file. */ -#undef HAVE_SYS_PARAM_H - /* Define to 1 if you have the <sys/procfs.h> header file. */ #undef HAVE_SYS_PROCFS_H @@ -280,20 +218,12 @@ /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H -/* Define to 1 if you have the <values.h> header file. */ -#undef HAVE_VALUES_H - /* Define if <sys/procfs.h> has win32_pstatus_t. */ #undef HAVE_WIN32_PSTATUS_T -/* Define to 1 if you have the `__argz_count' function. */ -#undef HAVE___ARGZ_COUNT - -/* Define to 1 if you have the `__argz_next' function. */ -#undef HAVE___ARGZ_NEXT - -/* Define to 1 if you have the `__argz_stringify' function. */ -#undef HAVE___ARGZ_STRINGIFY +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR /* Name of package */ #undef PACKAGE @@ -313,6 +243,12 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* The size of a `char', as computed by sizeof. */ +#undef SIZEOF_CHAR + +/* The size of a `int', as computed by sizeof. */ +#undef SIZEOF_INT + /* The size of a `long', as computed by sizeof. */ #undef SIZEOF_LONG @@ -322,13 +258,11 @@ /* The size of a `off_t', as computed by sizeof. */ #undef SIZEOF_OFF_T -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ -#undef STACK_DIRECTION +/* The size of a `short', as computed by sizeof. */ +#undef SIZEOF_SHORT + +/* The size of a `void *', as computed by sizeof. */ +#undef SIZEOF_VOID_P /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS @@ -358,18 +292,3 @@ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline -#endif - -/* Define to `long' if <sys/types.h> does not define. */ -#undef off_t - -/* Define to `unsigned' if <sys/types.h> does not define. */ -#undef size_t diff --git a/contrib/binutils/bfd/configure b/contrib/binutils/bfd/configure index af6c22b5a669..3cff895158fc 100755 --- a/contrib/binutils/bfd/configure +++ b/contrib/binutils/bfd/configure @@ -241,6 +241,155 @@ IFS=" $as_nl" $as_unset CDPATH + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$lt_ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','` + ;; +esac + +ECHO=${lt_ECHO-echo} +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then + # Yippee, $ECHO works! + : +else + # Restart under the correct shell. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<_LT_EOF +$* +_LT_EOF + exit 0 +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test -z "$lt_ECHO"; then + if test "X${echo_test_string+set}" != Xset; then + # find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if { echo_test_string=`eval $cmd`; } 2>/dev/null && + { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null + then + break + fi + done + fi + + if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : + else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + ECHO="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$ECHO" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + ECHO='print -r' + elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + ECHO='printf %s\n' + if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + ECHO="$CONFIG_SHELL $0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + ECHO="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + ECHO=echo + fi + fi + fi + fi + fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +lt_ECHO=$ECHO +if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then + lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" +fi + + + + # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. @@ -309,7 +458,7 @@ ac_includes_default="\ # include <unistd.h> #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE AR ac_ct_AR RANLIB ac_ct_RANLIB LN_S LIBTOOL WARN_CFLAGS NO_WERROR MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT INSTALL_LIBBFD_TRUE INSTALL_LIBBFD_FALSE host_noncanonical target_noncanonical bfdlibdir bfdincludedir CPP EGREP ALLOCA USE_NLS MSGFMT GMSGFMT XGETTEXT USE_INCLUDED_LIBINTL CATALOGS CATOBJEXT DATADIRNAME GMOFILES INSTOBJEXT INTLDEPS INTLLIBS INTLOBJS POFILES POSUB INCLUDE_LOCALE_H GT_NO GT_YES MKINSTALLDIRS l HDEFINES BFD_HOST_64BIT_LONG BFD_HOST_LONG_LONG BFD_HOST_64_BIT_DEFINED BFD_HOST_64_BIT BFD_HOST_U_64_BIT CC_FOR_BUILD EXEEXT_FOR_BUILD COREFILE COREFLAG WIN32LDFLAGS WIN32LIBADD TDEFINES wordsize bfd_libs all_backends bfd_backends bfd_machines bfd_default_target_size bfd_file_ptr bfd_ufile_ptr tdefaults datarootdir docdir htmldir LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE AR ac_ct_AR RANLIB ac_ct_RANLIB LIBTOOL SED EGREP FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM LN_S lt_ECHO CPP DEBUGDIR PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI WARN_CFLAGS NO_WERROR MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT GENINSRC_NEVER_TRUE GENINSRC_NEVER_FALSE INSTALL_LIBBFD_TRUE INSTALL_LIBBFD_FALSE host_noncanonical target_noncanonical bfdlibdir bfdincludedir USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT MKINSTALLDIRS MSGFMT MSGMERGE HDEFINES BFD_HOST_64BIT_LONG BFD_HOST_LONG_LONG BFD_HOST_64_BIT_DEFINED BFD_HOST_64_BIT BFD_HOST_U_64_BIT CC_FOR_BUILD EXEEXT_FOR_BUILD COREFILE COREFLAG WIN32LDFLAGS WIN32LIBADD TDEFINES wordsize bfd64_libs all_backends bfd_backends bfd_machines bfd_default_target_size bfd_file_ptr bfd_ufile_ptr tdefaults datarootdir docdir htmldir LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -852,16 +1001,19 @@ Optional Features: --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors - --enable-shared=PKGS build shared libraries default=no - --enable-static=PKGS build static libraries default=yes - --enable-fast-install=PKGS optimize for fast installation default=yes + --enable-shared[=PKGS] + build shared libraries [default=no] + --enable-static[=PKGS] + build static libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes) --enable-targets alternative target configurations --enable-commonbfdlib build shared BFD/opcodes/libiberty library --enable-secureplt Default to creating read-only plt entries - --enable-werror treat compile warnings as errors - --enable-build-warnings Enable build-time compiler warnings + --enable-werror treat compile warnings as errors + --enable-build-warnings enable build-time compiler warnings --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-install-libbfd controls installation of libbfd and related headers @@ -870,10 +1022,16 @@ Optional Features: Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-gnu-ld assume the C compiler uses GNU ld default=no - --with-pic try to use only PIC/non-PIC objects default=use both + --with-pic try to use only PIC/non-PIC objects [default=use + both] + --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-mmap try using mmap for BFD input files if available - --with-included-gettext use the GNU gettext library included here + --with-separate-debug-dir=DIR + Look for global separate debug info in DIR + [default=LIBDIR/debug] + --with-pkgversion=PKG Use PKG in the version string in place of "GNU + Binutils" + --with-bugurl=URL Direct users to URL to report a bug Some influential environment variables: CC C compiler command @@ -2836,7 +2994,7 @@ fi # Define the identity of the package. PACKAGE=bfd - VERSION=2.17 + VERSION=2.17.50 cat >>confdefs.h <<_ACEOF @@ -3240,1303 +3398,34 @@ fi if test "${enable_shared+set}" = set; then enableval="$enable_shared" p=${PACKAGE-default} -case $enableval in -yes) enable_shared=yes ;; -no) enable_shared=no ;; -*) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac -else - enable_shared=no -fi; - -# Check whether --enable-static or --disable-static was given. -if test "${enable_static+set}" = set; then - enableval="$enable_static" - p=${PACKAGE-default} -case $enableval in -yes) enable_static=yes ;; -no) enable_static=no ;; -*) - enable_static=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac -else - enable_static=yes -fi; -# Check whether --enable-fast-install or --disable-fast-install was given. -if test "${enable_fast_install+set}" = set; then - enableval="$enable_fast_install" - p=${PACKAGE-default} -case $enableval in -yes) enable_fast_install=yes ;; -no) enable_fast_install=no ;; -*) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac -else - enable_fast_install=yes -fi; - -# Check whether --with-gnu-ld or --without-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then - withval="$with_gnu_ld" - test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi; -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - echo "$as_me:$LINENO: checking for ld used by GCC" >&5 -echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | [A-Za-z]:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - echo "$as_me:$LINENO: checking for GNU ld" >&5 -echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 -else - echo "$as_me:$LINENO: checking for non-GNU ld" >&5 -echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 -fi -if test "${lt_cv_path_LD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - lt_cv_path_LD="$LD" # Let the user override the test with a path. -fi -fi - -LD="$lt_cv_path_LD" -if test -n "$LD"; then - echo "$as_me:$LINENO: result: $LD" >&5 -echo "${ECHO_T}$LD" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 -echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} - { (exit 1); exit 1; }; } -echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 -echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 -if test "${lt_cv_prog_gnu_ld+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then - lt_cv_prog_gnu_ld=yes -else - lt_cv_prog_gnu_ld=no -fi -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5 -echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 -with_gnu_ld=$lt_cv_prog_gnu_ld - - -echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 -echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6 -if test "${lt_cv_ld_reload_flag+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_ld_reload_flag='-r' -fi -echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 -echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 -reload_flag=$lt_cv_ld_reload_flag -test -n "$reload_flag" && reload_flag=" $reload_flag" - -echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 -echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 -if test "${lt_cv_path_NM+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - test -z "$ac_dir" && ac_dir=. - tmp_nm=$ac_dir/${ac_tool_prefix}nm - if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then - lt_cv_path_NM="$tmp_nm -B" - break - elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - lt_cv_path_NM="$tmp_nm -p" - break - else - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - fi - fi - done - IFS="$ac_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi -fi - -NM="$lt_cv_path_NM" -echo "$as_me:$LINENO: result: $NM" >&5 -echo "${ECHO_T}$NM" >&6 - -echo "$as_me:$LINENO: checking whether ln -s works" >&5 -echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me:$LINENO: result: no, using $LN_S" >&5 -echo "${ECHO_T}no, using $LN_S" >&6 -fi - -echo "$as_me:$LINENO: checking how to recognise dependant libraries" >&5 -echo $ECHO_N "checking how to recognise dependant libraries... $ECHO_C" >&6 -if test "${lt_cv_deplibs_check_method+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [regex]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given egrep regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. - -case $host_os in -aix*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi4*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin* | mingw* |pw32*) - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - # this will be overwritten by pass_all, but leave it in just in case - lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' - lt_cv_file_magic_cmd='/usr/bin/file -L' - case "$host_os" in - rhapsody* | darwin1.012) - lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System' - ;; - *) # Darwin 1.3 on - lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' - ;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | kfreebsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20*|hpux11*) - case $host_cpu in - hppa*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - esac - ;; - -irix5* | irix6*) - case $host_os in - irix5*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" - ;; - *) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" - ;; - esac - lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux-gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd* | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$' - fi - ;; - -newsos6) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -osf3* | osf4* | osf5*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' - lt_cv_file_magic_test_file=/shlib/libc.so - lt_cv_deplibs_check_method=pass_all - ;; - -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - lt_cv_file_magic_test_file=/lib/libc.so - ;; - -sysv5uw[78]* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - case $host_vendor in - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - motorola) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - esac - ;; -esac - -fi -echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 -echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method - - - - -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! - -# find the maximum length of command line arguments -echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 -echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 -if test "${lt_cv_sys_max_cmd_len+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for *BSD - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - esac - -fi - -if test -n "$lt_cv_sys_max_cmd_len" ; then - echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 -echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 -else - echo "$as_me:$LINENO: result: none" >&5 -echo "${ECHO_T}none" >&6 -fi - - -# Only perform the check for file, if the check method requires it -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 -echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 -if test "${lt_cv_path_MAGIC_CMD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $MAGIC_CMD in - /*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; - ?:/*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. - ;; - *) - ac_save_MAGIC_CMD="$MAGIC_CMD" - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="/usr/bin:$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/${ac_tool_prefix}file; then - lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - egrep "$file_magic_regex" > /dev/null; then - : - else - cat <<EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$ac_save_ifs" - MAGIC_CMD="$ac_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 -echo "${ECHO_T}$MAGIC_CMD" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - echo "$as_me:$LINENO: checking for file" >&5 -echo $ECHO_N "checking for file... $ECHO_C" >&6 -if test "${lt_cv_path_MAGIC_CMD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $MAGIC_CMD in - /*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; - ?:/*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. - ;; - *) - ac_save_MAGIC_CMD="$MAGIC_CMD" - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="/usr/bin:$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/file; then - lt_cv_path_MAGIC_CMD="$ac_dir/file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - egrep "$file_magic_regex" > /dev/null; then - : - else - cat <<EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$ac_save_ifs" - MAGIC_CMD="$ac_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 -echo "${ECHO_T}$MAGIC_CMD" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - else - MAGIC_CMD=: - fi -fi - - fi - ;; -esac - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - echo "$as_me:$LINENO: result: $RANLIB" >&5 -echo "${ECHO_T}$RANLIB" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 -echo "${ECHO_T}$ac_ct_RANLIB" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - RANLIB=$ac_ct_RANLIB -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - echo "$as_me:$LINENO: result: $STRIP" >&5 -echo "${ECHO_T}$STRIP" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 -echo "${ECHO_T}$ac_ct_STRIP" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - STRIP=$ac_ct_STRIP -else - STRIP="$ac_cv_prog_STRIP" -fi - - -# Check for any special flags to pass to ltconfig. -libtool_flags="--cache-file=$cache_file" -test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" -test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" -test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" -test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc" -test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" - - -# Check whether --enable-libtool-lock or --disable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then - enableval="$enable_libtool_lock" - -fi; -test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" -test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" - - -# Check whether --with-pic or --without-pic was given. -if test "${with_pic+set}" = set; then - withval="$with_pic" - pic_mode="$withval" -else - pic_mode=default -fi; -test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" -test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -*-*-irix6*) - # Find out which ABI we are using. - echo '#line 4035 "configure"' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case "`/usr/bin/file conftest.o`" in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; - -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case "`/usr/bin/file conftest.o`" in - *32-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 -echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 -if test "${lt_cv_cc_needs_belf+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - lt_cv_cc_needs_belf=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -lt_cv_cc_needs_belf=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 -echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; - - -esac - - -# Save cache, so that ltconfig can load it -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -{ - (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" ;; - esac; -} | - sed ' - t clear - : clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end' >>confcache -if diff $cache_file confcache >/dev/null 2>&1; then :; else - if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" - cat confcache >$cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -# Actually configure libtool. ac_aux_dir is where install-sh is found. -AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ -MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ -LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ -AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ -objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ -deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \ -${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ -$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \ -|| { { echo "$as_me:$LINENO: error: libtool configure failed" >&5 -echo "$as_me: error: libtool configure failed" >&2;} - { (exit 1); exit 1; }; } - -# Reload cache, that may have been modified by ltconfig -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; esac - fi -else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - -# Redirect the config.log output again, so that the ltconfig log is not -# clobbered by the next message. -exec 5>>./config.log - - - - - - - -# Check whether --enable-64-bit-bfd or --disable-64-bit-bfd was given. -if test "${enable_64_bit_bfd+set}" = set; then - enableval="$enable_64_bit_bfd" - case "${enableval}" in - yes) want64=true ;; - no) want64=false ;; - *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for 64-bit-bfd option" >&5 -echo "$as_me: error: bad value ${enableval} for 64-bit-bfd option" >&2;} - { (exit 1); exit 1; }; } ;; -esac -else - want64=false -fi; # Check whether --enable-targets or --disable-targets was given. -if test "${enable_targets+set}" = set; then - enableval="$enable_targets" - case "${enableval}" in - yes | "") { { echo "$as_me:$LINENO: error: enable-targets option must specify target names or 'all'" >&5 -echo "$as_me: error: enable-targets option must specify target names or 'all'" >&2;} - { (exit 1); exit 1; }; } - ;; - no) enable_targets= ;; - *) enable_targets=$enableval ;; -esac -fi; # Check whether --enable-commonbfdlib or --disable-commonbfdlib was given. -if test "${enable_commonbfdlib+set}" = set; then - enableval="$enable_commonbfdlib" - case "${enableval}" in - yes) commonbfdlib=true ;; - no) commonbfdlib=false ;; - *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for BFD commonbfdlib option" >&5 -echo "$as_me: error: bad value ${enableval} for BFD commonbfdlib option" >&2;} - { (exit 1); exit 1; }; } ;; -esac -fi; -# Check whether --with-mmap or --without-mmap was given. -if test "${with_mmap+set}" = set; then - withval="$with_mmap" - case "${withval}" in - yes) want_mmap=true ;; - no) want_mmap=false ;; - *) { { echo "$as_me:$LINENO: error: bad value ${withval} for BFD with-mmap option" >&5 -echo "$as_me: error: bad value ${withval} for BFD with-mmap option" >&2;} - { (exit 1); exit 1; }; } ;; -esac -else - want_mmap=false -fi; -# Check whether --enable-secureplt or --disable-secureplt was given. -if test "${enable_secureplt+set}" = set; then - enableval="$enable_secureplt" - case "${enableval}" in - yes) use_secureplt=true ;; - no) use_secureplt=false ;; - *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for secureplt option" >&5 -echo "$as_me: error: bad value ${enableval} for secureplt option" >&2;} - { (exit 1); exit 1; }; } ;; -esac -else - use_secureplt=false -fi; if test $use_secureplt = true; then - -cat >>confdefs.h <<\_ACEOF -#define USE_SECUREPLT 1 -_ACEOF - -fi - - -GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" - -# Check whether --enable-werror or --disable-werror was given. -if test "${enable_werror+set}" = set; then - enableval="$enable_werror" - case "${enableval}" in - yes | y) ERROR_ON_WARNING="yes" ;; - no | n) ERROR_ON_WARNING="no" ;; - *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-werror" >&5 -echo "$as_me: error: bad value ${enableval} for --enable-werror" >&2;} - { (exit 1); exit 1; }; } ;; - esac -fi; - -# Enable -Werror by default when using gcc -if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then - ERROR_ON_WARNING=yes -fi - -NO_WERROR= -if test "${ERROR_ON_WARNING}" = yes ; then - GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror" - NO_WERROR="-Wno-error" -fi - -if test "${GCC}" = yes ; then - WARN_CFLAGS="${GCC_WARN_CFLAGS}" -fi - -# Check whether --enable-build-warnings or --disable-build-warnings was given. -if test "${enable_build_warnings+set}" = set; then - enableval="$enable_build_warnings" - case "${enableval}" in - yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";; - no) if test "${GCC}" = yes ; then - WARN_CFLAGS="-w" - fi;; - ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` - WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";; - *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` - WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";; - *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;; -esac -fi; - -if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then - echo "Setting warning flags = $WARN_CFLAGS" 6>&1 -fi - - - - - - ac_config_headers="$ac_config_headers config.h:config.in" - - -if test -z "$target" ; then - { { echo "$as_me:$LINENO: error: Unrecognized target system type; please check config.sub." >&5 -echo "$as_me: error: Unrecognized target system type; please check config.sub." >&2;} - { (exit 1); exit 1; }; } -fi - -echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 -echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 - # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. -if test "${enable_maintainer_mode+set}" = set; then - enableval="$enable_maintainer_mode" - USE_MAINTAINER_MODE=$enableval else - USE_MAINTAINER_MODE=no -fi; - echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 -echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 - - -if test $USE_MAINTAINER_MODE = yes; then - MAINTAINER_MODE_TRUE= - MAINTAINER_MODE_FALSE='#' -else - MAINTAINER_MODE_TRUE='#' - MAINTAINER_MODE_FALSE= -fi - - MAINT=$MAINTAINER_MODE_TRUE - - - case ${build_alias} in - "") build_noncanonical=${build} ;; - *) build_noncanonical=${build_alias} ;; -esac - - case ${host_alias} in - "") host_noncanonical=${build_noncanonical} ;; - *) host_noncanonical=${host_alias} ;; -esac - - case ${target_alias} in - "") target_noncanonical=${host_noncanonical} ;; - *) target_noncanonical=${target_alias} ;; -esac - -echo "$as_me:$LINENO: checking whether to install libbfd" >&5 -echo $ECHO_N "checking whether to install libbfd... $ECHO_C" >&6 - # Check whether --enable-install-libbfd or --disable-install-libbfd was given. -if test "${enable_install_libbfd+set}" = set; then - enableval="$enable_install_libbfd" - install_libbfd_p=$enableval -else - if test "${host}" = "${target}" || test "$enable_shared" = "yes"; then - install_libbfd_p=yes - else - install_libbfd_p=no - fi + enable_shared=no fi; - echo "$as_me:$LINENO: result: $install_libbfd_p" >&5 -echo "${ECHO_T}$install_libbfd_p" >&6 -if test $install_libbfd_p = yes; then - INSTALL_LIBBFD_TRUE= - INSTALL_LIBBFD_FALSE='#' -else - INSTALL_LIBBFD_TRUE='#' - INSTALL_LIBBFD_FALSE= -fi - # Need _noncanonical variables for this. - # libbfd.a is a host library containing target dependent code - bfdlibdir='$(libdir)' - bfdincludedir='$(includedir)' - if test "${host}" != "${target}"; then - bfdlibdir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/lib' - bfdincludedir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/include' - fi - - - - -host64=false -target64=false -bfd_default_target_size=32 - -# host stuff: - ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -5273,7 +4162,1149 @@ _ACEOF -ALL_LINGUAS="fr tr ja es sv da zh_CN ro rw vi" + + +macro_version='2.1a' +macro_revision='1.2435' + + + + + + + + + + + + +ltmain="$ac_aux_dir/ltmain.sh" + +# Set options + +enable_dlopen=no + + +enable_win32_dll=no + + + +# Check whether --enable-static or --disable-static was given. +if test "${enable_static+set}" = set; then + enableval="$enable_static" + p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=yes +fi; + + + + + + + + + +# Check whether --with-pic or --without-pic was given. +if test "${with_pic+set}" = set; then + withval="$with_pic" + pic_mode="$withval" +else + pic_mode=default +fi; + +test -z "$pic_mode" && pic_mode=default + + + + + + + +# Check whether --enable-fast-install or --disable-fast-install was given. +if test "${enable_fast_install+set}" = set; then + enableval="$enable_fast_install" + p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=yes +fi; + + + + + + + + +echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 +echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 +if test "${lt_cv_path_SED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done + +fi + +SED=$lt_cv_path_SED + +echo "$as_me:$LINENO: result: $SED" >&5 +echo "${ECHO_T}$SED" >&6 + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +echo "$as_me:$LINENO: checking for fgrep" >&5 +echo $ECHO_N "checking for fgrep... $ECHO_C" >&6 +if test "${ac_cv_prog_fgrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo 'ab*c' | (grep -F 'ab*c') >/dev/null 2>&1 + then ac_cv_prog_fgrep='grep -F' + else ac_cv_prog_fgrep='fgrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_fgrep" >&5 +echo "${ECHO_T}$ac_cv_prog_fgrep" >&6 + FGREP=$ac_cv_prog_fgrep + + +test -z "$GREP" && GREP=grep + + + + + + + + + + + + + + + + + + + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi; +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo "$as_me:$LINENO: checking for ld used by $CC" >&5 +echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 +else + echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 +fi +if test "${lt_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in + *GNU* | *'with BFD'*) + test "$with_gnu_ld" != no && break + ;; + *) + test "$with_gnu_ld" != yes && break + ;; + esac + fi + done + IFS="$lt_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$lt_cv_path_LD" +if test -n "$LD"; then + echo "$as_me:$LINENO: result: $LD" >&5 +echo "${ECHO_T}$LD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 +if test "${lt_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 </dev/null` in +*GNU* | *'with BFD'*) + lt_cv_prog_gnu_ld=yes + ;; +*) + lt_cv_prog_gnu_ld=no + ;; +esac +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + + + +echo "$as_me:$LINENO: checking for BSD- or MS-compatible name lister (nm)" >&5 +echo $ECHO_N "checking for BSD- or MS-compatible name lister (nm)... $ECHO_C" >&6 +if test "${lt_cv_path_NM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi +fi +echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 +echo "${ECHO_T}$lt_cv_path_NM" >&6 +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$ac_tool_prefix"; then + for ac_prog in "dumpbin -symbols" "link -dump -symbols" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_DUMPBIN+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$DUMPBIN"; then + ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +DUMPBIN=$ac_cv_prog_DUMPBIN +if test -n "$DUMPBIN"; then + echo "$as_me:$LINENO: result: $DUMPBIN" >&5 +echo "${ECHO_T}$DUMPBIN" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$DUMPBIN" && break + done +fi +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in "dumpbin -symbols" "link -dump -symbols" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_DUMPBIN"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN +if test -n "$ac_ct_DUMPBIN"; then + echo "$as_me:$LINENO: result: $ac_ct_DUMPBIN" >&5 +echo "${ECHO_T}$ac_ct_DUMPBIN" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_DUMPBIN" && break +done +test -n "$ac_ct_DUMPBIN" || ac_ct_DUMPBIN=":" + + DUMPBIN=$ac_ct_DUMPBIN +fi + + + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm + + + + + + +echo "$as_me:$LINENO: checking the name lister ($NM) interface" >&5 +echo $ECHO_N "checking the name lister ($NM) interface... $ECHO_C" >&6 +if test "${lt_cv_nm_interface+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:4668: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:4671: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:4674: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest* +fi +echo "$as_me:$LINENO: result: $lt_cv_nm_interface" >&5 +echo "${ECHO_T}$lt_cv_nm_interface" >&6 + +echo "$as_me:$LINENO: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:$LINENO: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6 +fi + +# find the maximum length of command line arguments +echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 +echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 +if test "${lt_cv_sys_max_cmd_len+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`getconf ARG_MAX 2> /dev/null` + if test -n $lt_cv_sys_max_cmd_len; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ + = "XX$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 +echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 +else + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 +fi +max_cmd_len=$lt_cv_sys_max_cmd_len + + + + + + + +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} + +echo "$as_me:$LINENO: checking whether the shell understands some XSI constructs" >&5 +echo $ECHO_N "checking whether the shell understands some XSI constructs... $ECHO_C" >&6 +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,, ) >/dev/null 2>&1 \ + && xsi_shell=yes +echo "$as_me:$LINENO: result: $xsi_shell" >&5 +echo "${ECHO_T}$xsi_shell" >&6 + + +echo "$as_me:$LINENO: checking whether the shell understands \"+=\"" >&5 +echo $ECHO_N "checking whether the shell understands \"+=\"... $ECHO_C" >&6 +lt_shell_append=no +( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +echo "$as_me:$LINENO: result: $lt_shell_append" >&5 +echo "${ECHO_T}$lt_shell_append" >&6 + + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi + + + + + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac + + + + + + + + + +echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 +echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6 +if test "${lt_cv_ld_reload_flag+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_ld_reload_flag='-r' +fi +echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 +echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + darwin*) + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + + + + + + + + + + +echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5 +echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6 +if test "${lt_cv_deplibs_check_method+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix4* | aix5*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 +echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="false" +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 +echo "${ECHO_T}$ac_ct_AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + AR=$ac_ct_AR +else + AR="$ac_cv_prog_AR" +fi + +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STRIP=$ac_ct_STRIP +else + STRIP="$ac_cv_prog_STRIP" +fi + +test -z "$STRIP" && STRIP=: + + + + + + if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 @@ -5354,6 +5385,533 @@ else RANLIB="$ac_cv_prog_RANLIB" fi +test -z "$RANLIB" && RANLIB=: + + + + + + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 +echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6 +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK '"\ +" {last_section=section; section=\$ 3};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 +else + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 +fi + + + + + + + + + + + + + + + + + +# Check whether --enable-libtool-lock or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + +fi; +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 5729 "configure"' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 +echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 +if test "${lt_cv_cc_needs_belf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + lt_cv_cc_needs_belf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +lt_cv_cc_needs_belf=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 +echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) LD="${LD-ld} -64" ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -5589,21 +6147,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6 -if test "${ac_cv_prog_egrep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then @@ -5770,132 +6313,34 @@ _ACEOF fi -echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 -echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 -if test "${ac_cv_c_const+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + -int -main () -{ -/* FIXME: Include the comments suggested by Paul. */ -#ifndef __cplusplus - /* Ultrix mips cc rejects this. */ - typedef int charset[2]; - const charset x; - /* SunOS 4.1.1 cc rejects this. */ - char const *const *ccp; - char **p; - /* NEC SVR4.0.2 mips cc rejects this. */ - struct point {int x, y;}; - static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in - an arm of an if-expression whose if-part is not a constant - expression */ - const char *g = "string"; - ccp = &g + (g ? g-g : 0); - /* HPUX 7.0 cc rejects these. */ - ++ccp; - p = (char**) ccp; - ccp = (char const *const *) p; - { /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; - - *t++ = 0; - } - { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; - } - { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; - } - { /* AIX XL C 1.02.0.0 rejects this saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; - } - { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; - } -#endif - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_c_const=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_c_const=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 -echo "${ECHO_T}$ac_cv_c_const" >&6 -if test $ac_cv_c_const = no; then -cat >>confdefs.h <<\_ACEOF -#define const -_ACEOF -fi -echo "$as_me:$LINENO: checking for inline" >&5 -echo $ECHO_N "checking for inline... $ECHO_C" >&6 -if test "${ac_cv_c_inline+set}" = set; then +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#ifndef __cplusplus -typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } -#endif +$ac_includes_default +#include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -5919,47 +6364,29 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_c_inline=$ac_kw; break + eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done - fi -echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 -echo "${ECHO_T}$ac_cv_c_inline" >&6 - - -case $ac_cv_c_inline in - inline | yes) ;; - *) - case $ac_cv_c_inline in - no) ac_val=;; - *) ac_val=$ac_cv_c_inline;; - esac - cat >>confdefs.h <<_ACEOF -#ifndef __cplusplus -#define inline $ac_val -#endif +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF - ;; -esac - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - +fi +done -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h +for ac_header in dlfcn.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 @@ -6020,156 +6447,1357 @@ fi done -echo "$as_me:$LINENO: checking for off_t" >&5 -echo $ECHO_N "checking for off_t... $ECHO_C" >&6 -if test "${ac_cv_type_off_t+set}" = set; then + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + + + + + + + + + + + + + + + + + + + + + + + + + +test -z "$LN_S" && LN_S="ln -s" + + + + + + + + + + + + + + +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +echo "$as_me:$LINENO: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&6 +if test "${lt_cv_objdir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((off_t *) 0) - return 0; -if (sizeof (off_t)) - return 0; - ; - return 0; -} + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 +echo "${ECHO_T}$lt_cv_objdir" >&6 +objdir=$lt_cv_objdir + + + + + +cat >>confdefs.h <<_ACEOF +#define LT_OBJDIR "$lt_cv_objdir/" _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_off_t=yes + + + + + + + + + + + + + + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 +echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 -ac_cv_type_off_t=no +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 -echo "${ECHO_T}$ac_cv_type_off_t" >&6 -if test $ac_cv_type_off_t = yes; then - : + + + + + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + echo "$as_me:$LINENO: checking for file" >&5 +echo $ECHO_N "checking for file... $ECHO_C" >&6 +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 -cat >>confdefs.h <<_ACEOF -#define off_t long -_ACEOF +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac fi -echo "$as_me:$LINENO: checking for size_t" >&5 -echo $ECHO_N "checking for size_t... $ECHO_C" >&6 -if test "${ac_cv_type_size_t+set}" = set; then +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Use C for the default configuration in the libtool script + +lt_save_CC="$CC" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM conftest* + + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag=' -fno-builtin' + + echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((size_t *) 0) - return 0; -if (sizeof (size_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_size_t=yes + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:6829: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:6833: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $RM conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + : +fi -ac_cv_type_size_t=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + + + + + + + lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + if test "$GCC" = yes; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + ;; + + amigaos*) + if test "$host_cpu" = m68k; then + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + fi + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic='-qnocommon' + lt_prog_compiler_wl='-Wl,' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + linux* | k*bsd*-gnu) + case $cc_basename in + icc* | ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + esac + ;; + esac + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic" >&6 + + + + + + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:7151: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:7155: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_pic_works=yes + fi + fi + $RM conftest* + fi -echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 -echo "${ECHO_T}$ac_cv_type_size_t" >&6 -if test $ac_cv_type_size_t = yes; then - : +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6 + +if test x"$lt_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi -cat >>confdefs.h <<_ACEOF -#define size_t unsigned -_ACEOF +fi + + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 +if test "${lt_prog_compiler_static_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_static_works=yes + fi + else + lt_prog_compiler_static_works=yes + fi + fi + $RM conftest* + LDFLAGS="$save_LDFLAGS" fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 -# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works -# for constant arguments. Useless! -echo "$as_me:$LINENO: checking for working alloca.h" >&5 -echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6 -if test "${ac_cv_working_alloca_h+set}" = set; then +if test x"$lt_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + + + + + + echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:7256: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:7260: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6 + + + + + + + echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:7311: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:7315: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6 + + + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + + + + echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag= + always_export_symbols=no + archive_cmds= + archive_expsym_cmds= + compiler_needs_object=no + enable_shared_with_static_runtimes=no + export_dynamic_flag_spec= + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + hardcode_automatic=no + hardcode_direct=no + hardcode_direct_absolute=no + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld= + hardcode_libdir_separator= + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + inherit_rpath=no + link_all_deplibs=unknown + module_cmds= + module_expsym_cmds= + old_archive_from_new_cmds= + old_archive_from_expsyms_cmds= + thread_safe_flag_spec= + whole_archive_flag_spec= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +_LT_EOF + fi + ;; + + amigaos*) + if test "$host_cpu" = m68k; then + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + fi + + # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach <jrb3@best.com> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + *) + tmp_sharedflag='-shared' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_direct_absolute=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + file_list_spec='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <alloca.h> + int main () { -char *p = (char *) alloca (2 * sizeof (int)); + ; return 0; } @@ -6196,62 +7824,49 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_working_alloca_h=yes + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_working_alloca_h=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5 -echo "${ECHO_T}$ac_cv_working_alloca_h" >&6 -if test $ac_cv_working_alloca_h = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_ALLOCA_H 1 -_ACEOF - -fi +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -echo "$as_me:$LINENO: checking for alloca" >&5 -echo $ECHO_N "checking for alloca... $ECHO_C" >&6 -if test "${ac_cv_func_alloca_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#ifdef __GNUC__ -# define alloca __builtin_alloca -#else -# ifdef _MSC_VER -# include <malloc.h> -# define alloca _alloca -# else -# if HAVE_ALLOCA_H -# include <alloca.h> -# else -# ifdef _AIX - #pragma alloca -# else -# ifndef alloca /* predefined by HP cc +Olibcalls */ -char *alloca (); -# endif -# endif -# endif -# endif -#endif int main () { -char *p = (char *) alloca (1); + ; return 0; } @@ -6278,125 +7893,277 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_alloca_works=yes + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_func_alloca_works=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5 -echo "${ECHO_T}$ac_cv_func_alloca_works" >&6 +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; -if test $ac_cv_func_alloca_works = yes; then + amigaos*) + if test "$host_cpu" = m68k; then + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + fi + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; -cat >>confdefs.h <<\_ACEOF -#define HAVE_ALLOCA 1 -_ACEOF + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; -else - # The SVR3 libPW and SVR4 libucb both contain incompatible functions -# that cause trouble. Some versions do not even contain alloca or -# contain a buggy version. If you still want to use their alloca, -# use ar to extract alloca.o from them instead of compiling alloca.c. + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes=yes + ;; -ALLOCA=alloca.$ac_objext + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[012]) + allow_undefined_flag='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + case ${MACOSX_DEPLOYMENT_TARGET-10.0} in + 10.[012]) + allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + ;; + esac + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + whole_archive_flag_spec='' + link_all_deplibs=yes + if test "$GCC" = yes ; then + if test "${lt_cv_apple_cc_single_mod+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi-module to the + # link flags. + echo "int foo(void){return 1;}" > conftest.c + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib ${wl}-single_module conftest.c + if test -f libconftest.dylib; then + lt_cv_apple_cc_single_mod=yes + rm libconftest.dylib + fi + rm conftest.$ac_ext + fi +fi -cat >>confdefs.h <<\_ACEOF -#define C_ALLOCA 1 -_ACEOF + output_verbose_link_cmd=echo + if test "X$lt_cv_apple_cc_single_mod" = Xyes ; then + archive_cmds='$CC -dynamiclib $single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + archive_expsym_cmds='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $single_module -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + archive_expsym_cmds='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + module_expsym_cmds='sed -e "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd=echo + archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`$ECHO $rpath/$soname` $verstring' + module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + archive_expsym_cmds='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs=no + ;; + esac + fi + ;; + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; -echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5 -echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6 -if test "${ac_cv_os_cray+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#if defined(CRAY) && ! defined(CRAY2) -webecray -#else -wenotbecray -#endif + freebsd1*) + ld_shlibs=no + ;; -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "webecray" >/dev/null 2>&1; then - ac_cv_os_cray=yes -else - ac_cv_os_cray=no -fi -rm -f conftest* + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; -fi -echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5 -echo "${ECHO_T}$ac_cv_os_cray" >&6 -if test $ac_cv_os_cray = yes; then - for ac_func in _getb67 GETB67 getb67; do - as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define $ac_func innocuous_$ac_func + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; -#undef $ac_func + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld='+b $libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; -int -main () -{ -return f != $ac_func; - ; - return 0; -} + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + cat >conftest.$ac_ext <<_ACEOF +int foo(void) {} _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 @@ -6420,304 +8187,933 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then + LDFLAGS="$save_LDFLAGS" + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + inherit_rpath=yes + link_all_deplibs=yes + ;; -cat >>confdefs.h <<_ACEOF -#define CRAY_STACKSEG_END $ac_func -_ACEOF + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; - break -fi + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; - done -fi + *nto* | *qnx*) + ;; -echo "$as_me:$LINENO: checking stack direction for C alloca" >&5 -echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6 -if test "${ac_cv_c_stack_direction+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_c_stack_direction=0 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -int -find_stack_direction () -{ - static char *addr = 0; - auto char dummy; - if (addr == 0) - { - addr = &dummy; - return find_stack_direction (); - } - else - return (&dummy > addr) ? 1 : -1; -} + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; -int -main () -{ - exit (find_stack_direction () < 0); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_c_stack_direction=1 -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; -( exit $ac_status ) -ac_cv_c_stack_direction=-1 -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5 -echo "${ECHO_T}$ac_cv_c_stack_direction" >&6 + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; -cat >>confdefs.h <<_ACEOF -#define STACK_DIRECTION $ac_cv_c_stack_direction -_ACEOF + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + archive_cmds_need_lc='no' + hardcode_libdir_separator=: + ;; -fi + solaris*) + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; -for ac_header in stdlib.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='${wl}-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='${wl}-z,text' + allow_undefined_flag='${wl}-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-R,$libdir' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + export_dynamic_flag_spec='${wl}-Blargedynsym' + ;; + esac + fi + fi + +echo "$as_me:$LINENO: result: $ld_shlibs" >&5 +echo "${ECHO_T}$ld_shlibs" >&6 +test "$ld_shlibs" = no && can_build_shared=no + +with_gnu_ld=$with_gnu_ld + + + + + + + + + + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + (exit $ac_status); } + then + archive_cmds_need_lc=no + else + archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 +echo "${ECHO_T}$archive_cmds_need_lc" >&6 + ;; + esac + fi + ;; +esac -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +withGCC=$GCC +if test "$withGCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` else - ac_cpp_err= + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib<name>.so + # instead of lib<name>.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + if test "$host_cpu" = m68k; then + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + else + dynamic_linker=no + fi + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $withGCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; -fi +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; -done +freebsd1*) + dynamic_linker=no + ;; +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[123]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; -for ac_func in getpagesize -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[3-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # Some binutils ld are patched to set DT_RUNPATH + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif int main () { -return f != $ac_func; + ; return 0; } @@ -6744,200 +9140,236 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir"; then + shlibpath_overrides_runpath=yes +fi + else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi -fi -done + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; -echo "$as_me:$LINENO: checking for working mmap" >&5 -echo $ECHO_N "checking for working mmap... $ECHO_C" >&6 -if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_mmap_fixed_mapped=no -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -/* malloc might have been renamed as rpl_malloc. */ -#undef malloc +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; -/* Thanks to Mike Haertel and Jim Avera for this test. - Here is a matrix of mmap possibilities: - mmap private not fixed - mmap private fixed at somewhere currently unmapped - mmap private fixed at somewhere already mapped - mmap shared not fixed - mmap shared fixed at somewhere currently unmapped - mmap shared fixed at somewhere already mapped - For private mappings, we should verify that changes cannot be read() - back from the file, nor mmap's back from the file at a different - address. (There have been systems where private was not correctly - implemented like the infamous i386 svr4.0, and systems where the - VM page cache was not coherent with the file system buffer cache - like early versions of FreeBSD and possibly contemporary NetBSD.) - For shared mappings, we should conversely verify that changes get - propagated back to all the places they're supposed to be. +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; - Grep wants private fixed already mapped. - The main things grep needs to know about mmap are: - * does it exist and is it safe to write into the mmap'd area - * how to use it (BSD variants) */ +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; -#include <fcntl.h> -#include <sys/mman.h> +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; -#if !STDC_HEADERS && !HAVE_STDLIB_H -char *malloc (); -#endif +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; -/* This mess was copied from the GNU getpagesize.h. */ -#if !HAVE_GETPAGESIZE -/* Assume that all systems that can run configure have sys/param.h. */ -# if !HAVE_SYS_PARAM_H -# define HAVE_SYS_PARAM_H 1 -# endif +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; -# ifdef _SC_PAGESIZE -# define getpagesize() sysconf(_SC_PAGESIZE) -# else /* no _SC_PAGESIZE */ -# if HAVE_SYS_PARAM_H -# include <sys/param.h> -# ifdef EXEC_PAGESIZE -# define getpagesize() EXEC_PAGESIZE -# else /* no EXEC_PAGESIZE */ -# ifdef NBPG -# define getpagesize() NBPG * CLSIZE -# ifndef CLSIZE -# define CLSIZE 1 -# endif /* no CLSIZE */ -# else /* no NBPG */ -# ifdef NBPC -# define getpagesize() NBPC -# else /* no NBPC */ -# ifdef PAGESIZE -# define getpagesize() PAGESIZE -# endif /* PAGESIZE */ -# endif /* no NBPC */ -# endif /* no NBPG */ -# endif /* no EXEC_PAGESIZE */ -# else /* no HAVE_SYS_PARAM_H */ -# define getpagesize() 8192 /* punt totally */ -# endif /* no HAVE_SYS_PARAM_H */ -# endif /* no _SC_PAGESIZE */ +rdos*) + dynamic_linker=no + ;; -#endif /* no HAVE_GETPAGESIZE */ +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; -int -main () -{ - char *data, *data2, *data3; - int i, pagesize; - int fd; +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; - pagesize = getpagesize (); +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; - /* First, make a file with some known garbage in it. */ - data = (char *) malloc (pagesize); - if (!data) - exit (1); - for (i = 0; i < pagesize; ++i) - *(data + i) = rand (); - umask (0); - fd = creat ("conftest.mmap", 0600); - if (fd < 0) - exit (1); - if (write (fd, data, pagesize) != pagesize) - exit (1); - close (fd); +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; - /* Next, try to mmap the file at a fixed address which already has - something else allocated at it. If we can, also make sure that - we see the same garbage. */ - fd = open ("conftest.mmap", O_RDWR); - if (fd < 0) - exit (1); - data2 = (char *) malloc (2 * pagesize); - if (!data2) - exit (1); - data2 += (pagesize - ((long) data2 & (pagesize - 1))) & (pagesize - 1); - if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_FIXED, fd, 0L)) - exit (1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data2 + i)) - exit (1); +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; - /* Finally, make sure that changes to the mapped area do not - percolate back to the file as seen by read(). (This is a bug on - some variants of i386 svr4.0.) */ - for (i = 0; i < pagesize; ++i) - *(data2 + i) = *(data2 + i) + 1; - data3 = (char *) malloc (pagesize); - if (!data3) - exit (1); - if (read (fd, data3, pagesize) != pagesize) - exit (1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data3 + i)) - exit (1); - close (fd); - exit (0); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_mmap_fixed_mapped=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux + need_lib_prefix=no + need_version=no + library_name_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; -( exit $ac_status ) -ac_cv_func_mmap_fixed_mapped=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5 -echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6 -if test $ac_cv_func_mmap_fixed_mapped = yes; then +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; -cat >>confdefs.h <<\_ACEOF -#define HAVE_MMAP 1 -_ACEOF +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi -rm -f conftest.mmap @@ -6949,155 +9381,13 @@ rm -f conftest.mmap -for ac_header in argz.h limits.h locale.h nl_types.h malloc.h string.h \ -unistd.h values.h sys/param.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF -fi -done @@ -7109,62 +9399,159 @@ done -for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \ -__argz_count __argz_stringify __argz_next -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || + test -n "$runpath_var" || + test "X$hardcode_automatic" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action" >&5 +echo "${ECHO_T}$hardcode_action" >&6 + +if test "$hardcode_action" = relink || + test "$inherit_rpath" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - -#undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" -{ #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - +char dlopen (); int main () { -return f != $ac_func; +dlopen (); ; return 0; } @@ -7191,35 +9578,35 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" +ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else -fi -done + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes +fi - if test "${ac_cv_func_stpcpy+set}" != "set"; then + ;; -for ac_func in stpcpy -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -7228,12 +9615,12 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. +/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load. For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define $ac_func innocuous_$ac_func +#define shl_load innocuous_shl_load /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. + which can conflict with char shl_load (); below. Prefer <limits.h> to <assert.h> if __STDC__ is defined, since <limits.h> exists even on freestanding compilers. */ @@ -7243,7 +9630,7 @@ cat >>conftest.$ac_ext <<_ACEOF # include <assert.h> #endif -#undef $ac_func +#undef shl_load /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -7252,14 +9639,14 @@ extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char $ac_func (); +char shl_load (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +#if defined (__stub_shl_load) || defined (__stub___shl_load) choke me #else -char (*f) () = $ac_func; +char (*f) () = shl_load; #endif #ifdef __cplusplus } @@ -7268,7 +9655,7 @@ char (*f) () = $ac_func; int main () { -return f != $ac_func; +return f != shl_load; ; return 0; } @@ -7295,52 +9682,46 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + ac_cv_func_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" +ac_cv_func_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - fi - if test "${ac_cv_func_stpcpy}" = "yes"; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_STPCPY 1 -_ACEOF - - fi - - if test $ac_cv_header_locale_h = yes; then - echo "$as_me:$LINENO: checking for LC_MESSAGES" >&5 -echo $ECHO_N "checking for LC_MESSAGES... $ECHO_C" >&6 -if test "${am_cv_val_LC_MESSAGES+set}" = set; then +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <locale.h> + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); int main () { -return LC_MESSAGES +shl_load (); ; return 0; } @@ -7367,85 +9748,81 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - am_cv_val_LC_MESSAGES=yes + ac_cv_lib_dld_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -am_cv_val_LC_MESSAGES=no +ac_cv_lib_dld_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $am_cv_val_LC_MESSAGES" >&5 -echo "${ECHO_T}$am_cv_val_LC_MESSAGES" >&6 - if test $am_cv_val_LC_MESSAGES = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_LC_MESSAGES 1 -_ACEOF - - fi - fi - echo "$as_me:$LINENO: checking whether NLS is requested" >&5 -echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 - # Check whether --enable-nls or --disable-nls was given. -if test "${enable_nls+set}" = set; then - enableval="$enable_nls" - USE_NLS=$enableval -else - USE_NLS=yes -fi; - echo "$as_me:$LINENO: result: $USE_NLS" >&5 -echo "${ECHO_T}$USE_NLS" >&6 - - - USE_INCLUDED_LIBINTL=no - - if test "$USE_NLS" = "yes"; then - echo "$as_me:$LINENO: checking whether included gettext is requested" >&5 -echo $ECHO_N "checking whether included gettext is requested... $ECHO_C" >&6 - -# Check whether --with-included-gettext or --without-included-gettext was given. -if test "${with_included_gettext+set}" = set; then - withval="$with_included_gettext" - nls_cv_force_use_gnu_gettext=$withval +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" else - nls_cv_force_use_gnu_gettext=no -fi; - echo "$as_me:$LINENO: result: $nls_cv_force_use_gnu_gettext" >&5 -echo "${ECHO_T}$nls_cv_force_use_gnu_gettext" >&6 - - nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" - if test "$nls_cv_force_use_gnu_gettext" != "yes"; then - nls_cv_header_intl= - nls_cv_header_libgt= - CATOBJEXT= - - if test "${ac_cv_header_libintl_h+set}" = set; then - echo "$as_me:$LINENO: checking for libintl.h" >&5 -echo $ECHO_N "checking for libintl.h... $ECHO_C" >&6 -if test "${ac_cv_header_libintl_h+set}" = set; then + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_libintl_h" >&5 -echo "${ECHO_T}$ac_cv_header_libintl_h" >&6 else - # Is the header compilable? -echo "$as_me:$LINENO: checking libintl.h usability" >&5 -echo $ECHO_N "checking libintl.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#include <libintl.h> +/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef dlopen + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_dlopen) || defined (__stub___dlopen) +choke me +#else +char (*f) () = dlopen; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != dlopen; + ; + return 0; +} _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -7459,123 +9836,52 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_header_compiler=yes + ac_cv_func_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no +ac_cv_func_dlopen=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking libintl.h presence" >&5 -echo $ECHO_N "checking libintl.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <libintl.h> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: libintl.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: libintl.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: libintl.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: libintl.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: libintl.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: libintl.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: libintl.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: libintl.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: libintl.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: libintl.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: libintl.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: libintl.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: libintl.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: libintl.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: libintl.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: libintl.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for libintl.h" >&5 -echo $ECHO_N "checking for libintl.h... $ECHO_C" >&6 -if test "${ac_cv_header_libintl_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_libintl_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_libintl_h" >&5 -echo "${ECHO_T}$ac_cv_header_libintl_h" >&6 - -fi -if test $ac_cv_header_libintl_h = yes; then - echo "$as_me:$LINENO: checking for gettext in libc" >&5 -echo $ECHO_N "checking for gettext in libc... $ECHO_C" >&6 -if test "${gt_cv_func_gettext_libc+set}" = set; then + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <libintl.h> + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); int main () { -return (int) gettext ("") +dlopen (); ; return 0; } @@ -7602,27 +9908,29 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gt_cv_func_gettext_libc=yes + ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -gt_cv_func_gettext_libc=no +ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $gt_cv_func_gettext_libc" >&5 -echo "${ECHO_T}$gt_cv_func_gettext_libc" >&6 - - if test "$gt_cv_func_gettext_libc" != "yes"; then - echo "$as_me:$LINENO: checking for bindtextdomain in -lintl" >&5 -echo $ECHO_N "checking for bindtextdomain in -lintl... $ECHO_C" >&6 -if test "${ac_cv_lib_intl_bindtextdomain+set}" = set; then +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lintl $LIBS" +LIBS="-lsvld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7636,11 +9944,11 @@ extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char bindtextdomain (); +char dlopen (); int main () { -bindtextdomain (); +dlopen (); ; return 0; } @@ -7667,36 +9975,47 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_intl_bindtextdomain=yes + ac_cv_lib_svld_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_intl_bindtextdomain=no +ac_cv_lib_svld_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_intl_bindtextdomain" >&5 -echo "${ECHO_T}$ac_cv_lib_intl_bindtextdomain" >&6 -if test $ac_cv_lib_intl_bindtextdomain = yes; then - echo "$as_me:$LINENO: checking for gettext in libintl" >&5 -echo $ECHO_N "checking for gettext in libintl... $ECHO_C" >&6 -if test "${gt_cv_func_gettext_libintl+set}" = set; then +echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dld_link (); int main () { -return (int) gettext ("") +dld_link (); ; return 0; } @@ -7723,311 +10042,822 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gt_cv_func_gettext_libintl=yes + ac_cv_lib_dld_dld_link=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -gt_cv_func_gettext_libintl=no +ac_cv_lib_dld_dld_link=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $gt_cv_func_gettext_libintl" >&5 -echo "${ECHO_T}$gt_cv_func_gettext_libintl" >&6 +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" fi - fi - if test "$gt_cv_func_gettext_libc" = "yes" \ - || test "$gt_cv_func_gettext_libintl" = "yes"; then +fi -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETTEXT 1 -_ACEOF - # Extract the first word of "msgfmt", so it can be a program name with args. -set dummy msgfmt; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_MSGFMT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case "$MSGFMT" in - /*) - ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then - ac_cv_path_MSGFMT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no" - ;; -esac fi -MSGFMT="$ac_cv_path_MSGFMT" -if test -n "$MSGFMT"; then - echo "$as_me:$LINENO: result: $MSGFMT" >&5 -echo "${ECHO_T}$MSGFMT" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + + fi - if test "$MSGFMT" != "no"; then -for ac_func in dcgettext -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define $ac_func innocuous_$ac_func + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line 10108 "configure" +#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ +#if HAVE_DLFCN_H +#include <dlfcn.h> +#endif -#ifdef __STDC__ -# include <limits.h> +#include <stdio.h> + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL #else -# include <assert.h> +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif #endif -#undef $ac_func +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif -/* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus -extern "C" +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () { + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + exit (status); +} +_LT_EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line 10208 "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include <dlfcn.h> #endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me + +#include <stdio.h> + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL #else -char (*f) () = $ac_func; +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif #endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + #ifdef __cplusplus -} +extern "C" void exit (int); #endif -int -main () +void fnord() { int i=42;} +int main () { -return f != $ac_func; - ; - return 0; + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + exit (status); } -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 +_LT_EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + -eval "$as_ac_var=no" fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 + + + + + + + + + + + + + + + + + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + + + + + + + + + + + + + # Report which library types will actually be built + echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 + + echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 + + echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 + + + + +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + + + + + + + + + + + + + ac_config_commands="$ac_config_commands libtool" + + + + +# Only expand once: + + + +# Check whether --enable-64-bit-bfd or --disable-64-bit-bfd was given. +if test "${enable_64_bit_bfd+set}" = set; then + enableval="$enable_64_bit_bfd" + case "${enableval}" in + yes) want64=true ;; + no) want64=false ;; + *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for 64-bit-bfd option" >&5 +echo "$as_me: error: bad value ${enableval} for 64-bit-bfd option" >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + want64=false +fi; # Check whether --enable-targets or --disable-targets was given. +if test "${enable_targets+set}" = set; then + enableval="$enable_targets" + case "${enableval}" in + yes | "") { { echo "$as_me:$LINENO: error: enable-targets option must specify target names or 'all'" >&5 +echo "$as_me: error: enable-targets option must specify target names or 'all'" >&2;} + { (exit 1); exit 1; }; } + ;; + no) enable_targets= ;; + *) enable_targets=$enableval ;; +esac +fi; # Check whether --enable-commonbfdlib or --disable-commonbfdlib was given. +if test "${enable_commonbfdlib+set}" = set; then + enableval="$enable_commonbfdlib" + case "${enableval}" in + yes) commonbfdlib=true ;; + no) commonbfdlib=false ;; + *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for BFD commonbfdlib option" >&5 +echo "$as_me: error: bad value ${enableval} for BFD commonbfdlib option" >&2;} + { (exit 1); exit 1; }; } ;; +esac +fi; +# Check whether --with-mmap or --without-mmap was given. +if test "${with_mmap+set}" = set; then + withval="$with_mmap" + case "${withval}" in + yes) want_mmap=true ;; + no) want_mmap=false ;; + *) { { echo "$as_me:$LINENO: error: bad value ${withval} for BFD with-mmap option" >&5 +echo "$as_me: error: bad value ${withval} for BFD with-mmap option" >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + want_mmap=false +fi; +# Check whether --enable-secureplt or --disable-secureplt was given. +if test "${enable_secureplt+set}" = set; then + enableval="$enable_secureplt" + case "${enableval}" in + yes) use_secureplt=true ;; + no) use_secureplt=false ;; + *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for secureplt option" >&5 +echo "$as_me: error: bad value ${enableval} for secureplt option" >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + use_secureplt=false +fi; if test $use_secureplt = true; then + +cat >>confdefs.h <<\_ACEOF +#define USE_SECUREPLT 1 _ACEOF fi -done - # Extract the first word of "gmsgfmt", so it can be a program name with args. -set dummy gmsgfmt; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_GMSGFMT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +DEBUGDIR=${libdir}/debug + + +# Check whether --with-separate-debug-dir or --without-separate-debug-dir was given. +if test "${with_separate_debug_dir+set}" = set; then + withval="$with_separate_debug_dir" + DEBUGDIR="${withval}" +fi; + + + + +# Check whether --with-pkgversion or --without-pkgversion was given. +if test "${with_pkgversion+set}" = set; then + withval="$with_pkgversion" + case "$withval" in + yes) { { echo "$as_me:$LINENO: error: package version not specified" >&5 +echo "$as_me: error: package version not specified" >&2;} + { (exit 1); exit 1; }; } ;; + no) PKGVERSION= ;; + *) PKGVERSION="($withval) " ;; + esac else - case $GMSGFMT in - [\\/]* | ?:[\\/]*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. - ;; + PKGVERSION="(GNU Binutils) " + +fi; + + + + +# Check whether --with-bugurl or --without-bugurl was given. +if test "${with_bugurl+set}" = set; then + withval="$with_bugurl" + case "$withval" in + yes) { { echo "$as_me:$LINENO: error: bug URL not specified" >&5 +echo "$as_me: error: bug URL not specified" >&2;} + { (exit 1); exit 1; }; } ;; + no) BUGURL= + ;; + *) BUGURL="$withval" + ;; + esac +else + BUGURL="http://www.sourceware.org/bugzilla/" + +fi; + case ${BUGURL} in + "") + REPORT_BUGS_TO= + REPORT_BUGS_TEXI= + ;; *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done + REPORT_BUGS_TO="<$BUGURL>" + REPORT_BUGS_TEXI=@uref{`echo "$BUGURL" | sed 's/@/@@/g'`} + ;; + esac; - test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" - ;; + + + + +GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" + +# Check whether --enable-werror or --disable-werror was given. +if test "${enable_werror+set}" = set; then + enableval="$enable_werror" + case "${enableval}" in + yes | y) ERROR_ON_WARNING="yes" ;; + no | n) ERROR_ON_WARNING="no" ;; + *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-werror" >&5 +echo "$as_me: error: bad value ${enableval} for --enable-werror" >&2;} + { (exit 1); exit 1; }; } ;; + esac +fi; + +# Enable -Werror by default when using gcc +if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then + ERROR_ON_WARNING=yes +fi + +NO_WERROR= +if test "${ERROR_ON_WARNING}" = yes ; then + GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror" + NO_WERROR="-Wno-error" +fi + +if test "${GCC}" = yes ; then + WARN_CFLAGS="${GCC_WARN_CFLAGS}" +fi + +# Check whether --enable-build-warnings or --disable-build-warnings was given. +if test "${enable_build_warnings+set}" = set; then + enableval="$enable_build_warnings" + case "${enableval}" in + yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";; + no) if test "${GCC}" = yes ; then + WARN_CFLAGS="-w" + fi;; + ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` + WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";; + *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` + WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";; + *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;; esac +fi; + +if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then + echo "Setting warning flags = $WARN_CFLAGS" 6>&1 fi -GMSGFMT=$ac_cv_path_GMSGFMT -if test -n "$GMSGFMT"; then - echo "$as_me:$LINENO: result: $GMSGFMT" >&5 -echo "${ECHO_T}$GMSGFMT" >&6 + + + + + ac_config_headers="$ac_config_headers config.h:config.in" + + +if test -z "$target" ; then + { { echo "$as_me:$LINENO: error: Unrecognized target system type; please check config.sub." >&5 +echo "$as_me: error: Unrecognized target system type; please check config.sub." >&2;} + { (exit 1); exit 1; }; } +fi + +echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + USE_MAINTAINER_MODE=no +fi; + echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 +echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 + + +if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= fi - # Extract the first word of "xgettext", so it can be a program name with args. -set dummy xgettext; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_XGETTEXT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + MAINT=$MAINTAINER_MODE_TRUE + + + + +if false; then + GENINSRC_NEVER_TRUE= + GENINSRC_NEVER_FALSE='#' else - case "$XGETTEXT" in - /*) - ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then - ac_cv_path_XGETTEXT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" - ;; -esac + GENINSRC_NEVER_TRUE='#' + GENINSRC_NEVER_FALSE= fi -XGETTEXT="$ac_cv_path_XGETTEXT" -if test -n "$XGETTEXT"; then - echo "$as_me:$LINENO: result: $XGETTEXT" >&5 -echo "${ECHO_T}$XGETTEXT" >&6 + + case ${build_alias} in + "") build_noncanonical=${build} ;; + *) build_noncanonical=${build_alias} ;; +esac + + case ${host_alias} in + "") host_noncanonical=${build_noncanonical} ;; + *) host_noncanonical=${host_alias} ;; +esac + + case ${target_alias} in + "") target_noncanonical=${host_noncanonical} ;; + *) target_noncanonical=${target_alias} ;; +esac + +echo "$as_me:$LINENO: checking whether to install libbfd" >&5 +echo $ECHO_N "checking whether to install libbfd... $ECHO_C" >&6 + # Check whether --enable-install-libbfd or --disable-install-libbfd was given. +if test "${enable_install_libbfd+set}" = set; then + enableval="$enable_install_libbfd" + install_libbfd_p=$enableval else + if test "${host}" = "${target}" || test "$enable_shared" = "yes"; then + install_libbfd_p=yes + else + install_libbfd_p=no + fi +fi; + echo "$as_me:$LINENO: result: $install_libbfd_p" >&5 +echo "${ECHO_T}$install_libbfd_p" >&6 + + +if test $install_libbfd_p = yes; then + INSTALL_LIBBFD_TRUE= + INSTALL_LIBBFD_FALSE='#' +else + INSTALL_LIBBFD_TRUE='#' + INSTALL_LIBBFD_FALSE= +fi + + # Need _noncanonical variables for this. + + + + + # libbfd.a is a host library containing target dependent code + bfdlibdir='$(libdir)' + bfdincludedir='$(includedir)' + if test "${host}" != "${target}"; then + bfdlibdir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/lib' + bfdincludedir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/include' + fi + + + + + + +host64=false +target64=false +bfd_default_target_size=32 + +# host stuff: + +ALL_LINGUAS="fr tr ja es sv da zh_CN ro rw vi" +# If we haven't got the data from the intl directory, +# assume NLS is disabled. +USE_NLS=no +LIBINTL= +LIBINTL_DEP= +INCINTL= +XGETTEXT= +GMSGFMT= +POSUB= + +if test -f ../intl/config.intl; then + . ../intl/config.intl +fi +echo "$as_me:$LINENO: checking whether NLS is requested" >&5 +echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 +if test x"$USE_NLS" != xyes; then echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 -fi +else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ +cat >>confdefs.h <<\_ACEOF +#define ENABLE_NLS 1 _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -int -main () -{ -extern int _nl_msg_cat_cntr; - return _nl_msg_cat_cntr - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + + echo "$as_me:$LINENO: checking for catalogs to be installed" >&5 +echo $ECHO_N "checking for catalogs to be installed... $ECHO_C" >&6 + # Look for .po and .gmo files in the source directory. + CATALOGS= + XLINGUAS= + for cat in $srcdir/po/*.gmo $srcdir/po/*.po; do + # If there aren't any .gmo files the shell will give us the + # literal string "../path/to/srcdir/po/*.gmo" which has to be + # weeded out. + case "$cat" in *\**) + continue;; + esac + # The quadruple backslash is collapsed to a double backslash + # by the backticks, then collapsed again by the double quotes, + # leaving us with one backslash in the sed expression (right + # before the dot that mustn't act as a wildcard). + cat=`echo $cat | sed -e "s!$srcdir/po/!!" -e "s!\\\\.po!.gmo!"` + lang=`echo $cat | sed -e "s!\\\\.gmo!!"` + # The user is allowed to set LINGUAS to a list of languages to + # install catalogs for. If it's empty that means "all of them." + if test "x$LINGUAS" = x; then + CATALOGS="$CATALOGS $cat" + XLINGUAS="$XLINGUAS $lang" + else + case "$LINGUAS" in *$lang*) + CATALOGS="$CATALOGS $cat" + XLINGUAS="$XLINGUAS $lang" + ;; + esac + fi + done + LINGUAS="$XLINGUAS" + echo "$as_me:$LINENO: result: $LINGUAS" >&5 +echo "${ECHO_T}$LINGUAS" >&6 + + + DATADIRNAME=share + + INSTOBJEXT=.mo + + GENCAT=gencat + CATOBJEXT=.gmo - DATADIRNAME=share -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -CATOBJEXT=.mo - DATADIRNAME=lib fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - INSTOBJEXT=.mo - fi - fi -fi + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + case "$ac_aux_dir" in + /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;; + *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;; + esac + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + echo "$as_me:$LINENO: checking whether NLS is requested" >&5 +echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 + # Check whether --enable-nls or --disable-nls was given. +if test "${enable_nls+set}" = set; then + enableval="$enable_nls" + USE_NLS=$enableval +else + USE_NLS=yes +fi; + echo "$as_me:$LINENO: result: $USE_NLS" >&5 +echo "${ECHO_T}$USE_NLS" >&6 + + - if test x"$CATOBJEXT" = x && test -d $srcdir/../intl; then - # Neither gettext nor catgets in included in the C library. - # Fall back on GNU gettext library (assuming it is present). - nls_cv_use_gnu_gettext=yes - fi - fi - if test "$nls_cv_use_gnu_gettext" = "yes"; then - INTLOBJS="\$(GETTOBJS)" - # Extract the first word of "msgfmt", so it can be a program name with args. + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 @@ -8035,27 +10865,31 @@ if test "${ac_cv_path_MSGFMT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$MSGFMT" in - /*) - ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. - ;; + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then - ac_cv_path_MSGFMT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="msgfmt" - ;; + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" + ;; esac fi MSGFMT="$ac_cv_path_MSGFMT" -if test -n "$MSGFMT"; then +if test "$MSGFMT" != ":"; then echo "$as_me:$LINENO: result: $MSGFMT" >&5 echo "${ECHO_T}$MSGFMT" >&6 else @@ -8063,7 +10897,7 @@ else echo "${ECHO_T}no" >&6 fi - # Extract the first word of "gmsgfmt", so it can be a program name with args. + # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 @@ -8103,7 +10937,37 @@ else echo "${ECHO_T}no" >&6 fi - # Extract the first word of "xgettext", so it can be a program name with args. + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 @@ -8111,27 +10975,31 @@ if test "${ac_cv_path_XGETTEXT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$XGETTEXT" in - /*) - ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. - ;; + [\\/]* | ?:[\\/]*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then - ac_cv_path_XGETTEXT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" - ;; + ;; esac fi XGETTEXT="$ac_cv_path_XGETTEXT" -if test -n "$XGETTEXT"; then +if test "$XGETTEXT" != ":"; then echo "$as_me:$LINENO: result: $XGETTEXT" >&5 echo "${ECHO_T}$XGETTEXT" >&6 else @@ -8139,282 +11007,103 @@ else echo "${ECHO_T}no" >&6 fi + rm -f messages.po - USE_INCLUDED_LIBINTL=yes - CATOBJEXT=.gmo - INSTOBJEXT=.mo - DATADIRNAME=share - INTLDEPS='$(top_builddir)/../intl/libintl.a' - INTLLIBS=$INTLDEPS - LIBS=`echo $LIBS | sed -e 's/-lintl//'` - nls_cv_header_intl=libintl.h - nls_cv_header_libgt=libgettext.h - fi - - if test "$XGETTEXT" != ":"; then - if $XGETTEXT --omit-header /dev/null 2> /dev/null; then - : ; - else - echo "$as_me:$LINENO: result: found xgettext programs is not GNU xgettext; ignore it" >&5 -echo "${ECHO_T}found xgettext programs is not GNU xgettext; ignore it" >&6 - XGETTEXT=":" - fi - fi - - # We need to process the po/ directory. - POSUB=po - else - DATADIRNAME=share - nls_cv_header_intl=libintl.h - nls_cv_header_libgt=libgettext.h - fi - - # If this is used in GNU gettext we have to set USE_NLS to `yes' - # because some of the sources are only built for this goal. - if test "$PACKAGE" = gettext; then - USE_NLS=yes - USE_INCLUDED_LIBINTL=yes - fi - - for lang in $ALL_LINGUAS; do - GMOFILES="$GMOFILES $lang.gmo" - POFILES="$POFILES $lang.po" - done - - - - - - - - - - - - - if test "x$CATOBJEXT" != "x"; then - -cat >>confdefs.h <<\_ACEOF -#define ENABLE_NLS 1 -_ACEOF - - fi - - - if test "x$CATOBJEXT" != "x"; then - if test "x$ALL_LINGUAS" = "x"; then - LINGUAS= - else - echo "$as_me:$LINENO: checking for catalogs to be installed" >&5 -echo $ECHO_N "checking for catalogs to be installed... $ECHO_C" >&6 - NEW_LINGUAS= - for lang in ${LINGUAS=$ALL_LINGUAS}; do - case "$ALL_LINGUAS" in - *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; - esac - done - LINGUAS=$NEW_LINGUAS - echo "$as_me:$LINENO: result: $LINGUAS" >&5 -echo "${ECHO_T}$LINGUAS" >&6 - fi - - if test -n "$LINGUAS"; then - for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done - fi - fi - - if test $ac_cv_header_locale_h = yes; then - INCLUDE_LOCALE_H="#include <locale.h>" - else - INCLUDE_LOCALE_H="\ -/* The system does not provide the header <locale.h>. Take care yourself. */" - fi - - - if test -f $srcdir/po2tbl.sed.in; then - if test "$CATOBJEXT" = ".cat"; then - if test "${ac_cv_header_linux_version_h+set}" = set; then - echo "$as_me:$LINENO: checking for linux/version.h" >&5 -echo $ECHO_N "checking for linux/version.h... $ECHO_C" >&6 -if test "${ac_cv_header_linux_version_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_linux_version_h" >&5 -echo "${ECHO_T}$ac_cv_header_linux_version_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking linux/version.h usability" >&5 -echo $ECHO_N "checking linux/version.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <linux/version.h> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 -# Is the header present? -echo "$as_me:$LINENO: checking linux/version.h presence" >&5 -echo $ECHO_N "checking linux/version.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <linux/version.h> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' else - ac_cpp_err= + PATH_SEPARATOR=: fi -else - ac_cpp_err=yes + rm -f conf$$.sh fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_preproc=no +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 +rm -f conf$$.file -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: linux/version.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: linux/version.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: linux/version.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: linux/version.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes +# Extract the first word of "msgmerge", so it can be a program name with args. +set dummy msgmerge; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_MSGMERGE+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$MSGMERGE" in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: linux/version.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: linux/version.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: linux/version.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: linux/version.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: linux/version.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: linux/version.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: linux/version.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: linux/version.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: linux/version.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: linux/version.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: linux/version.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: linux/version.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + if $ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1; then + ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" ;; esac -echo "$as_me:$LINENO: checking for linux/version.h" >&5 -echo $ECHO_N "checking for linux/version.h... $ECHO_C" >&6 -if test "${ac_cv_header_linux_version_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_linux_version_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_linux_version_h" >&5 -echo "${ECHO_T}$ac_cv_header_linux_version_h" >&6 - fi -if test $ac_cv_header_linux_version_h = yes; then - msgformat=linux +MSGMERGE="$ac_cv_path_MSGMERGE" +if test "$MSGMERGE" != ":"; then + echo "$as_me:$LINENO: result: $MSGMERGE" >&5 +echo "${ECHO_T}$MSGMERGE" >&6 else - msgformat=xopen + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi + if test "$GMSGFMT" != ":"; then + if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && + (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` + echo "$as_me:$LINENO: result: found $GMSGFMT program is not GNU msgfmt; ignore it" >&5 +echo "${ECHO_T}found $GMSGFMT program is not GNU msgfmt; ignore it" >&6 + GMSGFMT=":" + fi + fi - sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed - fi - sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ - $srcdir/po2tbl.sed.in > po2tbl.sed - fi - - if test "$PACKAGE" = "gettext"; then - GT_NO="#NO#" - GT_YES= - else - GT_NO= - GT_YES="#YES#" - fi - - - - MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs" + if test "$XGETTEXT" != ":"; then + if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && + (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + echo "$as_me:$LINENO: result: found xgettext program is not GNU xgettext; ignore it" >&5 +echo "${ECHO_T}found xgettext program is not GNU xgettext; ignore it" >&6 + XGETTEXT=":" + fi + rm -f messages.po + fi + ac_config_commands="$ac_config_commands default-1" - l= - - - if test -f $srcdir/po/POTFILES.in; then - test -d po || mkdir po - if test "x$srcdir" != "x."; then - if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then - posrcprefix="$srcdir/" - else - posrcprefix="../$srcdir/" - fi - else - posrcprefix="../" - fi - rm -f po/POTFILES - sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ - < $srcdir/po/POTFILES.in > po/POTFILES - fi # Permit host specific settings. @@ -9760,6 +12449,2853 @@ fi done + + +inttype_headers=`echo inttypes.h sys/inttypes.h | sed -e 's/,/ /g'` + +acx_cv_header_stdint=stddef.h +acx_cv_header_stdint_kind="(already complete)" +for i in stdint.h $inttype_headers; do + unset ac_cv_type_uintptr_t + unset ac_cv_type_uintmax_t + unset ac_cv_type_int_least32_t + unset ac_cv_type_int_fast32_t + unset ac_cv_type_uint64_t + echo $ECHO_N "looking for a compliant stdint.h in $i, $ECHO_C" >&6 + echo "$as_me:$LINENO: checking for uintmax_t" >&5 +echo $ECHO_N "checking for uintmax_t... $ECHO_C" >&6 +if test "${ac_cv_type_uintmax_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <$i> + +int +main () +{ +if ((uintmax_t *) 0) + return 0; +if (sizeof (uintmax_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_uintmax_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_uintmax_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_uintmax_t" >&5 +echo "${ECHO_T}$ac_cv_type_uintmax_t" >&6 +if test $ac_cv_type_uintmax_t = yes; then + acx_cv_header_stdint=$i +else + continue +fi + + echo "$as_me:$LINENO: checking for uintptr_t" >&5 +echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6 +if test "${ac_cv_type_uintptr_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <$i> + +int +main () +{ +if ((uintptr_t *) 0) + return 0; +if (sizeof (uintptr_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_uintptr_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_uintptr_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5 +echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6 +if test $ac_cv_type_uintptr_t = yes; then + : +else + acx_cv_header_stdint_kind="(mostly complete)" +fi + + echo "$as_me:$LINENO: checking for int_least32_t" >&5 +echo $ECHO_N "checking for int_least32_t... $ECHO_C" >&6 +if test "${ac_cv_type_int_least32_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <$i> + +int +main () +{ +if ((int_least32_t *) 0) + return 0; +if (sizeof (int_least32_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_int_least32_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_int_least32_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_int_least32_t" >&5 +echo "${ECHO_T}$ac_cv_type_int_least32_t" >&6 +if test $ac_cv_type_int_least32_t = yes; then + : +else + acx_cv_header_stdint_kind="(mostly complete)" +fi + + echo "$as_me:$LINENO: checking for int_fast32_t" >&5 +echo $ECHO_N "checking for int_fast32_t... $ECHO_C" >&6 +if test "${ac_cv_type_int_fast32_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <$i> + +int +main () +{ +if ((int_fast32_t *) 0) + return 0; +if (sizeof (int_fast32_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_int_fast32_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_int_fast32_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_int_fast32_t" >&5 +echo "${ECHO_T}$ac_cv_type_int_fast32_t" >&6 +if test $ac_cv_type_int_fast32_t = yes; then + : +else + acx_cv_header_stdint_kind="(mostly complete)" +fi + + echo "$as_me:$LINENO: checking for uint64_t" >&5 +echo $ECHO_N "checking for uint64_t... $ECHO_C" >&6 +if test "${ac_cv_type_uint64_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <$i> + +int +main () +{ +if ((uint64_t *) 0) + return 0; +if (sizeof (uint64_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_uint64_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_uint64_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_uint64_t" >&5 +echo "${ECHO_T}$ac_cv_type_uint64_t" >&6 +if test $ac_cv_type_uint64_t = yes; then + : +else + acx_cv_header_stdint_kind="(lacks uint64_t)" +fi + + break +done +if test "$acx_cv_header_stdint" = stddef.h; then + acx_cv_header_stdint_kind="(lacks uintmax_t)" + for i in stdint.h $inttype_headers; do + unset ac_cv_type_uintptr_t + unset ac_cv_type_uint32_t + unset ac_cv_type_uint64_t + echo $ECHO_N "looking for an incomplete stdint.h in $i, $ECHO_C" >&6 + echo "$as_me:$LINENO: checking for uint32_t" >&5 +echo $ECHO_N "checking for uint32_t... $ECHO_C" >&6 +if test "${ac_cv_type_uint32_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <$i> + +int +main () +{ +if ((uint32_t *) 0) + return 0; +if (sizeof (uint32_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_uint32_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_uint32_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_uint32_t" >&5 +echo "${ECHO_T}$ac_cv_type_uint32_t" >&6 +if test $ac_cv_type_uint32_t = yes; then + acx_cv_header_stdint=$i +else + continue +fi + + echo "$as_me:$LINENO: checking for uint64_t" >&5 +echo $ECHO_N "checking for uint64_t... $ECHO_C" >&6 +if test "${ac_cv_type_uint64_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <$i> + +int +main () +{ +if ((uint64_t *) 0) + return 0; +if (sizeof (uint64_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_uint64_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_uint64_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_uint64_t" >&5 +echo "${ECHO_T}$ac_cv_type_uint64_t" >&6 + + echo "$as_me:$LINENO: checking for uintptr_t" >&5 +echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6 +if test "${ac_cv_type_uintptr_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <$i> + +int +main () +{ +if ((uintptr_t *) 0) + return 0; +if (sizeof (uintptr_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_uintptr_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_uintptr_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5 +echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6 + + break + done +fi +if test "$acx_cv_header_stdint" = stddef.h; then + acx_cv_header_stdint_kind="(u_intXX_t style)" + for i in sys/types.h $inttype_headers; do + unset ac_cv_type_u_int32_t + unset ac_cv_type_u_int64_t + echo $ECHO_N "looking for u_intXX_t types in $i, $ECHO_C" >&6 + echo "$as_me:$LINENO: checking for u_int32_t" >&5 +echo $ECHO_N "checking for u_int32_t... $ECHO_C" >&6 +if test "${ac_cv_type_u_int32_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <$i> + +int +main () +{ +if ((u_int32_t *) 0) + return 0; +if (sizeof (u_int32_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_u_int32_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_u_int32_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_u_int32_t" >&5 +echo "${ECHO_T}$ac_cv_type_u_int32_t" >&6 +if test $ac_cv_type_u_int32_t = yes; then + acx_cv_header_stdint=$i +else + continue +fi + + echo "$as_me:$LINENO: checking for u_int64_t" >&5 +echo $ECHO_N "checking for u_int64_t... $ECHO_C" >&6 +if test "${ac_cv_type_u_int64_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <$i> + +int +main () +{ +if ((u_int64_t *) 0) + return 0; +if (sizeof (u_int64_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_u_int64_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_u_int64_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_u_int64_t" >&5 +echo "${ECHO_T}$ac_cv_type_u_int64_t" >&6 + + break + done +fi +if test "$acx_cv_header_stdint" = stddef.h; then + acx_cv_header_stdint_kind="(using manual detection)" +fi + +test -z "$ac_cv_type_uintptr_t" && ac_cv_type_uintptr_t=no +test -z "$ac_cv_type_uint64_t" && ac_cv_type_uint64_t=no +test -z "$ac_cv_type_u_int64_t" && ac_cv_type_u_int64_t=no +test -z "$ac_cv_type_int_least32_t" && ac_cv_type_int_least32_t=no +test -z "$ac_cv_type_int_fast32_t" && ac_cv_type_int_fast32_t=no + +# ----------------- Summarize what we found so far + +echo "$as_me:$LINENO: checking what to include in bfd_stdint.h" >&5 +echo $ECHO_N "checking what to include in bfd_stdint.h... $ECHO_C" >&6 + +case `$as_basename bfd_stdint.h || +$as_expr X/bfd_stdint.h : '.*/\([^/][^/]*\)/*$' \| \ + Xbfd_stdint.h : 'X\(//\)$' \| \ + Xbfd_stdint.h : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/bfd_stdint.h | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` in + stdint.h) { echo "$as_me:$LINENO: WARNING: are you sure you want it there?" >&5 +echo "$as_me: WARNING: are you sure you want it there?" >&2;} ;; + inttypes.h) { echo "$as_me:$LINENO: WARNING: are you sure you want it there?" >&5 +echo "$as_me: WARNING: are you sure you want it there?" >&2;} ;; + *) ;; +esac + +echo "$as_me:$LINENO: result: $acx_cv_header_stdint $acx_cv_header_stdint_kind" >&5 +echo "${ECHO_T}$acx_cv_header_stdint $acx_cv_header_stdint_kind" >&6 + +# ----------------- done included file, check C basic types -------- + +# Lacking an uintptr_t? Test size of void * +case "$acx_cv_header_stdint:$ac_cv_type_uintptr_t" in + stddef.h:* | *:no) echo "$as_me:$LINENO: checking for void *" >&5 +echo $ECHO_N "checking for void *... $ECHO_C" >&6 +if test "${ac_cv_type_void_p+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((void * *) 0) + return 0; +if (sizeof (void *)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_void_p=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_void_p=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_void_p" >&5 +echo "${ECHO_T}$ac_cv_type_void_p" >&6 + +echo "$as_me:$LINENO: checking size of void *" >&5 +echo $ECHO_N "checking size of void *... $ECHO_C" >&6 +if test "${ac_cv_sizeof_void_p+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_void_p" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (void *))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (void *))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (void *))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (void *))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo= ac_hi= +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (void *))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr '(' $ac_mid ')' + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_void_p=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (void *), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +long longval () { return (long) (sizeof (void *)); } +unsigned long ulongval () { return (long) (sizeof (void *)); } +#include <stdio.h> +#include <stdlib.h> +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (void *))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (void *)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (void *)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_void_p=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (void *), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.val +else + ac_cv_sizeof_void_p=0 +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5 +echo "${ECHO_T}$ac_cv_sizeof_void_p" >&6 +cat >>confdefs.h <<_ACEOF +#define SIZEOF_VOID_P $ac_cv_sizeof_void_p +_ACEOF + + ;; +esac + +# Lacking an uint64_t? Test size of long +case "$acx_cv_header_stdint:$ac_cv_type_uint64_t:$ac_cv_type_u_int64_t" in + stddef.h:*:* | *:no:no) echo "$as_me:$LINENO: checking for long" >&5 +echo $ECHO_N "checking for long... $ECHO_C" >&6 +if test "${ac_cv_type_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((long *) 0) + return 0; +if (sizeof (long)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_long=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_long=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 +echo "${ECHO_T}$ac_cv_type_long" >&6 + +echo "$as_me:$LINENO: checking size of long" >&5 +echo $ECHO_N "checking size of long... $ECHO_C" >&6 +if test "${ac_cv_sizeof_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_long" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo= ac_hi= +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr '(' $ac_mid ')' + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_long=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +long longval () { return (long) (sizeof (long)); } +unsigned long ulongval () { return (long) (sizeof (long)); } +#include <stdio.h> +#include <stdlib.h> +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (long))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (long)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (long)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_long=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.val +else + ac_cv_sizeof_long=0 +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long" >&6 +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG $ac_cv_sizeof_long +_ACEOF + + ;; +esac + +if test $acx_cv_header_stdint = stddef.h; then + # Lacking a good header? Test size of everything and deduce all types. + echo "$as_me:$LINENO: checking for int" >&5 +echo $ECHO_N "checking for int... $ECHO_C" >&6 +if test "${ac_cv_type_int+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((int *) 0) + return 0; +if (sizeof (int)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_int=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_int=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5 +echo "${ECHO_T}$ac_cv_type_int" >&6 + +echo "$as_me:$LINENO: checking size of int" >&5 +echo $ECHO_N "checking size of int... $ECHO_C" >&6 +if test "${ac_cv_sizeof_int+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_int" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (int))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (int))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (int))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo= ac_hi= +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr '(' $ac_mid ')' + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_int=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (int), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +long longval () { return (long) (sizeof (int)); } +unsigned long ulongval () { return (long) (sizeof (int)); } +#include <stdio.h> +#include <stdlib.h> +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (int))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (int)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (int)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_int=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (int), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.val +else + ac_cv_sizeof_int=0 +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 +echo "${ECHO_T}$ac_cv_sizeof_int" >&6 +cat >>confdefs.h <<_ACEOF +#define SIZEOF_INT $ac_cv_sizeof_int +_ACEOF + + + echo "$as_me:$LINENO: checking for short" >&5 +echo $ECHO_N "checking for short... $ECHO_C" >&6 +if test "${ac_cv_type_short+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((short *) 0) + return 0; +if (sizeof (short)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_short=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_short=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_short" >&5 +echo "${ECHO_T}$ac_cv_type_short" >&6 + +echo "$as_me:$LINENO: checking size of short" >&5 +echo $ECHO_N "checking size of short... $ECHO_C" >&6 +if test "${ac_cv_sizeof_short+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_short" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (short))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (short))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (short))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo= ac_hi= +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr '(' $ac_mid ')' + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_short=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (short), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +long longval () { return (long) (sizeof (short)); } +unsigned long ulongval () { return (long) (sizeof (short)); } +#include <stdio.h> +#include <stdlib.h> +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (short))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (short)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (short)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_short=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (short), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.val +else + ac_cv_sizeof_short=0 +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5 +echo "${ECHO_T}$ac_cv_sizeof_short" >&6 +cat >>confdefs.h <<_ACEOF +#define SIZEOF_SHORT $ac_cv_sizeof_short +_ACEOF + + + echo "$as_me:$LINENO: checking for char" >&5 +echo $ECHO_N "checking for char... $ECHO_C" >&6 +if test "${ac_cv_type_char+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((char *) 0) + return 0; +if (sizeof (char)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_char=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_char=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_char" >&5 +echo "${ECHO_T}$ac_cv_type_char" >&6 + +echo "$as_me:$LINENO: checking size of char" >&5 +echo $ECHO_N "checking size of char... $ECHO_C" >&6 +if test "${ac_cv_sizeof_char+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_char" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (char))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (char))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (char))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (char))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo= ac_hi= +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (char))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr '(' $ac_mid ')' + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_char=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (char), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (char), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +long longval () { return (long) (sizeof (char)); } +unsigned long ulongval () { return (long) (sizeof (char)); } +#include <stdio.h> +#include <stdlib.h> +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (char))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (char)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (char)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_char=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (char), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (char), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.val +else + ac_cv_sizeof_char=0 +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sizeof_char" >&5 +echo "${ECHO_T}$ac_cv_sizeof_char" >&6 +cat >>confdefs.h <<_ACEOF +#define SIZEOF_CHAR $ac_cv_sizeof_char +_ACEOF + + + + echo "$as_me:$LINENO: checking for type equivalent to int8_t" >&5 +echo $ECHO_N "checking for type equivalent to int8_t... $ECHO_C" >&6 + case "$ac_cv_sizeof_char" in + 1) acx_cv_type_int8_t=char ;; + *) { { echo "$as_me:$LINENO: error: no 8-bit type" >&5 +echo "$as_me: error: no 8-bit type" >&2;} + { (exit please report a bug); exit please report a bug; }; } + esac + echo "$as_me:$LINENO: result: $acx_cv_type_int8_t" >&5 +echo "${ECHO_T}$acx_cv_type_int8_t" >&6 + + echo "$as_me:$LINENO: checking for type equivalent to int16_t" >&5 +echo $ECHO_N "checking for type equivalent to int16_t... $ECHO_C" >&6 + case "$ac_cv_sizeof_int:$ac_cv_sizeof_short" in + 2:*) acx_cv_type_int16_t=int ;; + *:2) acx_cv_type_int16_t=short ;; + *) { { echo "$as_me:$LINENO: error: no 16-bit type" >&5 +echo "$as_me: error: no 16-bit type" >&2;} + { (exit please report a bug); exit please report a bug; }; } + esac + echo "$as_me:$LINENO: result: $acx_cv_type_int16_t" >&5 +echo "${ECHO_T}$acx_cv_type_int16_t" >&6 + + echo "$as_me:$LINENO: checking for type equivalent to int32_t" >&5 +echo $ECHO_N "checking for type equivalent to int32_t... $ECHO_C" >&6 + case "$ac_cv_sizeof_int:$ac_cv_sizeof_long" in + 4:*) acx_cv_type_int32_t=int ;; + *:4) acx_cv_type_int32_t=long ;; + *) { { echo "$as_me:$LINENO: error: no 32-bit type" >&5 +echo "$as_me: error: no 32-bit type" >&2;} + { (exit please report a bug); exit please report a bug; }; } + esac + echo "$as_me:$LINENO: result: $acx_cv_type_int32_t" >&5 +echo "${ECHO_T}$acx_cv_type_int32_t" >&6 +fi + +# These tests are here to make the output prettier + +if test "$ac_cv_type_uint64_t" != yes && test "$ac_cv_type_u_int64_t" != yes; then + case "$ac_cv_sizeof_long" in + 8) acx_cv_type_int64_t=long ;; + esac + echo "$as_me:$LINENO: checking for type equivalent to int64_t" >&5 +echo $ECHO_N "checking for type equivalent to int64_t... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: ${acx_cv_type_int64_t-'using preprocessor symbols'}" >&5 +echo "${ECHO_T}${acx_cv_type_int64_t-'using preprocessor symbols'}" >&6 +fi + +# Now we can use the above types + +if test "$ac_cv_type_uintptr_t" != yes; then + echo "$as_me:$LINENO: checking for type equivalent to intptr_t" >&5 +echo $ECHO_N "checking for type equivalent to intptr_t... $ECHO_C" >&6 + case $ac_cv_sizeof_void_p in + 2) acx_cv_type_intptr_t=int16_t ;; + 4) acx_cv_type_intptr_t=int32_t ;; + 8) acx_cv_type_intptr_t=int64_t ;; + *) { { echo "$as_me:$LINENO: error: no equivalent for intptr_t" >&5 +echo "$as_me: error: no equivalent for intptr_t" >&2;} + { (exit please report a bug); exit please report a bug; }; } + esac + echo "$as_me:$LINENO: result: $acx_cv_type_intptr_t" >&5 +echo "${ECHO_T}$acx_cv_type_intptr_t" >&6 +fi + +# ----------------- done all checks, emit header ------------- + ac_config_commands="$ac_config_commands bfd_stdint.h" + + + echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 if test "${ac_cv_header_time+set}" = set; then @@ -11467,7 +17003,9 @@ if test "${target}" = "${host}"; then alpha*-*-*) COREFILE=osf-core.lo ;; arm-*-freebsd* | arm-*-kfreebsd*-gnu) COREFILE='' ;; - arm-*-netbsd*) COREFILE=netbsd-core.lo ;; + arm-*-netbsd* | arm-*-openbsd*) + COREFILE=netbsd-core.lo + ;; arm-*-riscix) COREFILE=trad-core.lo ;; hppa*-*-hpux*) COREFILE=hpux-core.lo ;; hppa*-*-hiux*) COREFILE=hpux-core.lo ;; @@ -11674,7 +17212,9 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext powerpc-*-netbsd*) COREFILE=netbsd-core.lo ;; powerpc-*-*bsd*) COREFILE=netbsd-core.lo ;; s390*-*-*) COREFILE=trad-core.lo ;; - sh*-*-netbsd*) COREFILE=netbsd-core.lo ;; + sh*-*-netbsd* | sh*-*-openbsd*) + COREFILE=netbsd-core.lo + ;; sparc-*-netbsd* | sparc*-*-openbsd*) COREFILE=netbsd-core.lo ;; @@ -13038,7 +18578,7 @@ selarchs="$f" # Target backend .o files. tb= -elf="elf.lo elflink.lo elf-strtab.lo elf-eh-frame.lo dwarf1.lo" +elf="elf.lo elflink.lo elf-attrs.lo elf-strtab.lo elf-eh-frame.lo dwarf1.lo" for vec in $selvecs do @@ -13057,6 +18597,10 @@ do arm_epoc_pe_little_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;; arm_epoc_pei_big_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;; arm_epoc_pei_little_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;; + arm_wince_pe_big_vec) tb="$tb pe-arm-wince.lo pe-arm.lo peigen.lo cofflink.lo " ;; + arm_wince_pe_little_vec) tb="$tb pe-arm-wince.lo pe-arm.lo peigen.lo cofflink.lo " ;; + arm_wince_pei_big_vec) tb="$tb pei-arm-wince.lo pei-arm.lo peigen.lo cofflink.lo " ;; + arm_wince_pei_little_vec) tb="$tb pei-arm-wince.lo pei-arm.lo peigen.lo cofflink.lo " ;; armcoff_big_vec) tb="$tb coff-arm.lo cofflink.lo " ;; armcoff_little_vec) tb="$tb coff-arm.lo cofflink.lo " ;; armnetbsd_vec) tb="$tb armnetbsd.lo aout32.lo" ;; @@ -13067,6 +18611,7 @@ do b_out_vec_big_host) tb="$tb bout.lo aout32.lo" ;; b_out_vec_little_host) tb="$tb bout.lo aout32.lo" ;; bfd_efi_app_ia32_vec) tb="$tb efi-app-ia32.lo peigen.lo cofflink.lo" ;; + bfd_efi_app_x86_64_vec) tb="$tb efi-app-x86_64.lo pex64igen.lo cofflink.lo" ;target_size=64;; bfd_efi_app_ia64_vec) tb="$tb efi-app-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;; bfd_elf32_am33lin_vec) tb="$tb elf32-am33lin.lo elf32.lo $elf" ;; bfd_elf32_avr_vec) tb="$tb elf32-avr.lo elf32.lo $elf" ;; @@ -13082,6 +18627,7 @@ do bfd_elf32_bigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_bigmips_vxworks_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; + bfd_elf32_cr16_vec) tb="$tb elf32-cr16.lo elf32.lo $elf" ;; bfd_elf32_cr16c_vec) tb="$tb elf32-cr16c.lo elf32.lo $elf" ;; bfd_elf32_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;; bfd_elf32_crx_vec) tb="$tb elf32-crx.lo elf32.lo $elf" ;; @@ -13127,6 +18673,8 @@ do bfd_elf32_m88k_vec) tb="$tb elf32-m88k.lo elf32.lo $elf" ;; bfd_elf32_mcore_big_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;; bfd_elf32_mcore_little_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;; + bfd_elf32_mep_vec) tb="$tb elf32-mep.lo elf32.lo $elf" ;; + bfd_elf32_mep_little_vec) tb="$tb elf32-mep.lo elf32.lo $elf" ;; bfd_elf32_mn10200_vec) tb="$tb elf-m10200.lo elf32.lo $elf" ;; bfd_elf32_mn10300_vec) tb="$tb elf-m10300.lo elf32.lo $elf" ;; bfd_elf32_mt_vec) tb="$tb elf32-mt.lo elf32.lo $elf" ;; @@ -13143,24 +18691,29 @@ do bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;; bfd_elf32_powerpc_vxworks_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;; bfd_elf32_s390_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;; + bfd_elf32_bigscore_vec) tb="$tb elf32-score.lo elf32.lo $elf" ;; + bfd_elf32_littlescore_vec) tb="$tb elf32-score.lo elf32.lo $elf" ;; # 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_spu_vec) tb="$tb elf32-spu.lo elf32.lo $elf" ;; bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_us_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;; @@ -13192,8 +18745,10 @@ do bfd_elf64_sh64lnbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; bfd_elf64_sh64nbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_sparc_freebsd_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf64_x86_64_freebsd_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_x86_64_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"; target_size=64 ;; bfd_mmo_vec) tb="$tb mmo.lo" target_size=64 ;; bfd_powerpc_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;; @@ -13216,6 +18771,7 @@ do i386aout_vec) tb="$tb i386aout.lo aout32.lo" ;; i386bsd_vec) tb="$tb i386bsd.lo aout32.lo" ;; i386coff_vec) tb="$tb coff-i386.lo cofflink.lo" ;; + x86_64coff_vec) tb="$tb coff-x86_64.lo cofflink.lo"; target_size=64 ;; i386dynix_vec) tb="$tb i386dynix.lo aout32.lo" ;; i386freebsd_vec) tb="$tb i386freebsd.lo aout32.lo" ;; i386linux_vec) tb="$tb i386linux.lo aout32.lo" ;; @@ -13227,6 +18783,8 @@ do i386os9k_vec) tb="$tb i386os9k.lo aout32.lo" ;; i386pe_vec) tb="$tb pe-i386.lo peigen.lo cofflink.lo" ;; i386pei_vec) tb="$tb pei-i386.lo peigen.lo cofflink.lo" ;; + x86_64pe_vec) tb="$tb pe-x86_64.lo pex64igen.lo cofflink.lo"; target_size=64 ;; + x86_64pei_vec) tb="$tb pei-x86_64.lo pex64igen.lo cofflink.lo"; target_size=64 ;; i860coff_vec) tb="$tb coff-i860.lo cofflink.lo" ;; icoff_big_vec) tb="$tb coff-i960.lo cofflink.lo" ;; icoff_little_vec) tb="$tb coff-i960.lo cofflink.lo" ;; @@ -13379,7 +18937,7 @@ fi # all_targets is true case ${host64}-${target64}-${want64} in *true*) wordsize=64 - bfd_libs='$(BFD64_LIBS) $(BFD32_LIBS)' + bfd64_libs='$(BFD64_LIBS)' all_backends='$(BFD64_BACKENDS) $(BFD32_BACKENDS)' if test $BFD_HOST_64_BIT_DEFINED = 0; then { echo "$as_me:$LINENO: WARNING: You have requested a 64 bit BFD configuration, but" >&5 @@ -13420,7 +18978,6 @@ echo "$as_me: error: A newer version of gcc is needed for the requested 64-bit B ;; false-false-false) wordsize=32 - bfd_libs='$(BFD32_LIBS)' all_backends='$(BFD32_BACKENDS)' ;; esac @@ -14524,6 +20081,7 @@ esac rm -f doc/config.status ac_config_files="$ac_config_files Makefile doc/Makefile bfd-in3.h:bfd-in2.h po/Makefile.in:po/Make-in" + ac_config_commands="$ac_config_commands default" @@ -14643,6 +20201,13 @@ echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${GENINSRC_NEVER_TRUE}" && test -z "${GENINSRC_NEVER_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"GENINSRC_NEVER\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"GENINSRC_NEVER\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi if test -z "${INSTALL_LIBBFD_TRUE}" && test -z "${INSTALL_LIBBFD_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"INSTALL_LIBBFD\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -15086,6 +20651,272 @@ cat >>$CONFIG_STATUS <<_ACEOF AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`' +macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`' +macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`' +enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`' +pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`' +host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`' +host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`' +host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`' +build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`' +build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`' +build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`' +SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`' +Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`' +GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`' +EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`' +FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`' +LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`' +NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`' +LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`' +ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`' +exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`' +lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`' +reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`' +AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`' +STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`' +RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' +CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`' +compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`' +GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`' +objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`' +SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`' +ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`' +need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`' +libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' +module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`' +fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' +need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`' +version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`' +runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`' +libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`' +soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`' +finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`' +old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`' +striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# Quote evaled strings. +for var in SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +deplibs_check_method \ +file_magic_cmd \ +AR \ +AR_FLAGS \ +STRIP \ +RANLIB \ +CC \ +CFLAGS \ +compiler \ +lt_cv_sys_global_symbol_pipe \ +lt_cv_sys_global_symbol_to_cdecl \ +lt_cv_sys_global_symbol_to_c_name_address \ +SHELL \ +ECHO \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_wl \ +lt_prog_compiler_pic \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +shrext_cmds \ +export_dynamic_flag_spec \ +whole_archive_flag_spec \ +compiler_needs_object \ +with_gnu_ld \ +allow_undefined_flag \ +no_undefined_flag \ +hardcode_libdir_flag_spec \ +hardcode_libdir_flag_spec_ld \ +hardcode_libdir_separator \ +fix_srcfile_path \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +finish_eval \ +old_striplib \ +striplib; do + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in reload_cmds \ +old_postinstall_cmds \ +old_postuninstall_cmds \ +old_archive_cmds \ +extract_expsyms_cmds \ +old_archive_from_new_cmds \ +old_archive_from_expsyms_cmds \ +archive_cmds \ +archive_expsym_cmds \ +module_cmds \ +module_expsym_cmds \ +export_symbols_cmds \ +prelink_cmds \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +sys_lib_dlsearch_path_spec; do + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Fix-up fallback echo if it was mangled by the above quoting rules. +case \$lt_ECHO in +*'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\` + ;; +esac + +ac_aux_dir='$ac_aux_dir' +xsi_shell='$xsi_shell' +lt_shell_append='$lt_shell_append' + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + + + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile' + + + +# Capture the value of obsolete ALL_LINGUAS because we need it to compute + # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it + # from automake. + eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" + + +GCC="$GCC" +CC="$CC" +acx_cv_header_stdint="$acx_cv_header_stdint" +acx_cv_type_int8_t="$acx_cv_type_int8_t" +acx_cv_type_int16_t="$acx_cv_type_int16_t" +acx_cv_type_int32_t="$acx_cv_type_int32_t" +acx_cv_type_int64_t="$acx_cv_type_int64_t" +acx_cv_type_intptr_t="$acx_cv_type_intptr_t" +ac_cv_type_uintmax_t="$ac_cv_type_uintmax_t" +ac_cv_type_uintptr_t="$ac_cv_type_uintptr_t" +ac_cv_type_uint64_t="$ac_cv_type_uint64_t" +ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t" +ac_cv_type_u_int32_t="$ac_cv_type_u_int32_t" +ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t" +ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t" +ac_cv_sizeof_void_p="$ac_cv_sizeof_void_p" + + + _ACEOF @@ -15100,6 +20931,9 @@ do "bfd-in3.h" ) CONFIG_FILES="$CONFIG_FILES bfd-in3.h:bfd-in2.h" ;; "po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES po/Makefile.in:po/Make-in" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "libtool" ) CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; + "bfd_stdint.h" ) CONFIG_COMMANDS="$CONFIG_COMMANDS bfd_stdint.h" ;; "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.in" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 @@ -15241,42 +21075,50 @@ s,@AR@,$AR,;t t s,@ac_ct_AR@,$ac_ct_AR,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t -s,@LN_S@,$LN_S,;t t s,@LIBTOOL@,$LIBTOOL,;t t +s,@SED@,$SED,;t t +s,@EGREP@,$EGREP,;t t +s,@FGREP@,$FGREP,;t t +s,@GREP@,$GREP,;t t +s,@LD@,$LD,;t t +s,@DUMPBIN@,$DUMPBIN,;t t +s,@ac_ct_DUMPBIN@,$ac_ct_DUMPBIN,;t t +s,@NM@,$NM,;t t +s,@LN_S@,$LN_S,;t t +s,@lt_ECHO@,$lt_ECHO,;t t +s,@CPP@,$CPP,;t t +s,@DEBUGDIR@,$DEBUGDIR,;t t +s,@PKGVERSION@,$PKGVERSION,;t t +s,@REPORT_BUGS_TO@,$REPORT_BUGS_TO,;t t +s,@REPORT_BUGS_TEXI@,$REPORT_BUGS_TEXI,;t t s,@WARN_CFLAGS@,$WARN_CFLAGS,;t t s,@NO_WERROR@,$NO_WERROR,;t t s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t s,@MAINT@,$MAINT,;t t +s,@GENINSRC_NEVER_TRUE@,$GENINSRC_NEVER_TRUE,;t t +s,@GENINSRC_NEVER_FALSE@,$GENINSRC_NEVER_FALSE,;t t s,@INSTALL_LIBBFD_TRUE@,$INSTALL_LIBBFD_TRUE,;t t s,@INSTALL_LIBBFD_FALSE@,$INSTALL_LIBBFD_FALSE,;t t s,@host_noncanonical@,$host_noncanonical,;t t s,@target_noncanonical@,$target_noncanonical,;t t s,@bfdlibdir@,$bfdlibdir,;t t s,@bfdincludedir@,$bfdincludedir,;t t -s,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t -s,@ALLOCA@,$ALLOCA,;t t s,@USE_NLS@,$USE_NLS,;t t -s,@MSGFMT@,$MSGFMT,;t t -s,@GMSGFMT@,$GMSGFMT,;t t +s,@LIBINTL@,$LIBINTL,;t t +s,@LIBINTL_DEP@,$LIBINTL_DEP,;t t +s,@INCINTL@,$INCINTL,;t t s,@XGETTEXT@,$XGETTEXT,;t t -s,@USE_INCLUDED_LIBINTL@,$USE_INCLUDED_LIBINTL,;t t +s,@GMSGFMT@,$GMSGFMT,;t t +s,@POSUB@,$POSUB,;t t s,@CATALOGS@,$CATALOGS,;t t -s,@CATOBJEXT@,$CATOBJEXT,;t t s,@DATADIRNAME@,$DATADIRNAME,;t t -s,@GMOFILES@,$GMOFILES,;t t s,@INSTOBJEXT@,$INSTOBJEXT,;t t -s,@INTLDEPS@,$INTLDEPS,;t t -s,@INTLLIBS@,$INTLLIBS,;t t -s,@INTLOBJS@,$INTLOBJS,;t t -s,@POFILES@,$POFILES,;t t -s,@POSUB@,$POSUB,;t t -s,@INCLUDE_LOCALE_H@,$INCLUDE_LOCALE_H,;t t -s,@GT_NO@,$GT_NO,;t t -s,@GT_YES@,$GT_YES,;t t +s,@GENCAT@,$GENCAT,;t t +s,@CATOBJEXT@,$CATOBJEXT,;t t s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t -s,@l@,$l,;t t +s,@MSGFMT@,$MSGFMT,;t t +s,@MSGMERGE@,$MSGMERGE,;t t s,@HDEFINES@,$HDEFINES,;t t s,@BFD_HOST_64BIT_LONG@,$BFD_HOST_64BIT_LONG,;t t s,@BFD_HOST_LONG_LONG@,$BFD_HOST_LONG_LONG,;t t @@ -15291,7 +21133,7 @@ s,@WIN32LDFLAGS@,$WIN32LDFLAGS,;t t s,@WIN32LIBADD@,$WIN32LIBADD,;t t s,@TDEFINES@,$TDEFINES,;t t s,@wordsize@,$wordsize,;t t -s,@bfd_libs@,$bfd_libs,;t t +s,@bfd64_libs@,$bfd64_libs,;t t s,@all_backends@,$all_backends,;t t s,@bfd_backends@,$bfd_backends,;t t s,@bfd_machines@,$bfd_machines,;t t @@ -15986,7 +21828,1002 @@ echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} done done ;; - default ) sed -e '/SRC-POTFILES =/r po/SRC-POTFILES' -e '/BLD-POTFILES =/r po/BLD-POTFILES' po/Makefile.in > po/Makefile ;; + libtool ) + + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me (GNU $PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007 Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, a copy can be downloaded from +# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# The names of the tagged configurations supported by this script. +available_tags="" + +# ### BEGIN LIBTOOL CONFIG + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="\$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP=$lt_GREP + +# An ERE matcher. +EGREP=$lt_EGREP + +# A literal string matcher. +FGREP=$lt_FGREP + +# A BSD- or MS-compatible name lister. +NM=$lt_NM + +# Whether we need soft or hard links. +LN_S=$lt_LN_S + +# What is the maximum length of a command? +max_cmd_len=$max_cmd_len + +# Object file suffix (normally "o"). +objext=$ac_objext + +# Executable file suffix (normally ""). +exeext=$exeext + +# whether the shell understands "unset". +lt_unset=$lt_unset + +# turn spaces into newlines. +SP2NL=$lt_lt_SP2NL + +# turn newlines into spaces. +NL2SP=$lt_lt_NL2SP + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == "file_magic". +file_magic_cmd=$lt_file_magic_cmd + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A symbol stripping program. +STRIP=$lt_STRIP + +# Commands used to install an old-style archive. +RANLIB=$lt_RANLIB +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# A C compiler. +LTCC=$lt_CC + +# LTCC compiler flags. +LTCFLAGS=$lt_CFLAGS + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that does not interpret backslashes. +ECHO=$lt_ECHO + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=$MAGIC_CMD + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Old archive suffix (normally "a"). +libext=$libext + +# Shared library suffix (normally ".so"). +shrext_cmds=$lt_shrext_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink=$lt_variables_saved_for_relink + +# Do we need the "lib" prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Library versioning type. +version_type=$version_type + +# Shared library runtime path variable. +runpath_var=$runpath_var + +# Shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Command to use after installation of a shared archive. +postinstall_cmds=$lt_postinstall_cmds + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval=$lt_finish_eval + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Compile-time system search path for libraries. +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + + +# The linker used to build libraries. +LD=$lt_LD + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds + +# A language specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU compiler? +with_gcc=$GCC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# If ld is used when linking, flag to hardcode \$libdir into a binary +# during linking. This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + +ltmain="$ac_aux_dir/ltmain.sh" + + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + case $xsi_shell in + yes) + cat << \_LT_EOF >> "$cfgfile" +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac +} + +# func_basename file +func_basename () +{ + func_basename_result="${1##*/}" +} + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +func_stripname () +{ + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"} +} + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=${1%%=*} + func_opt_split_arg=${1#*=} +} + +# func_lo2o object +func_lo2o () +{ + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac +} +_LT_EOF + ;; + *) # Bourne compatible functions. + cat << \_LT_EOF >> "$cfgfile" +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} + +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` +} + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; + esac +} + +# sed scripts: +my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q' +my_sed_long_arg='1s/^-[^=]*=//' + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` + func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` +} + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` +} +_LT_EOF +esac + +case $lt_shell_append in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$1+=\$2" +} +_LT_EOF + ;; + *) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$1=\$$1\$2" +} +_LT_EOF + ;; + esac + + + sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + ;; + default-1 ) + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + POMAKEFILEDEPS="POTFILES.in" + # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend + # on $ac_dir but don't depend on user-specified configuration + # parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$OBSOLETE_ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assigment from automake. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" + else + # The set of available languages was given in configure.in. + eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' + fi + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + POFILES= + GMOFILES= + UPDATEPOFILES= + DUMMYPOFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do + if test -f "$f"; then + case "$f" in + *.orig | *.bak | *~) ;; + *) cat "$f" >> "$ac_dir/Makefile" ;; + esac + fi + done + fi + ;; + esac + done ;; + bfd_stdint.h ) +if test "$GCC" = yes; then + echo "/* generated for " `$CC --version | sed 1q` "*/" > tmp-stdint.h +else + echo "/* generated for $CC */" > tmp-stdint.h +fi + +sed 's/^ *//' >> tmp-stdint.h <<EOF + + #ifndef GCC_GENERATED_STDINT_H + #define GCC_GENERATED_STDINT_H 1 + + #include <sys/types.h> +EOF + +if test "$acx_cv_header_stdint" != stdint.h; then + echo "#include <stddef.h>" >> tmp-stdint.h +fi +if test "$acx_cv_header_stdint" != stddef.h; then + echo "#include <$acx_cv_header_stdint>" >> tmp-stdint.h +fi + +sed 's/^ *//' >> tmp-stdint.h <<EOF + /* glibc uses these symbols as guards to prevent redefinitions. */ + #ifdef __int8_t_defined + #define _INT8_T + #define _INT16_T + #define _INT32_T + #endif + #ifdef __uint32_t_defined + #define _UINT32_T + #endif + +EOF + +# ----------------- done header, emit basic int types ------------- +if test "$acx_cv_header_stdint" = stddef.h; then + sed 's/^ *//' >> tmp-stdint.h <<EOF + + #ifndef _UINT8_T + #define _UINT8_T + #ifndef __uint8_t_defined + #define __uint8_t_defined + typedef unsigned $acx_cv_type_int8_t uint8_t; + #endif + #endif + + #ifndef _UINT16_T + #define _UINT16_T + #ifndef __uint16_t_defined + #define __uint16_t_defined + typedef unsigned $acx_cv_type_int16_t uint16_t; + #endif + #endif + + #ifndef _UINT32_T + #define _UINT32_T + #ifndef __uint32_t_defined + #define __uint32_t_defined + typedef unsigned $acx_cv_type_int32_t uint32_t; + #endif + #endif + + #ifndef _INT8_T + #define _INT8_T + #ifndef __int8_t_defined + #define __int8_t_defined + typedef $acx_cv_type_int8_t int8_t; + #endif + #endif + + #ifndef _INT16_T + #define _INT16_T + #ifndef __int16_t_defined + #define __int16_t_defined + typedef $acx_cv_type_int16_t int16_t; + #endif + #endif + + #ifndef _INT32_T + #define _INT32_T + #ifndef __int32_t_defined + #define __int32_t_defined + typedef $acx_cv_type_int32_t int32_t; + #endif + #endif +EOF +elif test "$ac_cv_type_u_int32_t" = yes; then + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* int8_t int16_t int32_t defined by inet code, we do the u_intXX types */ + #ifndef _INT8_T + #define _INT8_T + #endif + #ifndef _INT16_T + #define _INT16_T + #endif + #ifndef _INT32_T + #define _INT32_T + #endif + + #ifndef _UINT8_T + #define _UINT8_T + #ifndef __uint8_t_defined + #define __uint8_t_defined + typedef u_int8_t uint8_t; + #endif + #endif + + #ifndef _UINT16_T + #define _UINT16_T + #ifndef __uint16_t_defined + #define __uint16_t_defined + typedef u_int16_t uint16_t; + #endif + #endif + + #ifndef _UINT32_T + #define _UINT32_T + #ifndef __uint32_t_defined + #define __uint32_t_defined + typedef u_int32_t uint32_t; + #endif + #endif +EOF +else + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* Some systems have guard macros to prevent redefinitions, define them. */ + #ifndef _INT8_T + #define _INT8_T + #endif + #ifndef _INT16_T + #define _INT16_T + #endif + #ifndef _INT32_T + #define _INT32_T + #endif + #ifndef _UINT8_T + #define _UINT8_T + #endif + #ifndef _UINT16_T + #define _UINT16_T + #endif + #ifndef _UINT32_T + #define _UINT32_T + #endif +EOF +fi + +# ------------- done basic int types, emit int64_t types ------------ +if test "$ac_cv_type_uint64_t" = yes; then + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* system headers have good uint64_t and int64_t */ + #ifndef _INT64_T + #define _INT64_T + #endif + #ifndef _UINT64_T + #define _UINT64_T + #endif +EOF +elif test "$ac_cv_type_u_int64_t" = yes; then + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* system headers have an u_int64_t (and int64_t) */ + #ifndef _INT64_T + #define _INT64_T + #endif + #ifndef _UINT64_T + #define _UINT64_T + #ifndef __uint64_t_defined + #define __uint64_t_defined + typedef u_int64_t uint64_t; + #endif + #endif +EOF +elif test -n "$acx_cv_type_int64_t"; then + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* architecture has a 64-bit type, $acx_cv_type_int64_t */ + #ifndef _INT64_T + #define _INT64_T + typedef $acx_cv_type_int64_t int64_t; + #endif + #ifndef _UINT64_T + #define _UINT64_T + #ifndef __uint64_t_defined + #define __uint64_t_defined + typedef unsigned $acx_cv_type_int64_t uint64_t; + #endif + #endif +EOF +else + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* some common heuristics for int64_t, using compiler-specific tests */ + #if defined __STDC_VERSION__ && (__STDC_VERSION__-0) >= 199901L + #ifndef _INT64_T + #define _INT64_T + #ifndef __int64_t_defined + typedef long long int64_t; + #endif + #endif + #ifndef _UINT64_T + #define _UINT64_T + typedef unsigned long long uint64_t; + #endif + + #elif defined __GNUC__ && defined (__STDC__) && __STDC__-0 + /* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and + does not implement __extension__. But that compiler doesn't define + __GNUC_MINOR__. */ + # if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__) + # define __extension__ + # endif + + # ifndef _INT64_T + # define _INT64_T + __extension__ typedef long long int64_t; + # endif + # ifndef _UINT64_T + # define _UINT64_T + __extension__ typedef unsigned long long uint64_t; + # endif + + #elif !defined __STRICT_ANSI__ + # if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__ + + # ifndef _INT64_T + # define _INT64_T + typedef __int64 int64_t; + # endif + # ifndef _UINT64_T + # define _UINT64_T + typedef unsigned __int64 uint64_t; + # endif + # endif /* compiler */ + + #endif /* ANSI version */ +EOF +fi + +# ------------- done int64_t types, emit intptr types ------------ +if test "$ac_cv_type_uintptr_t" != yes; then + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* Define intptr_t based on sizeof(void*) = $ac_cv_sizeof_void_p */ + #ifndef __uintptr_t_defined + typedef u$acx_cv_type_intptr_t uintptr_t; + #endif + #ifndef __intptr_t_defined + typedef $acx_cv_type_intptr_t intptr_t; + #endif +EOF +fi + +# ------------- done intptr types, emit int_least types ------------ +if test "$ac_cv_type_int_least32_t" != yes; then + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* Define int_least types */ + typedef int8_t int_least8_t; + typedef int16_t int_least16_t; + typedef int32_t int_least32_t; + #ifdef _INT64_T + typedef int64_t int_least64_t; + #endif + + typedef uint8_t uint_least8_t; + typedef uint16_t uint_least16_t; + typedef uint32_t uint_least32_t; + #ifdef _UINT64_T + typedef uint64_t uint_least64_t; + #endif +EOF +fi + +# ------------- done intptr types, emit int_fast types ------------ +if test "$ac_cv_type_int_fast32_t" != yes; then + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* Define int_fast types. short is often slow */ + typedef int8_t int_fast8_t; + typedef int int_fast16_t; + typedef int32_t int_fast32_t; + #ifdef _INT64_T + typedef int64_t int_fast64_t; + #endif + + typedef uint8_t uint_fast8_t; + typedef unsigned int uint_fast16_t; + typedef uint32_t uint_fast32_t; + #ifdef _UINT64_T + typedef uint64_t uint_fast64_t; + #endif +EOF +fi + +if test "$ac_cv_type_uintmax_t" != yes; then + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* Define intmax based on what we found */ + #ifdef _INT64_T + typedef int64_t intmax_t; + #else + typedef long intmax_t; + #endif + #ifdef _UINT64_T + typedef uint64_t uintmax_t; + #else + typedef unsigned long uintmax_t; + #endif +EOF +fi + +sed 's/^ *//' >> tmp-stdint.h <<EOF + + #endif /* GCC_GENERATED_STDINT_H */ +EOF + +if test -r bfd_stdint.h && cmp -s tmp-stdint.h bfd_stdint.h; then + rm -f tmp-stdint.h +else + mv -f tmp-stdint.h bfd_stdint.h +fi + + ;; + default ) +case "$srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; +esac +POFILES= +GMOFILES= +for lang in dummy $OBSOLETE_ALL_LINGUAS; do + if test $lang != dummy; then + POFILES="$POFILES $srcdirpre$lang.po" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + fi +done +sed -e '/SRC-POTFILES =/r po/SRC-POTFILES' \ + -e '/BLD-POTFILES =/r po/BLD-POTFILES' \ + -e "s,@POFILES@,$POFILES," \ + -e "s,@GMOFILES@,$GMOFILES," \ + po/Makefile.in > po/Makefile ;; esac done _ACEOF diff --git a/contrib/binutils/bfd/configure.in b/contrib/binutils/bfd/configure.in index 212f96142fd8..1ea98ae0259a 100644 --- a/contrib/binutils/bfd/configure.in +++ b/contrib/binutils/bfd/configure.in @@ -8,7 +8,7 @@ AC_CONFIG_SRCDIR([libbfd.c]) AC_CANONICAL_TARGET AC_ISC_POSIX -AM_INIT_AUTOMAKE(bfd, 2.17) +AM_INIT_AUTOMAKE(bfd, 2.17.50) dnl These must be called before AM_PROG_LIBTOOL, because it may want dnl to call AC_CHECK_PROG. @@ -19,7 +19,10 @@ dnl Default to a non shared library. This may be overridden by the dnl configure option --enable-shared. AM_DISABLE_SHARED -AM_PROG_LIBTOOL +AC_PROG_CC +AC_GNU_SOURCE + +AC_PROG_LIBTOOL AC_ARG_ENABLE(64-bit-bfd, [ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)], @@ -63,6 +66,17 @@ if test $use_secureplt = true; then [Define if we should default to creating read-only plt entries]) fi +DEBUGDIR=${libdir}/debug + +AC_ARG_WITH(separate-debug-dir, + AS_HELP_STRING([--with-separate-debug-dir=DIR], + [Look for global separate debug info in DIR [[default=LIBDIR/debug]]]), +[DEBUGDIR="${withval}"]) +AC_SUBST(DEBUGDIR) + +ACX_PKGVERSION([GNU Binutils]) +ACX_BUGURL([http://www.sourceware.org/bugzilla/]) + AM_BINUTILS_WARNINGS AM_CONFIG_HEADER(config.h:config.in) @@ -72,6 +86,7 @@ if test -z "$target" ; then fi AM_MAINTAINER_MODE +AM_CONDITIONAL(GENINSRC_NEVER, false) AM_INSTALL_LIBBFD AC_EXEEXT @@ -81,11 +96,9 @@ bfd_default_target_size=32 # host stuff: -AC_PROG_CC -AC_GNU_SOURCE - ALL_LINGUAS="fr tr ja es sv da zh_CN ro rw vi" -CY_GNU_GETTEXT +ZW_GNU_GETTEXT_SISTER_DIR +AM_PO_SUBDIRS # Permit host specific settings. . ${srcdir}/configure.host @@ -135,6 +148,7 @@ BFD_CC_FOR_BUILD AC_CHECK_HEADERS(stddef.h string.h strings.h stdlib.h time.h unistd.h) AC_CHECK_HEADERS(fcntl.h sys/file.h sys/time.h) +GCC_HEADER_STDINT(bfd_stdint.h) AC_HEADER_TIME AC_HEADER_DIRENT ACX_HEADER_STRING @@ -178,7 +192,9 @@ if test "${target}" = "${host}"; then alpha*-*-*) COREFILE=osf-core.lo ;; arm-*-freebsd* | arm-*-kfreebsd*-gnu) COREFILE='' ;; - arm-*-netbsd*) COREFILE=netbsd-core.lo ;; + arm-*-netbsd* | arm-*-openbsd*) + COREFILE=netbsd-core.lo + ;; arm-*-riscix) COREFILE=trad-core.lo ;; hppa*-*-hpux*) COREFILE=hpux-core.lo ;; hppa*-*-hiux*) COREFILE=hpux-core.lo ;; @@ -361,7 +377,9 @@ changequote([,])dnl powerpc-*-netbsd*) COREFILE=netbsd-core.lo ;; powerpc-*-*bsd*) COREFILE=netbsd-core.lo ;; s390*-*-*) COREFILE=trad-core.lo ;; - sh*-*-netbsd*) COREFILE=netbsd-core.lo ;; + sh*-*-netbsd* | sh*-*-openbsd*) + COREFILE=netbsd-core.lo + ;; sparc-*-netbsd* | sparc*-*-openbsd*) COREFILE=netbsd-core.lo ;; @@ -551,7 +569,7 @@ selarchs="$f" # Target backend .o files. tb= -elf="elf.lo elflink.lo elf-strtab.lo elf-eh-frame.lo dwarf1.lo" +elf="elf.lo elflink.lo elf-attrs.lo elf-strtab.lo elf-eh-frame.lo dwarf1.lo" for vec in $selvecs do @@ -570,6 +588,10 @@ do arm_epoc_pe_little_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;; arm_epoc_pei_big_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;; arm_epoc_pei_little_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;; + arm_wince_pe_big_vec) tb="$tb pe-arm-wince.lo pe-arm.lo peigen.lo cofflink.lo " ;; + arm_wince_pe_little_vec) tb="$tb pe-arm-wince.lo pe-arm.lo peigen.lo cofflink.lo " ;; + arm_wince_pei_big_vec) tb="$tb pei-arm-wince.lo pei-arm.lo peigen.lo cofflink.lo " ;; + arm_wince_pei_little_vec) tb="$tb pei-arm-wince.lo pei-arm.lo peigen.lo cofflink.lo " ;; armcoff_big_vec) tb="$tb coff-arm.lo cofflink.lo " ;; armcoff_little_vec) tb="$tb coff-arm.lo cofflink.lo " ;; armnetbsd_vec) tb="$tb armnetbsd.lo aout32.lo" ;; @@ -580,6 +602,7 @@ do b_out_vec_big_host) tb="$tb bout.lo aout32.lo" ;; b_out_vec_little_host) tb="$tb bout.lo aout32.lo" ;; bfd_efi_app_ia32_vec) tb="$tb efi-app-ia32.lo peigen.lo cofflink.lo" ;; + bfd_efi_app_x86_64_vec) tb="$tb efi-app-x86_64.lo pex64igen.lo cofflink.lo" ;target_size=64;; bfd_efi_app_ia64_vec) tb="$tb efi-app-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;; bfd_elf32_am33lin_vec) tb="$tb elf32-am33lin.lo elf32.lo $elf" ;; bfd_elf32_avr_vec) tb="$tb elf32-avr.lo elf32.lo $elf" ;; @@ -595,6 +618,7 @@ do bfd_elf32_bigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_bigmips_vxworks_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; + bfd_elf32_cr16_vec) tb="$tb elf32-cr16.lo elf32.lo $elf" ;; bfd_elf32_cr16c_vec) tb="$tb elf32-cr16c.lo elf32.lo $elf" ;; bfd_elf32_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;; bfd_elf32_crx_vec) tb="$tb elf32-crx.lo elf32.lo $elf" ;; @@ -640,6 +664,8 @@ do bfd_elf32_m88k_vec) tb="$tb elf32-m88k.lo elf32.lo $elf" ;; bfd_elf32_mcore_big_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;; bfd_elf32_mcore_little_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;; + bfd_elf32_mep_vec) tb="$tb elf32-mep.lo elf32.lo $elf" ;; + bfd_elf32_mep_little_vec) tb="$tb elf32-mep.lo elf32.lo $elf" ;; bfd_elf32_mn10200_vec) tb="$tb elf-m10200.lo elf32.lo $elf" ;; bfd_elf32_mn10300_vec) tb="$tb elf-m10300.lo elf32.lo $elf" ;; bfd_elf32_mt_vec) tb="$tb elf32-mt.lo elf32.lo $elf" ;; @@ -656,24 +682,29 @@ do bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;; bfd_elf32_powerpc_vxworks_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;; bfd_elf32_s390_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;; + bfd_elf32_bigscore_vec) tb="$tb elf32-score.lo elf32.lo $elf" ;; + bfd_elf32_littlescore_vec) tb="$tb elf32-score.lo elf32.lo $elf" ;; # 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_spu_vec) tb="$tb elf32-spu.lo elf32.lo $elf" ;; bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_us_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;; @@ -705,8 +736,10 @@ do bfd_elf64_sh64lnbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; bfd_elf64_sh64nbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_sparc_freebsd_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf64_x86_64_freebsd_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_x86_64_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"; target_size=64 ;; bfd_mmo_vec) tb="$tb mmo.lo" target_size=64 ;; bfd_powerpc_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;; @@ -729,6 +762,7 @@ do i386aout_vec) tb="$tb i386aout.lo aout32.lo" ;; i386bsd_vec) tb="$tb i386bsd.lo aout32.lo" ;; i386coff_vec) tb="$tb coff-i386.lo cofflink.lo" ;; + x86_64coff_vec) tb="$tb coff-x86_64.lo cofflink.lo"; target_size=64 ;; i386dynix_vec) tb="$tb i386dynix.lo aout32.lo" ;; i386freebsd_vec) tb="$tb i386freebsd.lo aout32.lo" ;; i386linux_vec) tb="$tb i386linux.lo aout32.lo" ;; @@ -740,6 +774,8 @@ do i386os9k_vec) tb="$tb i386os9k.lo aout32.lo" ;; i386pe_vec) tb="$tb pe-i386.lo peigen.lo cofflink.lo" ;; i386pei_vec) tb="$tb pei-i386.lo peigen.lo cofflink.lo" ;; + x86_64pe_vec) tb="$tb pe-x86_64.lo pex64igen.lo cofflink.lo"; target_size=64 ;; + x86_64pei_vec) tb="$tb pei-x86_64.lo pex64igen.lo cofflink.lo"; target_size=64 ;; i860coff_vec) tb="$tb coff-i860.lo cofflink.lo" ;; icoff_big_vec) tb="$tb coff-i960.lo cofflink.lo" ;; icoff_little_vec) tb="$tb coff-i960.lo cofflink.lo" ;; @@ -890,7 +926,7 @@ fi # all_targets is true case ${host64}-${target64}-${want64} in *true*) wordsize=64 - bfd_libs='$(BFD64_LIBS) $(BFD32_LIBS)' + bfd64_libs='$(BFD64_LIBS)' all_backends='$(BFD64_BACKENDS) $(BFD32_BACKENDS)' if test $BFD_HOST_64_BIT_DEFINED = 0; then AC_MSG_WARN([You have requested a 64 bit BFD configuration, but]) @@ -911,13 +947,12 @@ case ${host64}-${target64}-${want64} in ;; false-false-false) wordsize=32 - bfd_libs='$(BFD32_LIBS)' all_backends='$(BFD32_BACKENDS)' ;; esac AC_SUBST(wordsize) -AC_SUBST(bfd_libs) +AC_SUBST(bfd64_libs) AC_SUBST(all_backends) AC_SUBST(bfd_backends) AC_SUBST(bfd_machines) @@ -962,7 +997,28 @@ esac rm -f doc/config.status AC_CONFIG_FILES([Makefile doc/Makefile bfd-in3.h:bfd-in2.h po/Makefile.in:po/Make-in]) -AC_CONFIG_COMMANDS([default],[[sed -e '/SRC-POTFILES =/r po/SRC-POTFILES' -e '/BLD-POTFILES =/r po/BLD-POTFILES' po/Makefile.in > po/Makefile]],[[]]) + +dnl We need this duplication, even though we use AM_PO_SUBDIRS, because of +dnl our two separate POTFILES. Yuck. +AC_CONFIG_COMMANDS([default], +[[ +case "$srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; +esac +POFILES= +GMOFILES= +for lang in dummy $OBSOLETE_ALL_LINGUAS; do + if test $lang != dummy; then + POFILES="$POFILES $srcdirpre$lang.po" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + fi +done +sed -e '/SRC-POTFILES =/r po/SRC-POTFILES' \ + -e '/BLD-POTFILES =/r po/BLD-POTFILES' \ + -e "s,@POFILES@,$POFILES," \ + -e "s,@GMOFILES@,$GMOFILES," \ + po/Makefile.in > po/Makefile]],[[]]) dnl Required by html and install-html AC_SUBST(datarootdir) diff --git a/contrib/binutils/bfd/corefile.c b/contrib/binutils/bfd/corefile.c index 602de911a2c5..58cd7f613f6d 100644 --- a/contrib/binutils/bfd/corefile.c +++ b/contrib/binutils/bfd/corefile.c @@ -1,6 +1,6 @@ /* Core file generic interface routines for BFD. - Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2002, 2003, 2005 - Free Software Foundation, Inc. + Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2002, 2003, 2005, + 2007 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -30,8 +30,8 @@ DESCRIPTION These are functions pertaining to core files. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" /* diff --git a/contrib/binutils/bfd/cpu-alpha.c b/contrib/binutils/bfd/cpu-alpha.c index 48b748d9f36e..db7abfbdb29f 100644 --- a/contrib/binutils/bfd/cpu-alpha.c +++ b/contrib/binutils/bfd/cpu-alpha.c @@ -1,5 +1,5 @@ /* BFD support for the Alpha architecture. - Copyright 1992, 1993, 1998, 2000, 2002, 2003 + Copyright 1992, 1993, 1998, 2000, 2002, 2003, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #define N(BITS_WORD, BITS_ADDR, NUMBER, PRINT, DEFAULT, NEXT) \ diff --git a/contrib/binutils/bfd/cpu-arc.c b/contrib/binutils/bfd/cpu-arc.c index ef97da0eda2e..bf9a739149f4 100644 --- a/contrib/binutils/bfd/cpu-arc.c +++ b/contrib/binutils/bfd/cpu-arc.c @@ -1,5 +1,6 @@ /* BFD support for the ARC processor - Copyright 1994, 1995, 1997, 2001, 2002 Free Software Foundation, Inc. + Copyright 1994, 1995, 1997, 2001, 2002, 2007 + Free Software Foundation, Inc. Contributed by Doug Evans (dje@cygnus.com). This file is part of BFD, the Binary File Descriptor library. @@ -18,8 +19,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #define ARC(mach, print_name, default_p, next) \ diff --git a/contrib/binutils/bfd/cpu-arm.c b/contrib/binutils/bfd/cpu-arm.c index a28a1f9e8fcf..a44b98395eee 100644 --- a/contrib/binutils/bfd/cpu-arm.c +++ b/contrib/binutils/bfd/cpu-arm.c @@ -1,5 +1,5 @@ /* BFD support for the ARM processor - Copyright 1994, 1997, 1999, 2000, 2002, 2003, 2004, 2005 + Copyright 1994, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) @@ -19,8 +19,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "libiberty.h" @@ -92,7 +92,8 @@ processors[] = { bfd_mach_arm_4, "strongarm1100" }, { bfd_mach_arm_XScale, "xscale" }, { bfd_mach_arm_ep9312, "ep9312" }, - { bfd_mach_arm_iWMMXt, "iwmmxt" } + { bfd_mach_arm_iWMMXt, "iwmmxt" }, + { bfd_mach_arm_iWMMXt2, "iwmmxt2" } }; static bfd_boolean @@ -137,7 +138,8 @@ static const bfd_arch_info_type arch_info_struct[] = N (bfd_mach_arm_5TE, "armv5te", FALSE, & arch_info_struct[9]), N (bfd_mach_arm_XScale, "xscale", FALSE, & arch_info_struct[10]), N (bfd_mach_arm_ep9312, "ep9312", FALSE, & arch_info_struct[11]), - N (bfd_mach_arm_iWMMXt,"iwmmxt", FALSE, NULL) + N (bfd_mach_arm_iWMMXt, "iwmmxt", FALSE, & arch_info_struct[12]), + N (bfd_mach_arm_iWMMXt2, "iwmmxt2", FALSE, NULL) }; const bfd_arch_info_type bfd_arm_arch = @@ -179,7 +181,9 @@ bfd_arm_merge_machines (bfd *ibfd, bfd *obfd) Intel XScale binary, since these architecture have co-processors which will not both be present on the same physical hardware. */ else if (in == bfd_mach_arm_ep9312 - && (out == bfd_mach_arm_XScale || out == bfd_mach_arm_iWMMXt)) + && (out == bfd_mach_arm_XScale + || out == bfd_mach_arm_iWMMXt + || out == bfd_mach_arm_iWMMXt2)) { _bfd_error_handler (_("\ ERROR: %B is compiled for the EP9312, whereas %B is compiled for XScale"), @@ -188,7 +192,9 @@ ERROR: %B is compiled for the EP9312, whereas %B is compiled for XScale"), return FALSE; } else if (out == bfd_mach_arm_ep9312 - && (in == bfd_mach_arm_XScale || in == bfd_mach_arm_iWMMXt)) + && (in == bfd_mach_arm_XScale + || in == bfd_mach_arm_iWMMXt + || in == bfd_mach_arm_iWMMXt2)) { _bfd_error_handler (_("\ ERROR: %B is compiled for the EP9312, whereas %B is compiled for XScale"), @@ -309,6 +315,7 @@ bfd_arm_update_notes (bfd *abfd, const char *note_section) case bfd_mach_arm_XScale: expected = "XScale"; break; case bfd_mach_arm_ep9312: expected = "ep9312"; break; case bfd_mach_arm_iWMMXt: expected = "iWMMXt"; break; + case bfd_mach_arm_iWMMXt2: expected = "iWMMXt2"; break; } if (strcmp (arch_string, expected) != 0) @@ -355,7 +362,8 @@ architectures[] = { "armv5te", bfd_mach_arm_5TE }, { "XScale", bfd_mach_arm_XScale }, { "ep9312", bfd_mach_arm_ep9312 }, - { "iWMMXt", bfd_mach_arm_iWMMXt } + { "iWMMXt", bfd_mach_arm_iWMMXt }, + { "iWMMXt2", bfd_mach_arm_iWMMXt2 } }; /* Extract the machine number stored in a note section. */ @@ -402,14 +410,22 @@ bfd_arm_get_mach_from_notes (bfd *abfd, const char *note_section) } bfd_boolean -bfd_is_arm_mapping_symbol_name (const char * name) +bfd_is_arm_special_symbol_name (const char * name, int type) { /* The ARM compiler outputs several obsolete forms. Recognize them - in addition to the standard $a, $t and $d. */ - return (name != NULL) - && (name[0] == '$') - && ((name[1] == 'a') || (name[1] == 't') || (name[1] == 'd') - || (name[1] == 'm') || (name[1] == 'f') || (name[1] == 'p')) - && (name[2] == 0 || name[2] == '.'); + in addition to the standard $a, $t and $d. We are somewhat loose + in what we accept here, since the full set is not documented. */ + if (!name || name[0] != '$') + return FALSE; + if (name[1] == 'a' || name[1] == 't' || name[1] == 'd') + type &= BFD_ARM_SPECIAL_SYM_TYPE_MAP; + else if (name[1] == 'm' || name[1] == 'f' || name[1] == 'p') + type &= BFD_ARM_SPECIAL_SYM_TYPE_TAG; + else if (name[1] >= 'a' && name[1] <= 'z') + type &= BFD_ARM_SPECIAL_SYM_TYPE_OTHER; + else + return FALSE; + + return (type != 0 && (name[2] == 0 || name[2] == '.')); } diff --git a/contrib/binutils/bfd/cpu-cr16.c b/contrib/binutils/bfd/cpu-cr16.c new file mode 100644 index 000000000000..5695f0eda87b --- /dev/null +++ b/contrib/binutils/bfd/cpu-cr16.c @@ -0,0 +1,40 @@ +/* BFD support for the CR16 processor. + Copyright 2007 Free Software Foundation, Inc. + Written by M R Swami Reddy + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "sysdep.h" +#include "bfd.h" +#include "libbfd.h" + + +const bfd_arch_info_type bfd_cr16_arch = + { + 16, /* 16 bits in a word. */ + 32, /* 32 bits in an address. */ + 8, /* 8 bits in a byte. */ + bfd_arch_cr16, /* enum bfd_architecture arch. */ + bfd_mach_cr16, + "cr16", /* Arch name. */ + "cr16", /* Printable name. */ + 1, /* Unsigned int section alignment power. */ + TRUE, /* The one and only. */ + bfd_default_compatible, + bfd_default_scan , + 0, + }; diff --git a/contrib/binutils/bfd/cpu-i386.c b/contrib/binutils/bfd/cpu-i386.c index 8886c47d0a09..339c7d994001 100644 --- a/contrib/binutils/bfd/cpu-i386.c +++ b/contrib/binutils/bfd/cpu-i386.c @@ -1,5 +1,5 @@ /* BFD support for the Intel 386 architecture. - Copyright 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002, 2004 + Copyright 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002, 2004, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" const bfd_arch_info_type bfd_x86_64_arch_intel_syntax = diff --git a/contrib/binutils/bfd/cpu-ia64.c b/contrib/binutils/bfd/cpu-ia64.c index e172f5a85f2b..a38d24de41bc 100644 --- a/contrib/binutils/bfd/cpu-ia64.c +++ b/contrib/binutils/bfd/cpu-ia64.c @@ -1,5 +1,5 @@ /* BFD support for the ia64 architecture. - Copyright 1998, 1999, 2000, 2002 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2002, 2007 Free Software Foundation, Inc. Contributed by David Mosberger-Tang <davidm@hpl.hp.com> This file is part of BFD, the Binary File Descriptor library. @@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" const bfd_arch_info_type bfd_ia64_elf32_arch = diff --git a/contrib/binutils/bfd/cpu-mep.c b/contrib/binutils/bfd/cpu-mep.c new file mode 100644 index 000000000000..d5ee1d67b423 --- /dev/null +++ b/contrib/binutils/bfd/cpu-mep.c @@ -0,0 +1,28 @@ +/* BFD support for the Toshiba Media Engine Processor. + Copyright (C) 2001, 2002, 2004, 2007 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "sysdep.h" +#include "bfd.h" +#include "libbfd.h" + +#define MA(x, n, def, y) { 32, 32, 8, bfd_arch_mep, x, "mep", n, \ + 2, def, bfd_default_compatible, bfd_default_scan, y } + +static const bfd_arch_info_type bfd_h1_arch = MA (bfd_mach_mep_h1, "h1", FALSE, NULL); +const bfd_arch_info_type bfd_mep_arch = MA (bfd_mach_mep, "mep", TRUE, & bfd_h1_arch); diff --git a/contrib/binutils/bfd/cpu-mips.c b/contrib/binutils/bfd/cpu-mips.c index c232f85d0fce..54bc0cf22621 100644 --- a/contrib/binutils/bfd/cpu-mips.c +++ b/contrib/binutils/bfd/cpu-mips.c @@ -1,6 +1,6 @@ /* bfd back-end for mips support Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001, - 2002, 2003, 2004 Free Software Foundation, Inc. + 2002, 2003, 2004, 2007 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -19,8 +19,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" static const bfd_arch_info_type *mips_compatible diff --git a/contrib/binutils/bfd/cpu-powerpc.c b/contrib/binutils/bfd/cpu-powerpc.c index 2584d6511622..e35833061298 100644 --- a/contrib/binutils/bfd/cpu-powerpc.c +++ b/contrib/binutils/bfd/cpu-powerpc.c @@ -1,5 +1,5 @@ /* BFD PowerPC CPU definition - Copyright 1994, 1995, 1996, 2000, 2001, 2002, 2003 + Copyright 1994, 1995, 1996, 2000, 2001, 2002, 2003, 2007 Free Software Foundation, Inc. Contributed by Ian Lance Taylor, Cygnus Support. @@ -19,8 +19,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" /* The common PowerPC architecture is compatible with the RS/6000. */ diff --git a/contrib/binutils/bfd/cpu-rs6000.c b/contrib/binutils/bfd/cpu-rs6000.c index 43c7be7539f9..4ed1d71e1a9b 100644 --- a/contrib/binutils/bfd/cpu-rs6000.c +++ b/contrib/binutils/bfd/cpu-rs6000.c @@ -1,11 +1,7 @@ /* BFD back-end for rs6000 support - Copyright 1990, 1991, 1993, 1995, 2000, 2002, 2003 + Copyright 1990, 1991, 1993, 1995, 2000, 2002, 2003, 2007 Free Software Foundation, Inc. - FIXME: Can someone provide a transliteration of this name into ASCII? - Using the following chars caused a compiler warning on HIUX (so I replaced - them with octal escapes), and isn't useful without an understanding of what - character set it is. - Written by Mimi Ph\373\364ng-Th\345o V\365 of IBM + Written by Mimi Phuong-Thao Vo of IBM and John Gilmore of Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -24,8 +20,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" /* The RS/6000 architecture is compatible with the PowerPC common diff --git a/contrib/binutils/bfd/cpu-s390.c b/contrib/binutils/bfd/cpu-s390.c index e7c714f26dc8..b385a9c6bdb1 100644 --- a/contrib/binutils/bfd/cpu-s390.c +++ b/contrib/binutils/bfd/cpu-s390.c @@ -1,5 +1,5 @@ /* BFD support for the s390 processor. - Copyright 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2007 Free Software Foundation, Inc. Contributed by Carl B. Pedersen and Martin Schwidefsky. This file is part of BFD, the Binary File Descriptor library. @@ -19,8 +19,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" const bfd_arch_info_type bfd_s390_64_arch = diff --git a/contrib/binutils/bfd/cpu-score.c b/contrib/binutils/bfd/cpu-score.c new file mode 100644 index 000000000000..90d3113bd66b --- /dev/null +++ b/contrib/binutils/bfd/cpu-score.c @@ -0,0 +1,51 @@ +/* BFD support for the score processor + Copyright 2006, 2007 Free Software Foundation, Inc. + Contributed by + Mei Ligang (ligang@sunnorth.com.cn) + Pei-Lin Tsai (pltsai@sunplus.com) + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "sysdep.h" +#include "bfd.h" +#include "libbfd.h" + +const bfd_arch_info_type +bfd_score_arch = +{ + 32, /* There's 32 bits_per_word. */ + 32, /* There's 32 bits_per_address. */ + 8, /* There's 8 bits_per_byte. */ + bfd_arch_score, /* One of enum bfd_architecture, defined + in archures.c and provided in + generated header files. */ + 0, /* Only 1 machine, but #255 for + historical reasons. */ + "score", /* The arch_name. */ + "score", /* The printable name is the same. */ + 4, /* Section alignment power; each section + is aligned to (only) 2^4 bytes. */ + TRUE, /* This is the default "machine", since + there's only one. */ + bfd_default_compatible, /* A default function for testing + "machine" compatibility of two + bfd_arch_info_type. */ + bfd_default_scan, /* Check if an bfd_arch_info_type is a + match. */ + NULL /* Pointer to next bfd_arch_info_type in + the same family. */ +}; diff --git a/contrib/binutils/bfd/cpu-sparc.c b/contrib/binutils/bfd/cpu-sparc.c index 42153269a24b..35a109e2c497 100644 --- a/contrib/binutils/bfd/cpu-sparc.c +++ b/contrib/binutils/bfd/cpu-sparc.c @@ -1,5 +1,5 @@ /* BFD support for the SPARC architecture. - Copyright 1992, 1995, 1996, 1998, 2000, 2002 + Copyright 1992, 1995, 1996, 1998, 2000, 2002, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" static const bfd_arch_info_type arch_info_struct[] = diff --git a/contrib/binutils/bfd/cpu-spu.c b/contrib/binutils/bfd/cpu-spu.c new file mode 100644 index 000000000000..540a19fa71bb --- /dev/null +++ b/contrib/binutils/bfd/cpu-spu.c @@ -0,0 +1,54 @@ +/* Copyright 2006, 2007 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "sysdep.h" +#include "bfd.h" +#include "libbfd.h" + + +static const bfd_arch_info_type * +spu_compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b) +{ + BFD_ASSERT (a->arch == bfd_arch_spu); + switch (b->arch) + { + default: + return NULL; + case bfd_arch_spu: + return bfd_default_compatible (a, b); + } + /*NOTREACHED*/ +} + +const bfd_arch_info_type bfd_spu_arch[] = +{ + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_spu, /* architecture */ + bfd_mach_spu, /* machine */ + "spu", /* architecture name */ + "spu:256K", /* printable name */ + 3, /* aligned power */ + TRUE, /* the default machine for the architecture */ + spu_compatible, /* the spu is only compatible with itself, see above */ + bfd_default_scan, + 0, /* next -- there are none! */ + } +}; diff --git a/contrib/binutils/bfd/doc/ChangeLog b/contrib/binutils/bfd/doc/ChangeLog index 7909268f98bf..6b96b613d139 100644 --- a/contrib/binutils/bfd/doc/ChangeLog +++ b/contrib/binutils/bfd/doc/ChangeLog @@ -1,7 +1,56 @@ +2007-07-02 Alan Modra <amodra@bigpond.net.au> + + * Makefile.in: Regenerate. + +2007-06-30 H.J. Lu <hongjiu.lu@intel.com> + + * Makefile.in: Likewise. + +2007-06-14 H.J. Lu <hongjiu.lu@intel.com> + + * Makefile.in: Regenerated. + +2007-05-22 Nick Clifton <nickc@redhat.com> + + * bfd.texinfo: Use @copying around the copyright notice. + * bfdint.texi: Likewise. + +2007-05-21 Nick Clifton <nickc@redhat.com> + + * bfdint.texi: Add GNU Free Documentation License notice. + +2007-04-24 Alan Modra <amodra@bigpond.net.au> + + * Makefile.in: Regenerate. + +2007-02-17 Mark Mitchell <mark@codesourcery.com> + Nathan Sidwell <nathan@codesourcery.com> + Vladimir Prus <vladimir@codesourcery.com + Joseph Myers <joseph@codesourcery.com> + + * Makefile.in: Regenerate. + +2006-07-24 Ralk Wildenhues <Ralf.Wildenhues@gmx.de> + + * bfd..texinfo: Fix spelling mistakes. + * bfdint.texinfo: Likewise. + +2006-07-18 Nigel Stephens <nigel@mips.com> + + * bfd.texinfo: Add @section for "What to Put Where". + 2006-06-07 Joseph S. Myers <joseph@codesourcery.com> * bfd.texinfo: Remove local @tex code. +2006-06-05 Alan Modra <amodra@bigpond.net.au> + + * Makefile.in: Regenerate. + +2006-05-11 Carlos O'Donell <carlos@codesourcery.com> + + * bfd.texinfo: Rename "Index" to "BFD Index" + 2006-04-06 Carlos O'Donell <carlos@codesourcery.com> * Makefile.am: Add install-html and install-html-am targets. diff --git a/contrib/binutils/bfd/doc/Makefile.am b/contrib/binutils/bfd/doc/Makefile.am index 6d221faad4a2..6ff434a6e7e6 100644 --- a/contrib/binutils/bfd/doc/Makefile.am +++ b/contrib/binutils/bfd/doc/Makefile.am @@ -8,7 +8,8 @@ DOCFILES = aoutx.texi archive.texi archures.texi \ libbfd.texi bfdwin.texi bfdio.texi \ opncls.texi reloc.texi section.texi \ syms.texi targets.texi init.texi hash.texi linker.texi \ - mmo.texi + mmo.texi \ + bfdver.texi PROTOS = archive.p archures.p bfd.p \ core.p format.p \ @@ -51,6 +52,7 @@ SRCIPROT = $(srcdir)/../cache.c $(srcdir)/../libbfd.c \ TEXIDIR = $(srcdir)/../../texinfo/fsf info_TEXINFOS = bfd.texinfo +bfd_TEXINFOS = $(DOCFILES) bfdsumm.texi MKDOC = chew$(EXEEXT_FOR_BUILD) @@ -68,8 +70,6 @@ chew.o: chew.c protos: libbfd.h libcoff.h bfd.h -$(srcdir)/bfd.info bfd.dvi bfd.html: $(DOCFILES) bfdsumm.texi bfd.texinfo - # We can't replace these rules with an implicit rule, because # makes without VPATH support couldn't find the .h files in `..'. @@ -274,6 +274,17 @@ bfd.h: $(BFD_H_DEP) echo "#endif" >> $@ echo "#endif" >> $@ +bfdver.texi: $(srcdir)/Makefile.in + @echo "creating $@"; \ + echo "@set VERSION $(VERSION)" > bfdver.texi; \ + if [ -n "$(PKGVERSION)" ]; then \ + echo "@set VERSION_PACKAGE $(PKGVERSION)" >> bfdver.texi; \ + fi; \ + echo "@set UPDATED `date '+%B %Y'`" >> bfdver.texi; \ + if [ -n "$(REPORT_BUGS_TEXI)" ]; then \ + echo "@set BUGURL $(REPORT_BUGS_TEXI)" >> bfdver.texi; \ + fi + noinst_TEXINFOS = bfdint.texi MOSTLYCLEANFILES = $(MKDOC) *.o @@ -309,6 +320,11 @@ install-html-am: $(HTMLS) fi; \ done +MAINTAINERCLEANFILES += bfd.info - - +# Automake 1.9 will only build info files in the objdir if they are +# mentioned in DISTCLEANFILES. It doesn't have to be unconditional, +# though, so we use a bogus condition. +if GENINSRC_NEVER +DISTCLEANFILES += bfd.info +endif diff --git a/contrib/binutils/bfd/doc/Makefile.in b/contrib/binutils/bfd/doc/Makefile.in index ad81061ec7b7..02b15d0dbe30 100644 --- a/contrib/binutils/bfd/doc/Makefile.in +++ b/contrib/binutils/bfd/doc/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.5 from Makefile.am. +# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -36,13 +36,26 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ + +# Automake 1.9 will only build info files in the objdir if they are +# mentioned in DISTCLEANFILES. It doesn't have to be unconditional, +# though, so we use a bogus condition. +@GENINSRC_NEVER_TRUE@am__append_1 = bfd.info subdir = doc -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(bfd_TEXINFOS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/../config/acx.m4 $(top_srcdir)/../bfd/bfd.m4 \ - $(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../libtool.m4 \ - $(top_srcdir)/../gettext.m4 $(top_srcdir)/configure.in +am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ + $(top_srcdir)/../config/depstand.m4 \ + $(top_srcdir)/../config/gettext-sister.m4 \ + $(top_srcdir)/../config/lead-dot.m4 \ + $(top_srcdir)/../config/nls.m4 $(top_srcdir)/../config/po.m4 \ + $(top_srcdir)/../config/progtest.m4 \ + $(top_srcdir)/../config/stdint.m4 $(top_srcdir)/../libtool.m4 \ + $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \ + $(top_srcdir)/../ltversion.m4 $(top_srcdir)/bfd.m4 \ + $(top_srcdir)/warning.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs @@ -51,7 +64,7 @@ CONFIG_CLEAN_FILES = depcomp = am__depfiles_maybe = SOURCES = -INFO_DEPS = $(srcdir)/bfd.info +INFO_DEPS = bfd.info TEXINFO_TEX = $(top_srcdir)/../texinfo/texinfo.tex am__TEXINFO_TEX_DIR = $(top_srcdir)/../texinfo DVIS = bfd.dvi @@ -69,7 +82,6 @@ MAKEINFOHTML = $(MAKEINFO) --html AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS) DVIPS = dvips ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ @@ -95,20 +107,24 @@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ +DEBUGDIR = @DEBUGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@ -GMOFILES = @GMOFILES@ +FGREP = @FGREP@ +GENCAT = @GENCAT@ +GENINSRC_NEVER_FALSE = @GENINSRC_NEVER_FALSE@ +GENINSRC_NEVER_TRUE = @GENINSRC_NEVER_TRUE@ GMSGFMT = @GMSGFMT@ -GT_NO = @GT_NO@ -GT_YES = @GT_YES@ +GREP = @GREP@ HDEFINES = @HDEFINES@ -INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INCINTL = @INCINTL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_LIBBFD_FALSE = @INSTALL_LIBBFD_FALSE@ INSTALL_LIBBFD_TRUE = @INSTALL_LIBBFD_TRUE@ @@ -116,10 +132,10 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ -INTLDEPS = @INTLDEPS@ -INTLLIBS = @INTLLIBS@ -INTLOBJS = @INTLOBJS@ +LD = @LD@ LDFLAGS = @LDFLAGS@ +LIBINTL = @LIBINTL@ +LIBINTL_DEP = @LIBINTL_DEP@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -131,6 +147,8 @@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ NO_WERROR = @NO_WERROR@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ @@ -140,14 +158,16 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -POFILES = @POFILES@ +PKGVERSION = @PKGVERSION@ POSUB = @POSUB@ RANLIB = @RANLIB@ +REPORT_BUGS_TEXI = @REPORT_BUGS_TEXI@ +REPORT_BUGS_TO = @REPORT_BUGS_TO@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TDEFINES = @TDEFINES@ -USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ @@ -156,6 +176,7 @@ WIN32LIBADD = @WIN32LIBADD@ XGETTEXT = @XGETTEXT@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_backends = @all_backends@ @@ -166,10 +187,10 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ +bfd64_libs = @bfd64_libs@ bfd_backends = @bfd_backends@ bfd_default_target_size = @bfd_default_target_size@ bfd_file_ptr = @bfd_file_ptr@ -bfd_libs = @bfd_libs@ bfd_machines = @bfd_machines@ bfd_ufile_ptr = @bfd_ufile_ptr@ bfdincludedir = @bfdincludedir@ @@ -194,10 +215,10 @@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ -l = @l@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -221,7 +242,8 @@ DOCFILES = aoutx.texi archive.texi archures.texi \ libbfd.texi bfdwin.texi bfdio.texi \ opncls.texi reloc.texi section.texi \ syms.texi targets.texi init.texi hash.texi linker.texi \ - mmo.texi + mmo.texi \ + bfdver.texi PROTOS = archive.p archures.p bfd.p \ core.p format.p \ @@ -263,6 +285,7 @@ SRCIPROT = $(srcdir)/../cache.c $(srcdir)/../libbfd.c \ TEXIDIR = $(srcdir)/../../texinfo/fsf info_TEXINFOS = bfd.texinfo +bfd_TEXINFOS = $(DOCFILES) bfdsumm.texi MKDOC = chew$(EXEEXT_FOR_BUILD) INCLUDES = -I.. -I$(srcdir)/.. -I$(srcdir)/../../include \ -I$(srcdir)/../../intl -I../../intl @@ -314,13 +337,14 @@ BFD_H_DEP = \ noinst_TEXINFOS = bfdint.texi MOSTLYCLEANFILES = $(MKDOC) *.o CLEANFILES = *.p *.ip -DISTCLEANFILES = bfd.?? bfd.??? bfd.h libbfd.h libcoff.h texput.log -MAINTAINERCLEANFILES = $(DOCFILES) +DISTCLEANFILES = bfd.?? bfd.??? bfd.h libbfd.h libcoff.h texput.log \ + $(am__append_1) +MAINTAINERCLEANFILES = $(DOCFILES) bfd.info html__strip_dir = `echo $$p | sed -e 's|^.*/||'`; all: all-am .SUFFIXES: -.SUFFIXES: .dvi .html .info .pdf .ps .texinfo +.SUFFIXES: .dvi .ps $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ @@ -330,9 +354,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --cygnus doc/Makefile'; \ cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign doc/Makefile + $(AUTOMAKE) --cygnus doc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ @@ -360,40 +384,38 @@ clean-libtool: distclean-libtool: -rm -f libtool -.texinfo.info: +bfd.info: bfd.texinfo $(bfd_TEXINFOS) restore=: && backupdir="$(am__leading_dot)am$$$$" && \ - am__cwd=`pwd` && cd $(srcdir) && \ rm -rf $$backupdir && mkdir $$backupdir && \ - for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ - if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \ - done; \ - cd "$$am__cwd"; \ + if ($(MAKEINFO) --version) >/dev/null 2>&1; then \ + for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ + if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \ + done; \ + else :; fi && \ if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ - -o $@ $<; \ + -o $@ `test -f 'bfd.texinfo' || echo '$(srcdir)/'`bfd.texinfo; \ then \ rc=0; \ - cd $(srcdir); \ else \ rc=$$?; \ - cd $(srcdir) && \ $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ fi; \ rm -rf $$backupdir; exit $$rc -.texinfo.dvi: +bfd.dvi: bfd.texinfo $(bfd_TEXINFOS) TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ - $(TEXI2DVI) $< + $(TEXI2DVI) -o $@ `test -f 'bfd.texinfo' || echo '$(srcdir)/'`bfd.texinfo -.texinfo.pdf: +bfd.pdf: bfd.texinfo $(bfd_TEXINFOS) TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ - $(TEXI2PDF) $< + $(TEXI2PDF) -o $@ `test -f 'bfd.texinfo' || echo '$(srcdir)/'`bfd.texinfo -.texinfo.html: +bfd.html: bfd.texinfo $(bfd_TEXINFOS) rm -rf $(@:.html=.htp) if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ - -o $(@:.html=.htp) $<; \ + -o $(@:.html=.htp) `test -f 'bfd.texinfo' || echo '$(srcdir)/'`bfd.texinfo; \ then \ rm -rf $@; \ if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ @@ -403,11 +425,8 @@ distclean-libtool: rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \ exit 1; \ fi -$(srcdir)/bfd.info: bfd.texinfo -bfd.dvi: bfd.texinfo -bfd.pdf: bfd.texinfo -bfd.html: bfd.texinfo .dvi.ps: + TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ $(DVIPS) -o $@ $< uninstall-info-am: @@ -600,8 +619,6 @@ chew.o: chew.c protos: libbfd.h libcoff.h bfd.h -$(srcdir)/bfd.info bfd.dvi bfd.html: $(DOCFILES) bfdsumm.texi bfd.texinfo - # We can't replace these rules with an implicit rule, because # makes without VPATH support couldn't find the .h files in `..'. @@ -762,6 +779,17 @@ bfd.h: $(BFD_H_DEP) echo "#endif" >> $@ echo "#endif" >> $@ +bfdver.texi: $(srcdir)/Makefile.in + @echo "creating $@"; \ + echo "@set VERSION $(VERSION)" > bfdver.texi; \ + if [ -n "$(PKGVERSION)" ]; then \ + echo "@set VERSION_PACKAGE $(PKGVERSION)" >> bfdver.texi; \ + fi; \ + echo "@set UPDATED `date '+%B %Y'`" >> bfdver.texi; \ + if [ -n "$(REPORT_BUGS_TEXI)" ]; then \ + echo "@set BUGURL $(REPORT_BUGS_TEXI)" >> bfdver.texi; \ + fi + # We want install to imply install-info as per GNU standards, despite the # cygnus option. install: install-info diff --git a/contrib/binutils/bfd/doc/aoutx.texi b/contrib/binutils/bfd/doc/aoutx.texi deleted file mode 100644 index 7cf9787f106f..000000000000 --- a/contrib/binutils/bfd/doc/aoutx.texi +++ /dev/null @@ -1,213 +0,0 @@ -@section a.out backends - - -@strong{Description}@* -BFD supports a number of different flavours of a.out format, -though the major differences are only the sizes of the -structures on disk, and the shape of the relocation -information. - -The support is split into a basic support file @file{aoutx.h} -and other files which derive functions from the base. One -derivation file is @file{aoutf1.h} (for a.out flavour 1), and -adds to the basic a.out functions support for sun3, sun4, 386 -and 29k a.out files, to create a target jump vector for a -specific target. - -This information is further split out into more specific files -for each machine, including @file{sunos.c} for sun3 and sun4, -@file{newsos3.c} for the Sony NEWS, and @file{demo64.c} for a -demonstration of a 64 bit a.out format. - -The base file @file{aoutx.h} defines general mechanisms for -reading and writing records to and from disk and various -other methods which BFD requires. It is included by -@file{aout32.c} and @file{aout64.c} to form the names -@code{aout_32_swap_exec_header_in}, @code{aout_64_swap_exec_header_in}, etc. - -As an example, this is what goes on to make the back end for a -sun4, from @file{aout32.c}: - -@example - #define ARCH_SIZE 32 - #include "aoutx.h" -@end example - -Which exports names: - -@example - ... - aout_32_canonicalize_reloc - aout_32_find_nearest_line - aout_32_get_lineno - aout_32_get_reloc_upper_bound - ... -@end example - -from @file{sunos.c}: - -@example - #define TARGET_NAME "a.out-sunos-big" - #define VECNAME sunos_big_vec - #include "aoutf1.h" -@end example - -requires all the names from @file{aout32.c}, and produces the jump vector - -@example - sunos_big_vec -@end example - -The file @file{host-aout.c} is a special case. It is for a large set -of hosts that use ``more or less standard'' a.out files, and -for which cross-debugging is not interesting. It uses the -standard 32-bit a.out support routines, but determines the -file offsets and addresses of the text, data, and BSS -sections, the machine architecture and machine type, and the -entry point address, in a host-dependent manner. Once these -values have been determined, generic code is used to handle -the object file. - -When porting it to run on a new system, you must supply: - -@example - HOST_PAGE_SIZE - HOST_SEGMENT_SIZE - HOST_MACHINE_ARCH (optional) - HOST_MACHINE_MACHINE (optional) - HOST_TEXT_START_ADDR - HOST_STACK_END_ADDR -@end example - -in the file @file{../include/sys/h-@var{XXX}.h} (for your host). These -values, plus the structures and macros defined in @file{a.out.h} on -your host system, will produce a BFD target that will access -ordinary a.out files on your host. To configure a new machine -to use @file{host-aout.c}, specify: - -@example - TDEFAULTS = -DDEFAULT_VECTOR=host_aout_big_vec - TDEPFILES= host-aout.o trad-core.o -@end example - -in the @file{config/@var{XXX}.mt} file, and modify @file{configure.in} -to use the -@file{@var{XXX}.mt} file (by setting "@code{bfd_target=XXX}") when your -configuration is selected. - -@subsection Relocations - - -@strong{Description}@* -The file @file{aoutx.h} provides for both the @emph{standard} -and @emph{extended} forms of a.out relocation records. - -The standard records contain only an -address, a symbol index, and a type field. The extended records -(used on 29ks and sparcs) also have a full integer for an -addend. - -@subsection Internal entry points - - -@strong{Description}@* -@file{aoutx.h} exports several routines for accessing the -contents of an a.out file, which are gathered and exported in -turn by various format specific files (eg sunos.c). - -@findex aout_@var{size}_swap_exec_header_in -@subsubsection @code{aout_@var{size}_swap_exec_header_in} -@strong{Synopsis} -@example -void aout_@var{size}_swap_exec_header_in, - (bfd *abfd, - struct external_exec *bytes, - struct internal_exec *execp); -@end example -@strong{Description}@* -Swap the information in an executable header @var{raw_bytes} taken -from a raw byte stream memory image into the internal exec header -structure @var{execp}. - -@findex aout_@var{size}_swap_exec_header_out -@subsubsection @code{aout_@var{size}_swap_exec_header_out} -@strong{Synopsis} -@example -void aout_@var{size}_swap_exec_header_out - (bfd *abfd, - struct internal_exec *execp, - struct external_exec *raw_bytes); -@end example -@strong{Description}@* -Swap the information in an internal exec header structure -@var{execp} into the buffer @var{raw_bytes} ready for writing to disk. - -@findex aout_@var{size}_some_aout_object_p -@subsubsection @code{aout_@var{size}_some_aout_object_p} -@strong{Synopsis} -@example -const bfd_target *aout_@var{size}_some_aout_object_p - (bfd *abfd, - struct internal_exec *execp, - const bfd_target *(*callback_to_real_object_p) (bfd *)); -@end example -@strong{Description}@* -Some a.out variant thinks that the file open in @var{abfd} -checking is an a.out file. Do some more checking, and set up -for access if it really is. Call back to the calling -environment's "finish up" function just before returning, to -handle any last-minute setup. - -@findex aout_@var{size}_mkobject -@subsubsection @code{aout_@var{size}_mkobject} -@strong{Synopsis} -@example -bfd_boolean aout_@var{size}_mkobject, (bfd *abfd); -@end example -@strong{Description}@* -Initialize BFD @var{abfd} for use with a.out files. - -@findex aout_@var{size}_machine_type -@subsubsection @code{aout_@var{size}_machine_type} -@strong{Synopsis} -@example -enum machine_type aout_@var{size}_machine_type - (enum bfd_architecture arch, - unsigned long machine, - bfd_boolean *unknown); -@end example -@strong{Description}@* -Keep track of machine architecture and machine type for -a.out's. Return the @code{machine_type} for a particular -architecture and machine, or @code{M_UNKNOWN} if that exact architecture -and machine can't be represented in a.out format. - -If the architecture is understood, machine type 0 (default) -is always understood. - -@findex aout_@var{size}_set_arch_mach -@subsubsection @code{aout_@var{size}_set_arch_mach} -@strong{Synopsis} -@example -bfd_boolean aout_@var{size}_set_arch_mach, - (bfd *, - enum bfd_architecture arch, - unsigned long machine); -@end example -@strong{Description}@* -Set the architecture and the machine of the BFD @var{abfd} to the -values @var{arch} and @var{machine}. Verify that @var{abfd}'s format -can support the architecture required. - -@findex aout_@var{size}_new_section_hook -@subsubsection @code{aout_@var{size}_new_section_hook} -@strong{Synopsis} -@example -bfd_boolean aout_@var{size}_new_section_hook, - (bfd *abfd, - asection *newsect); -@end example -@strong{Description}@* -Called by the BFD in response to a @code{bfd_make_section} -request. - diff --git a/contrib/binutils/bfd/doc/archive.texi b/contrib/binutils/bfd/doc/archive.texi deleted file mode 100644 index 3d0a97d4b82e..000000000000 --- a/contrib/binutils/bfd/doc/archive.texi +++ /dev/null @@ -1,99 +0,0 @@ -@section Archives - - -@strong{Description}@* -An archive (or library) is just another BFD. It has a symbol -table, although there's not much a user program will do with it. - -The big difference between an archive BFD and an ordinary BFD -is that the archive doesn't have sections. Instead it has a -chain of BFDs that are considered its contents. These BFDs can -be manipulated like any other. The BFDs contained in an -archive opened for reading will all be opened for reading. You -may put either input or output BFDs into an archive opened for -output; they will be handled correctly when the archive is closed. - -Use @code{bfd_openr_next_archived_file} to step through -the contents of an archive opened for input. You don't -have to read the entire archive if you don't want -to! Read it until you find what you want. - -Archive contents of output BFDs are chained through the -@code{next} pointer in a BFD. The first one is findable through -the @code{archive_head} slot of the archive. Set it with -@code{bfd_set_archive_head} (q.v.). A given BFD may be in only one -open output archive at a time. - -As expected, the BFD archive code is more general than the -archive code of any given environment. BFD archives may -contain files of different formats (e.g., a.out and coff) and -even different architectures. You may even place archives -recursively into archives! - -This can cause unexpected confusion, since some archive -formats are more expressive than others. For instance, Intel -COFF archives can preserve long filenames; SunOS a.out archives -cannot. If you move a file from the first to the second -format and back again, the filename may be truncated. -Likewise, different a.out environments have different -conventions as to how they truncate filenames, whether they -preserve directory names in filenames, etc. When -interoperating with native tools, be sure your files are -homogeneous. - -Beware: most of these formats do not react well to the -presence of spaces in filenames. We do the best we can, but -can't always handle this case due to restrictions in the format of -archives. Many Unix utilities are braindead in regards to -spaces and such in filenames anyway, so this shouldn't be much -of a restriction. - -Archives are supported in BFD in @code{archive.c}. - -@subsection Archive functions - - -@findex bfd_get_next_mapent -@subsubsection @code{bfd_get_next_mapent} -@strong{Synopsis} -@example -symindex bfd_get_next_mapent - (bfd *abfd, symindex previous, carsym **sym); -@end example -@strong{Description}@* -Step through archive @var{abfd}'s symbol table (if it -has one). Successively update @var{sym} with the next symbol's -information, returning that symbol's (internal) index into the -symbol table. - -Supply @code{BFD_NO_MORE_SYMBOLS} as the @var{previous} entry to get -the first one; returns @code{BFD_NO_MORE_SYMBOLS} when you've already -got the last one. - -A @code{carsym} is a canonical archive symbol. The only -user-visible element is its name, a null-terminated string. - -@findex bfd_set_archive_head -@subsubsection @code{bfd_set_archive_head} -@strong{Synopsis} -@example -bfd_boolean bfd_set_archive_head (bfd *output, bfd *new_head); -@end example -@strong{Description}@* -Set the head of the chain of -BFDs contained in the archive @var{output} to @var{new_head}. - -@findex bfd_openr_next_archived_file -@subsubsection @code{bfd_openr_next_archived_file} -@strong{Synopsis} -@example -bfd *bfd_openr_next_archived_file (bfd *archive, bfd *previous); -@end example -@strong{Description}@* -Provided a BFD, @var{archive}, containing an archive and NULL, open -an input BFD on the first contained element and returns that. -Subsequent calls should pass -the archive and the previous return value to return a created -BFD to the next contained element. NULL is returned when there -are no more. - diff --git a/contrib/binutils/bfd/doc/archures.texi b/contrib/binutils/bfd/doc/archures.texi deleted file mode 100644 index bf72179dad31..000000000000 --- a/contrib/binutils/bfd/doc/archures.texi +++ /dev/null @@ -1,585 +0,0 @@ -@section Architectures -BFD keeps one atom in a BFD describing the -architecture of the data attached to the BFD: a pointer to a -@code{bfd_arch_info_type}. - -Pointers to structures can be requested independently of a BFD -so that an architecture's information can be interrogated -without access to an open BFD. - -The architecture information is provided by each architecture package. -The set of default architectures is selected by the macro -@code{SELECT_ARCHITECTURES}. This is normally set up in the -@file{config/@var{target}.mt} file of your choice. If the name is not -defined, then all the architectures supported are included. - -When BFD starts up, all the architectures are called with an -initialize method. It is up to the architecture back end to -insert as many items into the list of architectures as it wants to; -generally this would be one for each machine and one for the -default case (an item with a machine field of 0). - -BFD's idea of an architecture is implemented in @file{archures.c}. - -@subsection bfd_architecture - - -@strong{Description}@* -This enum gives the object file's CPU architecture, in a -global sense---i.e., what processor family does it belong to? -Another field indicates which processor within -the family is in use. The machine gives a number which -distinguishes different versions of the architecture, -containing, for example, 2 and 3 for Intel i960 KA and i960 KB, -and 68020 and 68030 for Motorola 68020 and 68030. -@example -enum bfd_architecture -@{ - bfd_arch_unknown, /* File arch not known. */ - bfd_arch_obscure, /* Arch known, not one of these. */ - bfd_arch_m68k, /* Motorola 68xxx */ -#define bfd_mach_m68000 1 -#define bfd_mach_m68008 2 -#define bfd_mach_m68010 3 -#define bfd_mach_m68020 4 -#define bfd_mach_m68030 5 -#define bfd_mach_m68040 6 -#define bfd_mach_m68060 7 -#define bfd_mach_cpu32 8 -#define bfd_mach_mcf_isa_a_nodiv 9 -#define bfd_mach_mcf_isa_a 10 -#define bfd_mach_mcf_isa_a_mac 11 -#define bfd_mach_mcf_isa_a_emac 12 -#define bfd_mach_mcf_isa_aplus 13 -#define bfd_mach_mcf_isa_aplus_mac 14 -#define bfd_mach_mcf_isa_aplus_emac 15 -#define bfd_mach_mcf_isa_b_nousp 16 -#define bfd_mach_mcf_isa_b_nousp_mac 17 -#define bfd_mach_mcf_isa_b_nousp_emac 18 -#define bfd_mach_mcf_isa_b 19 -#define bfd_mach_mcf_isa_b_mac 20 -#define bfd_mach_mcf_isa_b_emac 21 -#define bfd_mach_mcf_isa_b_float 22 -#define bfd_mach_mcf_isa_b_float_mac 23 -#define bfd_mach_mcf_isa_b_float_emac 24 - bfd_arch_vax, /* DEC Vax */ - bfd_arch_i960, /* Intel 960 */ - /* The order of the following is important. - lower number indicates a machine type that - only accepts a subset of the instructions - available to machines with higher numbers. - The exception is the "ca", which is - incompatible with all other machines except - "core". */ - -#define bfd_mach_i960_core 1 -#define bfd_mach_i960_ka_sa 2 -#define bfd_mach_i960_kb_sb 3 -#define bfd_mach_i960_mc 4 -#define bfd_mach_i960_xa 5 -#define bfd_mach_i960_ca 6 -#define bfd_mach_i960_jx 7 -#define bfd_mach_i960_hx 8 - - bfd_arch_or32, /* OpenRISC 32 */ - - bfd_arch_sparc, /* SPARC */ -#define bfd_mach_sparc 1 -/* The difference between v8plus and v9 is that v9 is a true 64 bit env. */ -#define bfd_mach_sparc_sparclet 2 -#define bfd_mach_sparc_sparclite 3 -#define bfd_mach_sparc_v8plus 4 -#define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns. */ -#define bfd_mach_sparc_sparclite_le 6 -#define bfd_mach_sparc_v9 7 -#define bfd_mach_sparc_v9a 8 /* with ultrasparc add'ns. */ -#define bfd_mach_sparc_v8plusb 9 /* with cheetah add'ns. */ -#define bfd_mach_sparc_v9b 10 /* with cheetah add'ns. */ -/* Nonzero if MACH has the v9 instruction set. */ -#define bfd_mach_sparc_v9_p(mach) \ - ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \ - && (mach) != bfd_mach_sparc_sparclite_le) -/* Nonzero if MACH is a 64 bit sparc architecture. */ -#define bfd_mach_sparc_64bit_p(mach) \ - ((mach) >= bfd_mach_sparc_v9 && (mach) != bfd_mach_sparc_v8plusb) - bfd_arch_mips, /* MIPS Rxxxx */ -#define bfd_mach_mips3000 3000 -#define bfd_mach_mips3900 3900 -#define bfd_mach_mips4000 4000 -#define bfd_mach_mips4010 4010 -#define bfd_mach_mips4100 4100 -#define bfd_mach_mips4111 4111 -#define bfd_mach_mips4120 4120 -#define bfd_mach_mips4300 4300 -#define bfd_mach_mips4400 4400 -#define bfd_mach_mips4600 4600 -#define bfd_mach_mips4650 4650 -#define bfd_mach_mips5000 5000 -#define bfd_mach_mips5400 5400 -#define bfd_mach_mips5500 5500 -#define bfd_mach_mips6000 6000 -#define bfd_mach_mips7000 7000 -#define bfd_mach_mips8000 8000 -#define bfd_mach_mips9000 9000 -#define bfd_mach_mips10000 10000 -#define bfd_mach_mips12000 12000 -#define bfd_mach_mips16 16 -#define bfd_mach_mips5 5 -#define bfd_mach_mips_sb1 12310201 /* octal 'SB', 01 */ -#define bfd_mach_mipsisa32 32 -#define bfd_mach_mipsisa32r2 33 -#define bfd_mach_mipsisa64 64 -#define bfd_mach_mipsisa64r2 65 - bfd_arch_i386, /* Intel 386 */ -#define bfd_mach_i386_i386 1 -#define bfd_mach_i386_i8086 2 -#define bfd_mach_i386_i386_intel_syntax 3 -#define bfd_mach_x86_64 64 -#define bfd_mach_x86_64_intel_syntax 65 - bfd_arch_we32k, /* AT&T WE32xxx */ - bfd_arch_tahoe, /* CCI/Harris Tahoe */ - bfd_arch_i860, /* Intel 860 */ - bfd_arch_i370, /* IBM 360/370 Mainframes */ - bfd_arch_romp, /* IBM ROMP PC/RT */ - bfd_arch_convex, /* Convex */ - bfd_arch_m88k, /* Motorola 88xxx */ - bfd_arch_m98k, /* Motorola 98xxx */ - bfd_arch_pyramid, /* Pyramid Technology */ - bfd_arch_h8300, /* Renesas H8/300 (formerly Hitachi H8/300) */ -#define bfd_mach_h8300 1 -#define bfd_mach_h8300h 2 -#define bfd_mach_h8300s 3 -#define bfd_mach_h8300hn 4 -#define bfd_mach_h8300sn 5 -#define bfd_mach_h8300sx 6 -#define bfd_mach_h8300sxn 7 - bfd_arch_pdp11, /* DEC PDP-11 */ - bfd_arch_powerpc, /* PowerPC */ -#define bfd_mach_ppc 32 -#define bfd_mach_ppc64 64 -#define bfd_mach_ppc_403 403 -#define bfd_mach_ppc_403gc 4030 -#define bfd_mach_ppc_505 505 -#define bfd_mach_ppc_601 601 -#define bfd_mach_ppc_602 602 -#define bfd_mach_ppc_603 603 -#define bfd_mach_ppc_ec603e 6031 -#define bfd_mach_ppc_604 604 -#define bfd_mach_ppc_620 620 -#define bfd_mach_ppc_630 630 -#define bfd_mach_ppc_750 750 -#define bfd_mach_ppc_860 860 -#define bfd_mach_ppc_a35 35 -#define bfd_mach_ppc_rs64ii 642 -#define bfd_mach_ppc_rs64iii 643 -#define bfd_mach_ppc_7400 7400 -#define bfd_mach_ppc_e500 500 - bfd_arch_rs6000, /* IBM RS/6000 */ -#define bfd_mach_rs6k 6000 -#define bfd_mach_rs6k_rs1 6001 -#define bfd_mach_rs6k_rsc 6003 -#define bfd_mach_rs6k_rs2 6002 - bfd_arch_hppa, /* HP PA RISC */ -#define bfd_mach_hppa10 10 -#define bfd_mach_hppa11 11 -#define bfd_mach_hppa20 20 -#define bfd_mach_hppa20w 25 - bfd_arch_d10v, /* Mitsubishi D10V */ -#define bfd_mach_d10v 1 -#define bfd_mach_d10v_ts2 2 -#define bfd_mach_d10v_ts3 3 - bfd_arch_d30v, /* Mitsubishi D30V */ - bfd_arch_dlx, /* DLX */ - bfd_arch_m68hc11, /* Motorola 68HC11 */ - bfd_arch_m68hc12, /* Motorola 68HC12 */ -#define bfd_mach_m6812_default 0 -#define bfd_mach_m6812 1 -#define bfd_mach_m6812s 2 - bfd_arch_z8k, /* Zilog Z8000 */ -#define bfd_mach_z8001 1 -#define bfd_mach_z8002 2 - bfd_arch_h8500, /* Renesas H8/500 (formerly Hitachi H8/500) */ - bfd_arch_sh, /* Renesas / SuperH SH (formerly Hitachi SH) */ -#define bfd_mach_sh 1 -#define bfd_mach_sh2 0x20 -#define bfd_mach_sh_dsp 0x2d -#define bfd_mach_sh2a 0x2a -#define bfd_mach_sh2a_nofpu 0x2b -#define bfd_mach_sh2a_nofpu_or_sh4_nommu_nofpu 0x2a1 -#define bfd_mach_sh2a_nofpu_or_sh3_nommu 0x2a2 -#define bfd_mach_sh2a_or_sh4 0x2a3 -#define bfd_mach_sh2a_or_sh3e 0x2a4 -#define bfd_mach_sh2e 0x2e -#define bfd_mach_sh3 0x30 -#define bfd_mach_sh3_nommu 0x31 -#define bfd_mach_sh3_dsp 0x3d -#define bfd_mach_sh3e 0x3e -#define bfd_mach_sh4 0x40 -#define bfd_mach_sh4_nofpu 0x41 -#define bfd_mach_sh4_nommu_nofpu 0x42 -#define bfd_mach_sh4a 0x4a -#define bfd_mach_sh4a_nofpu 0x4b -#define bfd_mach_sh4al_dsp 0x4d -#define bfd_mach_sh5 0x50 - bfd_arch_alpha, /* Dec Alpha */ -#define bfd_mach_alpha_ev4 0x10 -#define bfd_mach_alpha_ev5 0x20 -#define bfd_mach_alpha_ev6 0x30 - bfd_arch_arm, /* Advanced Risc Machines ARM. */ -#define bfd_mach_arm_unknown 0 -#define bfd_mach_arm_2 1 -#define bfd_mach_arm_2a 2 -#define bfd_mach_arm_3 3 -#define bfd_mach_arm_3M 4 -#define bfd_mach_arm_4 5 -#define bfd_mach_arm_4T 6 -#define bfd_mach_arm_5 7 -#define bfd_mach_arm_5T 8 -#define bfd_mach_arm_5TE 9 -#define bfd_mach_arm_XScale 10 -#define bfd_mach_arm_ep9312 11 -#define bfd_mach_arm_iWMMXt 12 - bfd_arch_ns32k, /* National Semiconductors ns32000 */ - bfd_arch_w65, /* WDC 65816 */ - bfd_arch_tic30, /* Texas Instruments TMS320C30 */ - bfd_arch_tic4x, /* Texas Instruments TMS320C3X/4X */ -#define bfd_mach_tic3x 30 -#define bfd_mach_tic4x 40 - bfd_arch_tic54x, /* Texas Instruments TMS320C54X */ - bfd_arch_tic80, /* TI TMS320c80 (MVP) */ - bfd_arch_v850, /* NEC V850 */ -#define bfd_mach_v850 1 -#define bfd_mach_v850e 'E' -#define bfd_mach_v850e1 '1' - bfd_arch_arc, /* ARC Cores */ -#define bfd_mach_arc_5 5 -#define bfd_mach_arc_6 6 -#define bfd_mach_arc_7 7 -#define bfd_mach_arc_8 8 - bfd_arch_m32c, /* Renesas M16C/M32C. */ -#define bfd_mach_m16c 0x75 -#define bfd_mach_m32c 0x78 - bfd_arch_m32r, /* Renesas M32R (formerly Mitsubishi M32R/D) */ -#define bfd_mach_m32r 1 /* For backwards compatibility. */ -#define bfd_mach_m32rx 'x' -#define bfd_mach_m32r2 '2' - bfd_arch_mn10200, /* Matsushita MN10200 */ - bfd_arch_mn10300, /* Matsushita MN10300 */ -#define bfd_mach_mn10300 300 -#define bfd_mach_am33 330 -#define bfd_mach_am33_2 332 - bfd_arch_fr30, -#define bfd_mach_fr30 0x46523330 - bfd_arch_frv, -#define bfd_mach_frv 1 -#define bfd_mach_frvsimple 2 -#define bfd_mach_fr300 300 -#define bfd_mach_fr400 400 -#define bfd_mach_fr450 450 -#define bfd_mach_frvtomcat 499 /* fr500 prototype */ -#define bfd_mach_fr500 500 -#define bfd_mach_fr550 550 - bfd_arch_mcore, - bfd_arch_ia64, /* HP/Intel ia64 */ -#define bfd_mach_ia64_elf64 64 -#define bfd_mach_ia64_elf32 32 - bfd_arch_ip2k, /* Ubicom IP2K microcontrollers. */ -#define bfd_mach_ip2022 1 -#define bfd_mach_ip2022ext 2 - bfd_arch_iq2000, /* Vitesse IQ2000. */ -#define bfd_mach_iq2000 1 -#define bfd_mach_iq10 2 - bfd_arch_mt, -#define bfd_mach_ms1 1 -#define bfd_mach_mrisc2 2 -#define bfd_mach_ms2 3 - bfd_arch_pj, - bfd_arch_avr, /* Atmel AVR microcontrollers. */ -#define bfd_mach_avr1 1 -#define bfd_mach_avr2 2 -#define bfd_mach_avr3 3 -#define bfd_mach_avr4 4 -#define bfd_mach_avr5 5 - bfd_arch_bfin, /* ADI Blackfin */ -#define bfd_mach_bfin 1 - bfd_arch_cr16c, /* National Semiconductor CompactRISC. */ -#define bfd_mach_cr16c 1 - bfd_arch_crx, /* National Semiconductor CRX. */ -#define bfd_mach_crx 1 - bfd_arch_cris, /* Axis CRIS */ -#define bfd_mach_cris_v0_v10 255 -#define bfd_mach_cris_v32 32 -#define bfd_mach_cris_v10_v32 1032 - bfd_arch_s390, /* IBM s390 */ -#define bfd_mach_s390_31 31 -#define bfd_mach_s390_64 64 - bfd_arch_openrisc, /* OpenRISC */ - bfd_arch_mmix, /* Donald Knuth's educational processor. */ - bfd_arch_xstormy16, -#define bfd_mach_xstormy16 1 - bfd_arch_msp430, /* Texas Instruments MSP430 architecture. */ -#define bfd_mach_msp11 11 -#define bfd_mach_msp110 110 -#define bfd_mach_msp12 12 -#define bfd_mach_msp13 13 -#define bfd_mach_msp14 14 -#define bfd_mach_msp15 15 -#define bfd_mach_msp16 16 -#define bfd_mach_msp21 21 -#define bfd_mach_msp31 31 -#define bfd_mach_msp32 32 -#define bfd_mach_msp33 33 -#define bfd_mach_msp41 41 -#define bfd_mach_msp42 42 -#define bfd_mach_msp43 43 -#define bfd_mach_msp44 44 - bfd_arch_xc16x, /* Infineon's XC16X Series. */ -#define bfd_mach_xc16x 1 -#define bfd_mach_xc16xl 2 -#define bfd_mach_xc16xs 3 - bfd_arch_xtensa, /* Tensilica's Xtensa cores. */ -#define bfd_mach_xtensa 1 - bfd_arch_maxq, /* Dallas MAXQ 10/20 */ -#define bfd_mach_maxq10 10 -#define bfd_mach_maxq20 20 - bfd_arch_z80, -#define bfd_mach_z80strict 1 /* No undocumented opcodes. */ -#define bfd_mach_z80 3 /* With ixl, ixh, iyl, and iyh. */ -#define bfd_mach_z80full 7 /* All undocumented instructions. */ -#define bfd_mach_r800 11 /* R800: successor with multiplication. */ - bfd_arch_last - @}; -@end example - -@subsection bfd_arch_info - - -@strong{Description}@* -This structure contains information on architectures for use -within BFD. -@example - -typedef struct bfd_arch_info -@{ - int bits_per_word; - int bits_per_address; - int bits_per_byte; - enum bfd_architecture arch; - unsigned long mach; - const char *arch_name; - const char *printable_name; - unsigned int section_align_power; - /* TRUE if this is the default machine for the architecture. - The default arch should be the first entry for an arch so that - all the entries for that arch can be accessed via @code{next}. */ - bfd_boolean the_default; - const struct bfd_arch_info * (*compatible) - (const struct bfd_arch_info *a, const struct bfd_arch_info *b); - - bfd_boolean (*scan) (const struct bfd_arch_info *, const char *); - - const struct bfd_arch_info *next; -@} -bfd_arch_info_type; - -@end example - -@findex bfd_printable_name -@subsubsection @code{bfd_printable_name} -@strong{Synopsis} -@example -const char *bfd_printable_name (bfd *abfd); -@end example -@strong{Description}@* -Return a printable string representing the architecture and machine -from the pointer to the architecture info structure. - -@findex bfd_scan_arch -@subsubsection @code{bfd_scan_arch} -@strong{Synopsis} -@example -const bfd_arch_info_type *bfd_scan_arch (const char *string); -@end example -@strong{Description}@* -Figure out if BFD supports any cpu which could be described with -the name @var{string}. Return a pointer to an @code{arch_info} -structure if a machine is found, otherwise NULL. - -@findex bfd_arch_list -@subsubsection @code{bfd_arch_list} -@strong{Synopsis} -@example -const char **bfd_arch_list (void); -@end example -@strong{Description}@* -Return a freshly malloced NULL-terminated vector of the names -of all the valid BFD architectures. Do not modify the names. - -@findex bfd_arch_get_compatible -@subsubsection @code{bfd_arch_get_compatible} -@strong{Synopsis} -@example -const bfd_arch_info_type *bfd_arch_get_compatible - (const bfd *abfd, const bfd *bbfd, bfd_boolean accept_unknowns); -@end example -@strong{Description}@* -Determine whether two BFDs' architectures and machine types -are compatible. Calculates the lowest common denominator -between the two architectures and machine types implied by -the BFDs and returns a pointer to an @code{arch_info} structure -describing the compatible machine. - -@findex bfd_default_arch_struct -@subsubsection @code{bfd_default_arch_struct} -@strong{Description}@* -The @code{bfd_default_arch_struct} is an item of -@code{bfd_arch_info_type} which has been initialized to a fairly -generic state. A BFD starts life by pointing to this -structure, until the correct back end has determined the real -architecture of the file. -@example -extern const bfd_arch_info_type bfd_default_arch_struct; -@end example - -@findex bfd_set_arch_info -@subsubsection @code{bfd_set_arch_info} -@strong{Synopsis} -@example -void bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg); -@end example -@strong{Description}@* -Set the architecture info of @var{abfd} to @var{arg}. - -@findex bfd_default_set_arch_mach -@subsubsection @code{bfd_default_set_arch_mach} -@strong{Synopsis} -@example -bfd_boolean bfd_default_set_arch_mach - (bfd *abfd, enum bfd_architecture arch, unsigned long mach); -@end example -@strong{Description}@* -Set the architecture and machine type in BFD @var{abfd} -to @var{arch} and @var{mach}. Find the correct -pointer to a structure and insert it into the @code{arch_info} -pointer. - -@findex bfd_get_arch -@subsubsection @code{bfd_get_arch} -@strong{Synopsis} -@example -enum bfd_architecture bfd_get_arch (bfd *abfd); -@end example -@strong{Description}@* -Return the enumerated type which describes the BFD @var{abfd}'s -architecture. - -@findex bfd_get_mach -@subsubsection @code{bfd_get_mach} -@strong{Synopsis} -@example -unsigned long bfd_get_mach (bfd *abfd); -@end example -@strong{Description}@* -Return the long type which describes the BFD @var{abfd}'s -machine. - -@findex bfd_arch_bits_per_byte -@subsubsection @code{bfd_arch_bits_per_byte} -@strong{Synopsis} -@example -unsigned int bfd_arch_bits_per_byte (bfd *abfd); -@end example -@strong{Description}@* -Return the number of bits in one of the BFD @var{abfd}'s -architecture's bytes. - -@findex bfd_arch_bits_per_address -@subsubsection @code{bfd_arch_bits_per_address} -@strong{Synopsis} -@example -unsigned int bfd_arch_bits_per_address (bfd *abfd); -@end example -@strong{Description}@* -Return the number of bits in one of the BFD @var{abfd}'s -architecture's addresses. - -@findex bfd_default_compatible -@subsubsection @code{bfd_default_compatible} -@strong{Synopsis} -@example -const bfd_arch_info_type *bfd_default_compatible - (const bfd_arch_info_type *a, const bfd_arch_info_type *b); -@end example -@strong{Description}@* -The default function for testing for compatibility. - -@findex bfd_default_scan -@subsubsection @code{bfd_default_scan} -@strong{Synopsis} -@example -bfd_boolean bfd_default_scan - (const struct bfd_arch_info *info, const char *string); -@end example -@strong{Description}@* -The default function for working out whether this is an -architecture hit and a machine hit. - -@findex bfd_get_arch_info -@subsubsection @code{bfd_get_arch_info} -@strong{Synopsis} -@example -const bfd_arch_info_type *bfd_get_arch_info (bfd *abfd); -@end example -@strong{Description}@* -Return the architecture info struct in @var{abfd}. - -@findex bfd_lookup_arch -@subsubsection @code{bfd_lookup_arch} -@strong{Synopsis} -@example -const bfd_arch_info_type *bfd_lookup_arch - (enum bfd_architecture arch, unsigned long machine); -@end example -@strong{Description}@* -Look for the architecture info structure which matches the -arguments @var{arch} and @var{machine}. A machine of 0 matches the -machine/architecture structure which marks itself as the -default. - -@findex bfd_printable_arch_mach -@subsubsection @code{bfd_printable_arch_mach} -@strong{Synopsis} -@example -const char *bfd_printable_arch_mach - (enum bfd_architecture arch, unsigned long machine); -@end example -@strong{Description}@* -Return a printable string representing the architecture and -machine type. - -This routine is depreciated. - -@findex bfd_octets_per_byte -@subsubsection @code{bfd_octets_per_byte} -@strong{Synopsis} -@example -unsigned int bfd_octets_per_byte (bfd *abfd); -@end example -@strong{Description}@* -Return the number of octets (8-bit quantities) per target byte -(minimum addressable unit). In most cases, this will be one, but some -DSP targets have 16, 32, or even 48 bits per byte. - -@findex bfd_arch_mach_octets_per_byte -@subsubsection @code{bfd_arch_mach_octets_per_byte} -@strong{Synopsis} -@example -unsigned int bfd_arch_mach_octets_per_byte - (enum bfd_architecture arch, unsigned long machine); -@end example -@strong{Description}@* -See bfd_octets_per_byte. - -This routine is provided for those cases where a bfd * is not -available - diff --git a/contrib/binutils/bfd/doc/bfd.texinfo b/contrib/binutils/bfd/doc/bfd.texinfo index 432e05264491..04b4266e651f 100644 --- a/contrib/binutils/bfd/doc/bfd.texinfo +++ b/contrib/binutils/bfd/doc/bfd.texinfo @@ -1,7 +1,7 @@ \input texinfo.tex @setfilename bfd.info @c Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1997, 2000, -@c 2001, 2002, 2003 +@c 2001, 2002, 2003, 2006, 2007 @c Free Software Foundation, Inc. @c @synindex fn cp @@ -14,26 +14,29 @@ END-INFO-DIR-ENTRY @end format @end ifinfo -@ifinfo +@copying This file documents the BFD library. -Copyright (C) 1991, 2000, 2001, 2003 Free Software Foundation, Inc. +Copyright @copyright{} 1991, 2000, 2001, 2003, 2006, 2007 Free Software Foundation, Inc. - Permission is granted to copy, distribute and/or modify this document - under the terms of the GNU Free Documentation License, Version 1.1 - or any later version published by the Free Software Foundation; - with no Invariant Sections, with no Front-Cover Texts, and with no - Back-Cover Texts. A copy of the license is included in the - section entitled ``GNU Free Documentation License''. +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 or +any later version published by the Free Software Foundation; with the +Invariant Sections being ``GNU General Public License'' and ``Funding +Free Software'', the Front-Cover texts being (a) (see below), and with +the Back-Cover Texts being (b) (see below). A copy of the license is +included in the section entitled ``GNU Free Documentation License''. -@ignore -Permission is granted to process this file through Tex and print the -results, provided the printed document carries copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). +(a) The FSF's Front-Cover Text is: -@end ignore -@end ifinfo + A GNU Manual + +(b) The FSF's Back-Cover Text is: + + You have freedom to copy and modify this GNU Manual, like GNU + software. Copies published by the Free Software Foundation raise + funds for GNU development. +@end copying @iftex @c@finalout @setchapternewpage on @@ -43,7 +46,7 @@ notice identical to this one except for the removal of this paragraph @title{libbfd} @subtitle{The Binary File Descriptor Library} @sp 1 -@subtitle First Edition---BFD version < 3.0 % Since no product is stable berfore version 3.0 :-) +@subtitle First Edition---BFD version < 3.0 % Since no product is stable before version 3.0 :-) @subtitle Original Document Created: April 1991 @author {Steve Chamberlain} @author {Cygnus Support} @@ -62,7 +65,7 @@ notice identical to this one except for the removal of this paragraph @end tex @vskip 0pt plus 1filll -Copyright @copyright{} 1991, 2001, 2003 Free Software Foundation, Inc. +Copyright @copyright{} 1991, 2001, 2003, 2006 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 @@ -73,6 +76,7 @@ Copyright @copyright{} 1991, 2001, 2003 Free Software Foundation, Inc. @end titlepage @end iftex +@contents @node Top, Overview, (dir), (dir) @ifinfo @@ -84,7 +88,7 @@ This file documents the binary file descriptor library libbfd. * BFD front end:: BFD front end * BFD back ends:: BFD back ends * GNU Free Documentation License:: GNU Free Documentation License -* Index:: Index +* BFD Index:: BFD Index @end menu @node Overview, BFD front end, Top, Top @@ -144,7 +148,7 @@ To use the library, include @file{bfd.h} and link with @file{libbfd.a}. BFD provides a common interface to the parts of an object file for a calling application. -When an application sucessfully opens a target file (object, archive, or +When an application successfully opens a target file (object, archive, or whatever), a pointer to an internal structure is returned. This pointer points to a structure called @code{bfd}, described in @file{bfd.h}. Our convention is to call this pointer a BFD, and @@ -294,6 +298,7 @@ structures. @end ignore @end menu @node What to Put Where, aout, BFD back ends, BFD back ends +@section What to Put Where All of BFD lives in one directory. @node aout, coff, What to Put Where, BFD back ends @@ -310,11 +315,11 @@ All of BFD lives in one directory. @node mmo, , elf, BFD back ends @include mmo.texi -@node GNU Free Documentation License, Index, BFD back ends, Top +@node GNU Free Documentation License, BFD Index, BFD back ends, Top @include fdl.texi -@node Index, , GNU Free Documentation License, Top -@unnumbered Index +@node BFD Index, , GNU Free Documentation License, Top +@unnumbered BFD Index @printindex cp @tex @@ -332,5 +337,4 @@ All of BFD lives in one directory. % Blame: doc@cygnus.com, 28mar91. @end tex -@contents @bye diff --git a/contrib/binutils/bfd/doc/bfdint.texi b/contrib/binutils/bfd/doc/bfdint.texi index 98826fd52062..b7e7c548e6ad 100644 --- a/contrib/binutils/bfd/doc/bfdint.texi +++ b/contrib/binutils/bfd/doc/bfdint.texi @@ -1,6 +1,6 @@ \input texinfo @c Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, -@c 2000, 2001, 2002, 2003, 2004 +@c 2000, 2001, 2002, 2003, 2004, 2006, 2007 @c Free Software Foundation, Inc. @setfilename bfdint.info @@ -13,6 +13,33 @@ @page @end iftex +@copying +This file documents the internals of the BFD library. + +Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, +1996, 1998, 2000, 2001, 2002, 2003, 2004, 2006, 2007 +Free Software Foundation, Inc. +Contributed by Cygnus Support. + +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 or +any later version published by the Free Software Foundation; with the +Invariant Sections being ``GNU General Public License'' and ``Funding +Free Software'', the Front-Cover texts being (a) (see below), and with +the Back-Cover Texts being (b) (see below). A copy of the license is +included in the section entitled ``GNU Free Documentation License''. + +(a) The FSF's Front-Cover Text is: + + A GNU Manual + +(b) The FSF's Back-Cover Text is: + + You have freedom to copy and modify this GNU Manual, like GNU + software. Copies published by the Free Software Foundation raise + funds for GNU development. +@end copying + @node Top @top BFD Internals @raisesections @@ -189,7 +216,7 @@ and handle it using the special hooks. In some cases there is also implicit information which BFD can not represent. For example, the MIPS processor distinguishes small and -large symbols, and requires that all small symbls be within 32K of the +large symbols, and requires that all small symbols be within 32K of the GP register. This means that the MIPS assembler must be able to mark variables as either small or large, and the MIPS linker must know to put small symbols within range of the GP register. Since BFD can not @@ -230,7 +257,7 @@ Follow the GNU coding standards. Avoid global variables. We ideally want BFD to be fully reentrant, so that it can be used in multiple threads. All uses of global or static variables interfere with that. Initialized constant variables are OK, -and they should be explicitly marked with const. Instead of global +and they should be explicitly marked with @samp{const}. Instead of global variables, use data attached to a BFD or to a linker hash table. @item @@ -1391,7 +1418,7 @@ constants used by the generic support. @subsection ELF sections and segments The ELF ABI permits a file to have either sections or segments or both. -Relocateable object files conventionally have only sections. +Relocatable object files conventionally have only sections. Executables conventionally have both. Core files conventionally have only program segments. @@ -1744,23 +1771,6 @@ support. The processor function hooks and constants are ad hoc and need better documentation. -When a linker script uses @samp{SIZEOF_HEADERS}, the ELF backend must -guess at the number of program segments which will be required, in -@samp{get_program_header_size}. This is because the linker calls -@samp{bfd_sizeof_headers} before it knows all the section addresses and -sizes. The ELF backend may later discover, when creating program -segments, that more program segments are required. This is currently -reported as an error in @samp{assign_file_positions_for_segments}. - -In practice this makes it difficult to use @samp{SIZEOF_HEADERS} except -with a carefully defined linker script. Unfortunately, -@samp{SIZEOF_HEADERS} is required for fast program loading on a native -system, since it permits the initial code section to appear on the same -page as the program segments, saving a page read when the program starts -running. Fortunately, native systems permit careful definition of the -linker script. Still, ideally it would be possible to use relaxation to -compute the number of program segments. - @node BFD glossary @section BFD glossary @cindex glossary for bfd diff --git a/contrib/binutils/bfd/doc/bfdio.texi b/contrib/binutils/bfd/doc/bfdio.texi deleted file mode 100644 index eb7e31df9d08..000000000000 --- a/contrib/binutils/bfd/doc/bfdio.texi +++ /dev/null @@ -1,72 +0,0 @@ -@findex struct bfd_iovec -@subsubsection @code{struct bfd_iovec} -@strong{Description}@* -The @code{struct bfd_iovec} contains the internal file I/O class. -Each @code{BFD} has an instance of this class and all file I/O is -routed through it (it is assumed that the instance implements -all methods listed below). -@example -struct bfd_iovec -@{ - /* To avoid problems with macros, a "b" rather than "f" - prefix is prepended to each method name. */ - /* Attempt to read/write NBYTES on ABFD's IOSTREAM storing/fetching - bytes starting at PTR. Return the number of bytes actually - transfered (a read past end-of-file returns less than NBYTES), - or -1 (setting @code{bfd_error}) if an error occurs. */ - file_ptr (*bread) (struct bfd *abfd, void *ptr, file_ptr nbytes); - file_ptr (*bwrite) (struct bfd *abfd, const void *ptr, - file_ptr nbytes); - /* Return the current IOSTREAM file offset, or -1 (setting @code{bfd_error} - if an error occurs. */ - file_ptr (*btell) (struct bfd *abfd); - /* For the following, on successful completion a value of 0 is returned. - Otherwise, a value of -1 is returned (and @code{bfd_error} is set). */ - int (*bseek) (struct bfd *abfd, file_ptr offset, int whence); - int (*bclose) (struct bfd *abfd); - int (*bflush) (struct bfd *abfd); - int (*bstat) (struct bfd *abfd, struct stat *sb); -@}; -@end example - -@findex bfd_get_mtime -@subsubsection @code{bfd_get_mtime} -@strong{Synopsis} -@example -long bfd_get_mtime (bfd *abfd); -@end example -@strong{Description}@* -Return the file modification time (as read from the file system, or -from the archive header for archive members). - -@findex bfd_get_size -@subsubsection @code{bfd_get_size} -@strong{Synopsis} -@example -long bfd_get_size (bfd *abfd); -@end example -@strong{Description}@* -Return the file size (as read from file system) for the file -associated with BFD @var{abfd}. - -The initial motivation for, and use of, this routine is not -so we can get the exact size of the object the BFD applies to, since -that might not be generally possible (archive members for example). -It would be ideal if someone could eventually modify -it so that such results were guaranteed. - -Instead, we want to ask questions like "is this NNN byte sized -object I'm about to try read from file offset YYY reasonable?" -As as example of where we might do this, some object formats -use string tables for which the first @code{sizeof (long)} bytes of the -table contain the size of the table itself, including the size bytes. -If an application tries to read what it thinks is one of these -string tables, without some way to validate the size, and for -some reason the size is wrong (byte swapping error, wrong location -for the string table, etc.), the only clue is likely to be a read -error when it tries to read the table, or a "virtual memory -exhausted" error when it tries to allocate 15 bazillon bytes -of space for the 15 bazillon byte table it is about to read. -This function at least allows us to answer the question, "is the -size reasonable?". - diff --git a/contrib/binutils/bfd/doc/bfdt.texi b/contrib/binutils/bfd/doc/bfdt.texi deleted file mode 100644 index a22fe3861d96..000000000000 --- a/contrib/binutils/bfd/doc/bfdt.texi +++ /dev/null @@ -1,721 +0,0 @@ -@section @code{typedef bfd} -A BFD has type @code{bfd}; objects of this type are the -cornerstone of any application using BFD. Using BFD -consists of making references though the BFD and to data in the BFD. - -Here is the structure that defines the type @code{bfd}. It -contains the major data about the file and pointers -to the rest of the data. - - -@example - -struct bfd -@{ - /* A unique identifier of the BFD */ - unsigned int id; - - /* The filename the application opened the BFD with. */ - const char *filename; - - /* A pointer to the target jump table. */ - const struct bfd_target *xvec; - - /* The IOSTREAM, and corresponding IO vector that provide access - to the file backing the BFD. */ - void *iostream; - const struct bfd_iovec *iovec; - - /* Is the file descriptor being cached? That is, can it be closed as - needed, and re-opened when accessed later? */ - bfd_boolean cacheable; - - /* Marks whether there was a default target specified when the - BFD was opened. This is used to select which matching algorithm - to use to choose the back end. */ - bfd_boolean target_defaulted; - - /* The caching routines use these to maintain a - least-recently-used list of BFDs. */ - struct bfd *lru_prev, *lru_next; - - /* When a file is closed by the caching routines, BFD retains - state information on the file here... */ - ufile_ptr where; - - /* ... and here: (``once'' means at least once). */ - bfd_boolean opened_once; - - /* Set if we have a locally maintained mtime value, rather than - getting it from the file each time. */ - bfd_boolean mtime_set; - - /* File modified time, if mtime_set is TRUE. */ - long mtime; - - /* Reserved for an unimplemented file locking extension. */ - int ifd; - - /* The format which belongs to the BFD. (object, core, etc.) */ - bfd_format format; - - /* The direction with which the BFD was opened. */ - enum bfd_direction - @{ - no_direction = 0, - read_direction = 1, - write_direction = 2, - both_direction = 3 - @} - direction; - - /* Format_specific flags. */ - flagword flags; - - /* Currently my_archive is tested before adding origin to - anything. I believe that this can become always an add of - origin, with origin set to 0 for non archive files. */ - ufile_ptr origin; - - /* Remember when output has begun, to stop strange things - from happening. */ - bfd_boolean output_has_begun; - - /* A hash table for section names. */ - struct bfd_hash_table section_htab; - - /* Pointer to linked list of sections. */ - struct bfd_section *sections; - - /* The last section on the section list. */ - struct bfd_section *section_last; - - /* The number of sections. */ - unsigned int section_count; - - /* Stuff only useful for object files: - The start address. */ - bfd_vma start_address; - - /* Used for input and output. */ - unsigned int symcount; - - /* Symbol table for output BFD (with symcount entries). */ - struct bfd_symbol **outsymbols; - - /* Used for slurped dynamic symbol tables. */ - unsigned int dynsymcount; - - /* Pointer to structure which contains architecture information. */ - const struct bfd_arch_info *arch_info; - - /* Flag set if symbols from this BFD should not be exported. */ - bfd_boolean no_export; - - /* Stuff only useful for archives. */ - void *arelt_data; - struct bfd *my_archive; /* The containing archive BFD. */ - struct bfd *next; /* The next BFD in the archive. */ - struct bfd *archive_head; /* The first BFD in the archive. */ - bfd_boolean has_armap; - - /* A chain of BFD structures involved in a link. */ - struct bfd *link_next; - - /* A field used by _bfd_generic_link_add_archive_symbols. This will - be used only for archive elements. */ - int archive_pass; - - /* Used by the back end to hold private data. */ - union - @{ - struct aout_data_struct *aout_data; - struct artdata *aout_ar_data; - struct _oasys_data *oasys_obj_data; - struct _oasys_ar_data *oasys_ar_data; - struct coff_tdata *coff_obj_data; - struct pe_tdata *pe_obj_data; - struct xcoff_tdata *xcoff_obj_data; - struct ecoff_tdata *ecoff_obj_data; - struct ieee_data_struct *ieee_data; - struct ieee_ar_data_struct *ieee_ar_data; - struct srec_data_struct *srec_data; - struct ihex_data_struct *ihex_data; - struct tekhex_data_struct *tekhex_data; - struct elf_obj_tdata *elf_obj_data; - struct nlm_obj_tdata *nlm_obj_data; - struct bout_data_struct *bout_data; - struct mmo_data_struct *mmo_data; - struct sun_core_struct *sun_core_data; - struct sco5_core_struct *sco5_core_data; - struct trad_core_struct *trad_core_data; - struct som_data_struct *som_data; - struct hpux_core_struct *hpux_core_data; - struct hppabsd_core_struct *hppabsd_core_data; - struct sgi_core_struct *sgi_core_data; - struct lynx_core_struct *lynx_core_data; - struct osf_core_struct *osf_core_data; - struct cisco_core_struct *cisco_core_data; - struct versados_data_struct *versados_data; - struct netbsd_core_struct *netbsd_core_data; - struct mach_o_data_struct *mach_o_data; - struct mach_o_fat_data_struct *mach_o_fat_data; - struct bfd_pef_data_struct *pef_data; - struct bfd_pef_xlib_data_struct *pef_xlib_data; - struct bfd_sym_data_struct *sym_data; - void *any; - @} - tdata; - - /* Used by the application to hold private data. */ - void *usrdata; - - /* Where all the allocated stuff under this BFD goes. This is a - struct objalloc *, but we use void * to avoid requiring the inclusion - of objalloc.h. */ - void *memory; -@}; - -@end example -@section Error reporting -Most BFD functions return nonzero on success (check their -individual documentation for precise semantics). On an error, -they call @code{bfd_set_error} to set an error condition that callers -can check by calling @code{bfd_get_error}. -If that returns @code{bfd_error_system_call}, then check -@code{errno}. - -The easiest way to report a BFD error to the user is to -use @code{bfd_perror}. - -@subsection Type @code{bfd_error_type} -The values returned by @code{bfd_get_error} are defined by the -enumerated type @code{bfd_error_type}. - - -@example - -typedef enum bfd_error -@{ - bfd_error_no_error = 0, - bfd_error_system_call, - bfd_error_invalid_target, - bfd_error_wrong_format, - bfd_error_wrong_object_format, - bfd_error_invalid_operation, - bfd_error_no_memory, - bfd_error_no_symbols, - bfd_error_no_armap, - bfd_error_no_more_archived_files, - bfd_error_malformed_archive, - bfd_error_file_not_recognized, - bfd_error_file_ambiguously_recognized, - bfd_error_no_contents, - bfd_error_nonrepresentable_section, - bfd_error_no_debug_section, - bfd_error_bad_value, - bfd_error_file_truncated, - bfd_error_file_too_big, - bfd_error_invalid_error_code -@} -bfd_error_type; - -@end example -@findex bfd_get_error -@subsubsection @code{bfd_get_error} -@strong{Synopsis} -@example -bfd_error_type bfd_get_error (void); -@end example -@strong{Description}@* -Return the current BFD error condition. - -@findex bfd_set_error -@subsubsection @code{bfd_set_error} -@strong{Synopsis} -@example -void bfd_set_error (bfd_error_type error_tag); -@end example -@strong{Description}@* -Set the BFD error condition to be @var{error_tag}. - -@findex bfd_errmsg -@subsubsection @code{bfd_errmsg} -@strong{Synopsis} -@example -const char *bfd_errmsg (bfd_error_type error_tag); -@end example -@strong{Description}@* -Return a string describing the error @var{error_tag}, or -the system error if @var{error_tag} is @code{bfd_error_system_call}. - -@findex bfd_perror -@subsubsection @code{bfd_perror} -@strong{Synopsis} -@example -void bfd_perror (const char *message); -@end example -@strong{Description}@* -Print to the standard error stream a string describing the -last BFD error that occurred, or the last system error if -the last BFD error was a system call failure. If @var{message} -is non-NULL and non-empty, the error string printed is preceded -by @var{message}, a colon, and a space. It is followed by a newline. - -@subsection BFD error handler -Some BFD functions want to print messages describing the -problem. They call a BFD error handler function. This -function may be overridden by the program. - -The BFD error handler acts like printf. - - -@example - -typedef void (*bfd_error_handler_type) (const char *, ...); - -@end example -@findex bfd_set_error_handler -@subsubsection @code{bfd_set_error_handler} -@strong{Synopsis} -@example -bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type); -@end example -@strong{Description}@* -Set the BFD error handler function. Returns the previous -function. - -@findex bfd_set_error_program_name -@subsubsection @code{bfd_set_error_program_name} -@strong{Synopsis} -@example -void bfd_set_error_program_name (const char *); -@end example -@strong{Description}@* -Set the program name to use when printing a BFD error. This -is printed before the error message followed by a colon and -space. The string must not be changed after it is passed to -this function. - -@findex bfd_get_error_handler -@subsubsection @code{bfd_get_error_handler} -@strong{Synopsis} -@example -bfd_error_handler_type bfd_get_error_handler (void); -@end example -@strong{Description}@* -Return the BFD error handler function. - -@section Miscellaneous - - -@subsection Miscellaneous functions - - -@findex bfd_get_reloc_upper_bound -@subsubsection @code{bfd_get_reloc_upper_bound} -@strong{Synopsis} -@example -long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect); -@end example -@strong{Description}@* -Return the number of bytes required to store the -relocation information associated with section @var{sect} -attached to bfd @var{abfd}. If an error occurs, return -1. - -@findex bfd_canonicalize_reloc -@subsubsection @code{bfd_canonicalize_reloc} -@strong{Synopsis} -@example -long bfd_canonicalize_reloc - (bfd *abfd, asection *sec, arelent **loc, asymbol **syms); -@end example -@strong{Description}@* -Call the back end associated with the open BFD -@var{abfd} and translate the external form of the relocation -information attached to @var{sec} into the internal canonical -form. Place the table into memory at @var{loc}, which has -been preallocated, usually by a call to -@code{bfd_get_reloc_upper_bound}. Returns the number of relocs, or --1 on error. - -The @var{syms} table is also needed for horrible internal magic -reasons. - -@findex bfd_set_reloc -@subsubsection @code{bfd_set_reloc} -@strong{Synopsis} -@example -void bfd_set_reloc - (bfd *abfd, asection *sec, arelent **rel, unsigned int count); -@end example -@strong{Description}@* -Set the relocation pointer and count within -section @var{sec} to the values @var{rel} and @var{count}. -The argument @var{abfd} is ignored. - -@findex bfd_set_file_flags -@subsubsection @code{bfd_set_file_flags} -@strong{Synopsis} -@example -bfd_boolean bfd_set_file_flags (bfd *abfd, flagword flags); -@end example -@strong{Description}@* -Set the flag word in the BFD @var{abfd} to the value @var{flags}. - -Possible errors are: -@itemize @bullet - -@item -@code{bfd_error_wrong_format} - The target bfd was not of object format. -@item -@code{bfd_error_invalid_operation} - The target bfd was open for reading. -@item -@code{bfd_error_invalid_operation} - -The flag word contained a bit which was not applicable to the -type of file. E.g., an attempt was made to set the @code{D_PAGED} bit -on a BFD format which does not support demand paging. -@end itemize - -@findex bfd_get_arch_size -@subsubsection @code{bfd_get_arch_size} -@strong{Synopsis} -@example -int bfd_get_arch_size (bfd *abfd); -@end example -@strong{Description}@* -Returns the architecture address size, in bits, as determined -by the object file's format. For ELF, this information is -included in the header. - -@strong{Returns}@* -Returns the arch size in bits if known, @code{-1} otherwise. - -@findex bfd_get_sign_extend_vma -@subsubsection @code{bfd_get_sign_extend_vma} -@strong{Synopsis} -@example -int bfd_get_sign_extend_vma (bfd *abfd); -@end example -@strong{Description}@* -Indicates if the target architecture "naturally" sign extends -an address. Some architectures implicitly sign extend address -values when they are converted to types larger than the size -of an address. For instance, bfd_get_start_address() will -return an address sign extended to fill a bfd_vma when this is -the case. - -@strong{Returns}@* -Returns @code{1} if the target architecture is known to sign -extend addresses, @code{0} if the target architecture is known to -not sign extend addresses, and @code{-1} otherwise. - -@findex bfd_set_start_address -@subsubsection @code{bfd_set_start_address} -@strong{Synopsis} -@example -bfd_boolean bfd_set_start_address (bfd *abfd, bfd_vma vma); -@end example -@strong{Description}@* -Make @var{vma} the entry point of output BFD @var{abfd}. - -@strong{Returns}@* -Returns @code{TRUE} on success, @code{FALSE} otherwise. - -@findex bfd_get_gp_size -@subsubsection @code{bfd_get_gp_size} -@strong{Synopsis} -@example -unsigned int bfd_get_gp_size (bfd *abfd); -@end example -@strong{Description}@* -Return the maximum size of objects to be optimized using the GP -register under MIPS ECOFF. This is typically set by the @code{-G} -argument to the compiler, assembler or linker. - -@findex bfd_set_gp_size -@subsubsection @code{bfd_set_gp_size} -@strong{Synopsis} -@example -void bfd_set_gp_size (bfd *abfd, unsigned int i); -@end example -@strong{Description}@* -Set the maximum size of objects to be optimized using the GP -register under ECOFF or MIPS ELF. This is typically set by -the @code{-G} argument to the compiler, assembler or linker. - -@findex bfd_scan_vma -@subsubsection @code{bfd_scan_vma} -@strong{Synopsis} -@example -bfd_vma bfd_scan_vma (const char *string, const char **end, int base); -@end example -@strong{Description}@* -Convert, like @code{strtoul}, a numerical expression -@var{string} into a @code{bfd_vma} integer, and return that integer. -(Though without as many bells and whistles as @code{strtoul}.) -The expression is assumed to be unsigned (i.e., positive). -If given a @var{base}, it is used as the base for conversion. -A base of 0 causes the function to interpret the string -in hex if a leading "0x" or "0X" is found, otherwise -in octal if a leading zero is found, otherwise in decimal. - -If the value would overflow, the maximum @code{bfd_vma} value is -returned. - -@findex bfd_copy_private_header_data -@subsubsection @code{bfd_copy_private_header_data} -@strong{Synopsis} -@example -bfd_boolean bfd_copy_private_header_data (bfd *ibfd, bfd *obfd); -@end example -@strong{Description}@* -Copy private BFD header information from the BFD @var{ibfd} to the -the BFD @var{obfd}. This copies information that may require -sections to exist, but does not require symbol tables. Return -@code{true} on success, @code{false} on error. -Possible error returns are: - -@itemize @bullet - -@item -@code{bfd_error_no_memory} - -Not enough memory exists to create private data for @var{obfd}. -@end itemize -@example -#define bfd_copy_private_header_data(ibfd, obfd) \ - BFD_SEND (obfd, _bfd_copy_private_header_data, \ - (ibfd, obfd)) -@end example - -@findex bfd_copy_private_bfd_data -@subsubsection @code{bfd_copy_private_bfd_data} -@strong{Synopsis} -@example -bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd); -@end example -@strong{Description}@* -Copy private BFD information from the BFD @var{ibfd} to the -the BFD @var{obfd}. Return @code{TRUE} on success, @code{FALSE} on error. -Possible error returns are: - -@itemize @bullet - -@item -@code{bfd_error_no_memory} - -Not enough memory exists to create private data for @var{obfd}. -@end itemize -@example -#define bfd_copy_private_bfd_data(ibfd, obfd) \ - BFD_SEND (obfd, _bfd_copy_private_bfd_data, \ - (ibfd, obfd)) -@end example - -@findex bfd_merge_private_bfd_data -@subsubsection @code{bfd_merge_private_bfd_data} -@strong{Synopsis} -@example -bfd_boolean bfd_merge_private_bfd_data (bfd *ibfd, bfd *obfd); -@end example -@strong{Description}@* -Merge private BFD information from the BFD @var{ibfd} to the -the output file BFD @var{obfd} when linking. Return @code{TRUE} -on success, @code{FALSE} on error. Possible error returns are: - -@itemize @bullet - -@item -@code{bfd_error_no_memory} - -Not enough memory exists to create private data for @var{obfd}. -@end itemize -@example -#define bfd_merge_private_bfd_data(ibfd, obfd) \ - BFD_SEND (obfd, _bfd_merge_private_bfd_data, \ - (ibfd, obfd)) -@end example - -@findex bfd_set_private_flags -@subsubsection @code{bfd_set_private_flags} -@strong{Synopsis} -@example -bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags); -@end example -@strong{Description}@* -Set private BFD flag information in the BFD @var{abfd}. -Return @code{TRUE} on success, @code{FALSE} on error. Possible error -returns are: - -@itemize @bullet - -@item -@code{bfd_error_no_memory} - -Not enough memory exists to create private data for @var{obfd}. -@end itemize -@example -#define bfd_set_private_flags(abfd, flags) \ - BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags)) -@end example - -@findex Other functions -@subsubsection @code{Other functions} -@strong{Description}@* -The following functions exist but have not yet been documented. -@example -#define bfd_sizeof_headers(abfd, reloc) \ - BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc)) - -#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \ - BFD_SEND (abfd, _bfd_find_nearest_line, \ - (abfd, sec, syms, off, file, func, line)) - -#define bfd_find_line(abfd, syms, sym, file, line) \ - BFD_SEND (abfd, _bfd_find_line, \ - (abfd, syms, sym, file, line)) - -#define bfd_find_inliner_info(abfd, file, func, line) \ - BFD_SEND (abfd, _bfd_find_inliner_info, \ - (abfd, file, func, line)) - -#define bfd_debug_info_start(abfd) \ - BFD_SEND (abfd, _bfd_debug_info_start, (abfd)) - -#define bfd_debug_info_end(abfd) \ - BFD_SEND (abfd, _bfd_debug_info_end, (abfd)) - -#define bfd_debug_info_accumulate(abfd, section) \ - BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section)) - -#define bfd_stat_arch_elt(abfd, stat) \ - BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat)) - -#define bfd_update_armap_timestamp(abfd) \ - BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd)) - -#define bfd_set_arch_mach(abfd, arch, mach)\ - BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach)) - -#define bfd_relax_section(abfd, section, link_info, again) \ - BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again)) - -#define bfd_gc_sections(abfd, link_info) \ - BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info)) - -#define bfd_merge_sections(abfd, link_info) \ - BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info)) - -#define bfd_is_group_section(abfd, sec) \ - BFD_SEND (abfd, _bfd_is_group_section, (abfd, sec)) - -#define bfd_discard_group(abfd, sec) \ - BFD_SEND (abfd, _bfd_discard_group, (abfd, sec)) - -#define bfd_link_hash_table_create(abfd) \ - BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd)) - -#define bfd_link_hash_table_free(abfd, hash) \ - BFD_SEND (abfd, _bfd_link_hash_table_free, (hash)) - -#define bfd_link_add_symbols(abfd, info) \ - BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info)) - -#define bfd_link_just_syms(abfd, sec, info) \ - BFD_SEND (abfd, _bfd_link_just_syms, (sec, info)) - -#define bfd_final_link(abfd, info) \ - BFD_SEND (abfd, _bfd_final_link, (abfd, info)) - -#define bfd_free_cached_info(abfd) \ - BFD_SEND (abfd, _bfd_free_cached_info, (abfd)) - -#define bfd_get_dynamic_symtab_upper_bound(abfd) \ - BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd)) - -#define bfd_print_private_bfd_data(abfd, file)\ - BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file)) - -#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \ - BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols)) - -#define bfd_get_synthetic_symtab(abfd, count, syms, dyncount, dynsyms, ret) \ - BFD_SEND (abfd, _bfd_get_synthetic_symtab, (abfd, count, syms, \ - dyncount, dynsyms, ret)) - -#define bfd_get_dynamic_reloc_upper_bound(abfd) \ - BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd)) - -#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \ - BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms)) - -extern bfd_byte *bfd_get_relocated_section_contents - (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *, - bfd_boolean, asymbol **); - -@end example - -@findex bfd_alt_mach_code -@subsubsection @code{bfd_alt_mach_code} -@strong{Synopsis} -@example -bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative); -@end example -@strong{Description}@* -When more than one machine code number is available for the -same machine type, this function can be used to switch between -the preferred one (alternative == 0) and any others. Currently, -only ELF supports this feature, with up to two alternate -machine codes. - - -@example -struct bfd_preserve -@{ - void *marker; - void *tdata; - flagword flags; - const struct bfd_arch_info *arch_info; - struct bfd_section *sections; - struct bfd_section *section_last; - unsigned int section_count; - struct bfd_hash_table section_htab; -@}; - -@end example -@findex bfd_preserve_save -@subsubsection @code{bfd_preserve_save} -@strong{Synopsis} -@example -bfd_boolean bfd_preserve_save (bfd *, struct bfd_preserve *); -@end example -@strong{Description}@* -When testing an object for compatibility with a particular -target back-end, the back-end object_p function needs to set -up certain fields in the bfd on successfully recognizing the -object. This typically happens in a piecemeal fashion, with -failures possible at many points. On failure, the bfd is -supposed to be restored to its initial state, which is -virtually impossible. However, restoring a subset of the bfd -state works in practice. This function stores the subset and -reinitializes the bfd. - -@findex bfd_preserve_restore -@subsubsection @code{bfd_preserve_restore} -@strong{Synopsis} -@example -void bfd_preserve_restore (bfd *, struct bfd_preserve *); -@end example -@strong{Description}@* -This function restores bfd state saved by bfd_preserve_save. -If MARKER is non-NULL in struct bfd_preserve then that block -and all subsequently bfd_alloc'd memory is freed. - -@findex bfd_preserve_finish -@subsubsection @code{bfd_preserve_finish} -@strong{Synopsis} -@example -void bfd_preserve_finish (bfd *, struct bfd_preserve *); -@end example -@strong{Description}@* -This function should be called when the bfd state saved by -bfd_preserve_save is no longer needed. ie. when the back-end -object_p function returns with success. - diff --git a/contrib/binutils/bfd/doc/bfdwin.texi b/contrib/binutils/bfd/doc/bfdwin.texi deleted file mode 100644 index b1fd7d5bed69..000000000000 --- a/contrib/binutils/bfd/doc/bfdwin.texi +++ /dev/null @@ -1,2 +0,0 @@ -@findex -@subsubsection @code{} diff --git a/contrib/binutils/bfd/doc/cache.texi b/contrib/binutils/bfd/doc/cache.texi deleted file mode 100644 index 5820a2a6a1d3..000000000000 --- a/contrib/binutils/bfd/doc/cache.texi +++ /dev/null @@ -1,65 +0,0 @@ -@section File caching -The file caching mechanism is embedded within BFD and allows -the application to open as many BFDs as it wants without -regard to the underlying operating system's file descriptor -limit (often as low as 20 open files). The module in -@code{cache.c} maintains a least recently used list of -@code{BFD_CACHE_MAX_OPEN} files, and exports the name -@code{bfd_cache_lookup}, which runs around and makes sure that -the required BFD is open. If not, then it chooses a file to -close, closes it and opens the one wanted, returning its file -handle. - -@subsection Caching functions - - -@findex bfd_cache_init -@subsubsection @code{bfd_cache_init} -@strong{Synopsis} -@example -bfd_boolean bfd_cache_init (bfd *abfd); -@end example -@strong{Description}@* -Add a newly opened BFD to the cache. - -@findex bfd_cache_close -@subsubsection @code{bfd_cache_close} -@strong{Synopsis} -@example -bfd_boolean bfd_cache_close (bfd *abfd); -@end example -@strong{Description}@* -Remove the BFD @var{abfd} from the cache. If the attached file is open, -then close it too. - -@strong{Returns}@* -@code{FALSE} is returned if closing the file fails, @code{TRUE} is -returned if all is well. - -@findex bfd_cache_close_all -@subsubsection @code{bfd_cache_close_all} -@strong{Synopsis} -@example -bfd_boolean bfd_cache_close_all (void); -@end example -@strong{Description}@* -Remove all BFDs from the cache. If the attached file is open, -then close it too. - -@strong{Returns}@* -@code{FALSE} is returned if closing one of the file fails, @code{TRUE} is -returned if all is well. - -@findex bfd_open_file -@subsubsection @code{bfd_open_file} -@strong{Synopsis} -@example -FILE* bfd_open_file (bfd *abfd); -@end example -@strong{Description}@* -Call the OS to open a file for @var{abfd}. Return the @code{FILE *} -(possibly @code{NULL}) that results from this operation. Set up the -BFD so that future accesses know the file is open. If the @code{FILE *} -returned is @code{NULL}, then it won't have been put in the -cache, so it won't have to be removed from it. - diff --git a/contrib/binutils/bfd/doc/coffcode.texi b/contrib/binutils/bfd/doc/coffcode.texi deleted file mode 100644 index 6689009c0817..000000000000 --- a/contrib/binutils/bfd/doc/coffcode.texi +++ /dev/null @@ -1,608 +0,0 @@ -@section coff backends -BFD supports a number of different flavours of coff format. -The major differences between formats are the sizes and -alignments of fields in structures on disk, and the occasional -extra field. - -Coff in all its varieties is implemented with a few common -files and a number of implementation specific files. For -example, The 88k bcs coff format is implemented in the file -@file{coff-m88k.c}. This file @code{#include}s -@file{coff/m88k.h} which defines the external structure of the -coff format for the 88k, and @file{coff/internal.h} which -defines the internal structure. @file{coff-m88k.c} also -defines the relocations used by the 88k format -@xref{Relocations}. - -The Intel i960 processor version of coff is implemented in -@file{coff-i960.c}. This file has the same structure as -@file{coff-m88k.c}, except that it includes @file{coff/i960.h} -rather than @file{coff-m88k.h}. - -@subsection Porting to a new version of coff -The recommended method is to select from the existing -implementations the version of coff which is most like the one -you want to use. For example, we'll say that i386 coff is -the one you select, and that your coff flavour is called foo. -Copy @file{i386coff.c} to @file{foocoff.c}, copy -@file{../include/coff/i386.h} to @file{../include/coff/foo.h}, -and add the lines to @file{targets.c} and @file{Makefile.in} -so that your new back end is used. Alter the shapes of the -structures in @file{../include/coff/foo.h} so that they match -what you need. You will probably also have to add -@code{#ifdef}s to the code in @file{coff/internal.h} and -@file{coffcode.h} if your version of coff is too wild. - -You can verify that your new BFD backend works quite simply by -building @file{objdump} from the @file{binutils} directory, -and making sure that its version of what's going on and your -host system's idea (assuming it has the pretty standard coff -dump utility, usually called @code{att-dump} or just -@code{dump}) are the same. Then clean up your code, and send -what you've done to Cygnus. Then your stuff will be in the -next release, and you won't have to keep integrating it. - -@subsection How the coff backend works - - -@subsubsection File layout -The Coff backend is split into generic routines that are -applicable to any Coff target and routines that are specific -to a particular target. The target-specific routines are -further split into ones which are basically the same for all -Coff targets except that they use the external symbol format -or use different values for certain constants. - -The generic routines are in @file{coffgen.c}. These routines -work for any Coff target. They use some hooks into the target -specific code; the hooks are in a @code{bfd_coff_backend_data} -structure, one of which exists for each target. - -The essentially similar target-specific routines are in -@file{coffcode.h}. This header file includes executable C code. -The various Coff targets first include the appropriate Coff -header file, make any special defines that are needed, and -then include @file{coffcode.h}. - -Some of the Coff targets then also have additional routines in -the target source file itself. - -For example, @file{coff-i960.c} includes -@file{coff/internal.h} and @file{coff/i960.h}. It then -defines a few constants, such as @code{I960}, and includes -@file{coffcode.h}. Since the i960 has complex relocation -types, @file{coff-i960.c} also includes some code to -manipulate the i960 relocs. This code is not in -@file{coffcode.h} because it would not be used by any other -target. - -@subsubsection Bit twiddling -Each flavour of coff supported in BFD has its own header file -describing the external layout of the structures. There is also -an internal description of the coff layout, in -@file{coff/internal.h}. A major function of the -coff backend is swapping the bytes and twiddling the bits to -translate the external form of the structures into the normal -internal form. This is all performed in the -@code{bfd_swap}_@i{thing}_@i{direction} routines. Some -elements are different sizes between different versions of -coff; it is the duty of the coff version specific include file -to override the definitions of various packing routines in -@file{coffcode.h}. E.g., the size of line number entry in coff is -sometimes 16 bits, and sometimes 32 bits. @code{#define}ing -@code{PUT_LNSZ_LNNO} and @code{GET_LNSZ_LNNO} will select the -correct one. No doubt, some day someone will find a version of -coff which has a varying field size not catered to at the -moment. To port BFD, that person will have to add more @code{#defines}. -Three of the bit twiddling routines are exported to -@code{gdb}; @code{coff_swap_aux_in}, @code{coff_swap_sym_in} -and @code{coff_swap_lineno_in}. @code{GDB} reads the symbol -table on its own, but uses BFD to fix things up. More of the -bit twiddlers are exported for @code{gas}; -@code{coff_swap_aux_out}, @code{coff_swap_sym_out}, -@code{coff_swap_lineno_out}, @code{coff_swap_reloc_out}, -@code{coff_swap_filehdr_out}, @code{coff_swap_aouthdr_out}, -@code{coff_swap_scnhdr_out}. @code{Gas} currently keeps track -of all the symbol table and reloc drudgery itself, thereby -saving the internal BFD overhead, but uses BFD to swap things -on the way out, making cross ports much safer. Doing so also -allows BFD (and thus the linker) to use the same header files -as @code{gas}, which makes one avenue to disaster disappear. - -@subsubsection Symbol reading -The simple canonical form for symbols used by BFD is not rich -enough to keep all the information available in a coff symbol -table. The back end gets around this problem by keeping the original -symbol table around, "behind the scenes". - -When a symbol table is requested (through a call to -@code{bfd_canonicalize_symtab}), a request gets through to -@code{coff_get_normalized_symtab}. This reads the symbol table from -the coff file and swaps all the structures inside into the -internal form. It also fixes up all the pointers in the table -(represented in the file by offsets from the first symbol in -the table) into physical pointers to elements in the new -internal table. This involves some work since the meanings of -fields change depending upon context: a field that is a -pointer to another structure in the symbol table at one moment -may be the size in bytes of a structure at the next. Another -pass is made over the table. All symbols which mark file names -(@code{C_FILE} symbols) are modified so that the internal -string points to the value in the auxent (the real filename) -rather than the normal text associated with the symbol -(@code{".file"}). - -At this time the symbol names are moved around. Coff stores -all symbols less than nine characters long physically -within the symbol table; longer strings are kept at the end of -the file in the string table. This pass moves all strings -into memory and replaces them with pointers to the strings. - -The symbol table is massaged once again, this time to create -the canonical table used by the BFD application. Each symbol -is inspected in turn, and a decision made (using the -@code{sclass} field) about the various flags to set in the -@code{asymbol}. @xref{Symbols}. The generated canonical table -shares strings with the hidden internal symbol table. - -Any linenumbers are read from the coff file too, and attached -to the symbols which own the functions the linenumbers belong to. - -@subsubsection Symbol writing -Writing a symbol to a coff file which didn't come from a coff -file will lose any debugging information. The @code{asymbol} -structure remembers the BFD from which the symbol was taken, and on -output the back end makes sure that the same destination target as -source target is present. - -When the symbols have come from a coff file then all the -debugging information is preserved. - -Symbol tables are provided for writing to the back end in a -vector of pointers to pointers. This allows applications like -the linker to accumulate and output large symbol tables -without having to do too much byte copying. - -This function runs through the provided symbol table and -patches each symbol marked as a file place holder -(@code{C_FILE}) to point to the next file place holder in the -list. It also marks each @code{offset} field in the list with -the offset from the first symbol of the current symbol. - -Another function of this procedure is to turn the canonical -value form of BFD into the form used by coff. Internally, BFD -expects symbol values to be offsets from a section base; so a -symbol physically at 0x120, but in a section starting at -0x100, would have the value 0x20. Coff expects symbols to -contain their final value, so symbols have their values -changed at this point to reflect their sum with their owning -section. This transformation uses the -@code{output_section} field of the @code{asymbol}'s -@code{asection} @xref{Sections}. - -@itemize @bullet - -@item -@code{coff_mangle_symbols} -@end itemize -This routine runs though the provided symbol table and uses -the offsets generated by the previous pass and the pointers -generated when the symbol table was read in to create the -structured hierarchy required by coff. It changes each pointer -to a symbol into the index into the symbol table of the asymbol. - -@itemize @bullet - -@item -@code{coff_write_symbols} -@end itemize -This routine runs through the symbol table and patches up the -symbols from their internal form into the coff way, calls the -bit twiddlers, and writes out the table to the file. - -@findex coff_symbol_type -@subsubsection @code{coff_symbol_type} -@strong{Description}@* -The hidden information for an @code{asymbol} is described in a -@code{combined_entry_type}: - - -@example - -typedef struct coff_ptr_struct -@{ - /* Remembers the offset from the first symbol in the file for - this symbol. Generated by coff_renumber_symbols. */ - unsigned int offset; - - /* Should the value of this symbol be renumbered. Used for - XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. */ - unsigned int fix_value : 1; - - /* Should the tag field of this symbol be renumbered. - Created by coff_pointerize_aux. */ - unsigned int fix_tag : 1; - - /* Should the endidx field of this symbol be renumbered. - Created by coff_pointerize_aux. */ - unsigned int fix_end : 1; - - /* Should the x_csect.x_scnlen field be renumbered. - Created by coff_pointerize_aux. */ - unsigned int fix_scnlen : 1; - - /* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the - index into the line number entries. Set by coff_slurp_symbol_table. */ - unsigned int fix_line : 1; - - /* The container for the symbol structure as read and translated - from the file. */ - union - @{ - union internal_auxent auxent; - struct internal_syment syment; - @} u; -@} combined_entry_type; - - -/* Each canonical asymbol really looks like this: */ - -typedef struct coff_symbol_struct -@{ - /* The actual symbol which the rest of BFD works with */ - asymbol symbol; - - /* A pointer to the hidden information for this symbol */ - combined_entry_type *native; - - /* A pointer to the linenumber information for this symbol */ - struct lineno_cache_entry *lineno; - - /* Have the line numbers been relocated yet ? */ - bfd_boolean done_lineno; -@} coff_symbol_type; -@end example -@findex bfd_coff_backend_data -@subsubsection @code{bfd_coff_backend_data} - -@example -/* COFF symbol classifications. */ - -enum coff_symbol_classification -@{ - /* Global symbol. */ - COFF_SYMBOL_GLOBAL, - /* Common symbol. */ - COFF_SYMBOL_COMMON, - /* Undefined symbol. */ - COFF_SYMBOL_UNDEFINED, - /* Local symbol. */ - COFF_SYMBOL_LOCAL, - /* PE section symbol. */ - COFF_SYMBOL_PE_SECTION -@}; - -@end example -Special entry points for gdb to swap in coff symbol table parts: -@example -typedef struct -@{ - void (*_bfd_coff_swap_aux_in) - (bfd *, void *, int, int, int, int, void *); - - void (*_bfd_coff_swap_sym_in) - (bfd *, void *, void *); - - void (*_bfd_coff_swap_lineno_in) - (bfd *, void *, void *); - - unsigned int (*_bfd_coff_swap_aux_out) - (bfd *, void *, int, int, int, int, void *); - - unsigned int (*_bfd_coff_swap_sym_out) - (bfd *, void *, void *); - - unsigned int (*_bfd_coff_swap_lineno_out) - (bfd *, void *, void *); - - unsigned int (*_bfd_coff_swap_reloc_out) - (bfd *, void *, void *); - - unsigned int (*_bfd_coff_swap_filehdr_out) - (bfd *, void *, void *); - - unsigned int (*_bfd_coff_swap_aouthdr_out) - (bfd *, void *, void *); - - unsigned int (*_bfd_coff_swap_scnhdr_out) - (bfd *, void *, void *); - - unsigned int _bfd_filhsz; - unsigned int _bfd_aoutsz; - unsigned int _bfd_scnhsz; - unsigned int _bfd_symesz; - unsigned int _bfd_auxesz; - unsigned int _bfd_relsz; - unsigned int _bfd_linesz; - unsigned int _bfd_filnmlen; - bfd_boolean _bfd_coff_long_filenames; - bfd_boolean _bfd_coff_long_section_names; - unsigned int _bfd_coff_default_section_alignment_power; - bfd_boolean _bfd_coff_force_symnames_in_strings; - unsigned int _bfd_coff_debug_string_prefix_length; - - void (*_bfd_coff_swap_filehdr_in) - (bfd *, void *, void *); - - void (*_bfd_coff_swap_aouthdr_in) - (bfd *, void *, void *); - - void (*_bfd_coff_swap_scnhdr_in) - (bfd *, void *, void *); - - void (*_bfd_coff_swap_reloc_in) - (bfd *abfd, void *, void *); - - bfd_boolean (*_bfd_coff_bad_format_hook) - (bfd *, void *); - - bfd_boolean (*_bfd_coff_set_arch_mach_hook) - (bfd *, void *); - - void * (*_bfd_coff_mkobject_hook) - (bfd *, void *, void *); - - bfd_boolean (*_bfd_styp_to_sec_flags_hook) - (bfd *, void *, const char *, asection *, flagword *); - - void (*_bfd_set_alignment_hook) - (bfd *, asection *, void *); - - bfd_boolean (*_bfd_coff_slurp_symbol_table) - (bfd *); - - bfd_boolean (*_bfd_coff_symname_in_debug) - (bfd *, struct internal_syment *); - - bfd_boolean (*_bfd_coff_pointerize_aux_hook) - (bfd *, combined_entry_type *, combined_entry_type *, - unsigned int, combined_entry_type *); - - bfd_boolean (*_bfd_coff_print_aux) - (bfd *, FILE *, combined_entry_type *, combined_entry_type *, - combined_entry_type *, unsigned int); - - void (*_bfd_coff_reloc16_extra_cases) - (bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, - bfd_byte *, unsigned int *, unsigned int *); - - int (*_bfd_coff_reloc16_estimate) - (bfd *, asection *, arelent *, unsigned int, - struct bfd_link_info *); - - enum coff_symbol_classification (*_bfd_coff_classify_symbol) - (bfd *, struct internal_syment *); - - bfd_boolean (*_bfd_coff_compute_section_file_positions) - (bfd *); - - bfd_boolean (*_bfd_coff_start_final_link) - (bfd *, struct bfd_link_info *); - - bfd_boolean (*_bfd_coff_relocate_section) - (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - struct internal_reloc *, struct internal_syment *, asection **); - - reloc_howto_type *(*_bfd_coff_rtype_to_howto) - (bfd *, asection *, struct internal_reloc *, - struct coff_link_hash_entry *, struct internal_syment *, - bfd_vma *); - - bfd_boolean (*_bfd_coff_adjust_symndx) - (bfd *, struct bfd_link_info *, bfd *, asection *, - struct internal_reloc *, bfd_boolean *); - - bfd_boolean (*_bfd_coff_link_add_one_symbol) - (struct bfd_link_info *, bfd *, const char *, flagword, - asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean, - struct bfd_link_hash_entry **); - - bfd_boolean (*_bfd_coff_link_output_has_begun) - (bfd *, struct coff_final_link_info *); - - bfd_boolean (*_bfd_coff_final_link_postscript) - (bfd *, struct coff_final_link_info *); - -@} bfd_coff_backend_data; - -#define coff_backend_info(abfd) \ - ((bfd_coff_backend_data *) (abfd)->xvec->backend_data) - -#define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \ - ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i)) - -#define bfd_coff_swap_sym_in(a,e,i) \ - ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i)) - -#define bfd_coff_swap_lineno_in(a,e,i) \ - ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i)) - -#define bfd_coff_swap_reloc_out(abfd, i, o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o)) - -#define bfd_coff_swap_lineno_out(abfd, i, o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o)) - -#define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \ - ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o)) - -#define bfd_coff_swap_sym_out(abfd, i,o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o)) - -#define bfd_coff_swap_scnhdr_out(abfd, i,o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o)) - -#define bfd_coff_swap_filehdr_out(abfd, i,o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o)) - -#define bfd_coff_swap_aouthdr_out(abfd, i,o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o)) - -#define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz) -#define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz) -#define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz) -#define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz) -#define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz) -#define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz) -#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz) -#define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen) -#define bfd_coff_long_filenames(abfd) \ - (coff_backend_info (abfd)->_bfd_coff_long_filenames) -#define bfd_coff_long_section_names(abfd) \ - (coff_backend_info (abfd)->_bfd_coff_long_section_names) -#define bfd_coff_default_section_alignment_power(abfd) \ - (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power) -#define bfd_coff_swap_filehdr_in(abfd, i,o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o)) - -#define bfd_coff_swap_aouthdr_in(abfd, i,o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o)) - -#define bfd_coff_swap_scnhdr_in(abfd, i,o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o)) - -#define bfd_coff_swap_reloc_in(abfd, i, o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o)) - -#define bfd_coff_bad_format_hook(abfd, filehdr) \ - ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr)) - -#define bfd_coff_set_arch_mach_hook(abfd, filehdr)\ - ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr)) -#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\ - ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook)\ - (abfd, filehdr, aouthdr)) - -#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section, flags_ptr)\ - ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\ - (abfd, scnhdr, name, section, flags_ptr)) - -#define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\ - ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr)) - -#define bfd_coff_slurp_symbol_table(abfd)\ - ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd)) - -#define bfd_coff_symname_in_debug(abfd, sym)\ - ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym)) - -#define bfd_coff_force_symnames_in_strings(abfd)\ - (coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings) - -#define bfd_coff_debug_string_prefix_length(abfd)\ - (coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length) - -#define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\ - ((coff_backend_info (abfd)->_bfd_coff_print_aux)\ - (abfd, file, base, symbol, aux, indaux)) - -#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order,\ - reloc, data, src_ptr, dst_ptr)\ - ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\ - (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)) - -#define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\ - ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\ - (abfd, section, reloc, shrink, link_info)) - -#define bfd_coff_classify_symbol(abfd, sym)\ - ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\ - (abfd, sym)) - -#define bfd_coff_compute_section_file_positions(abfd)\ - ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\ - (abfd)) - -#define bfd_coff_start_final_link(obfd, info)\ - ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\ - (obfd, info)) -#define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\ - ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\ - (obfd, info, ibfd, o, con, rel, isyms, secs)) -#define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\ - ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\ - (abfd, sec, rel, h, sym, addendp)) -#define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\ - ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\ - (obfd, info, ibfd, sec, rel, adjustedp)) -#define bfd_coff_link_add_one_symbol(info, abfd, name, flags, section,\ - value, string, cp, coll, hashp)\ - ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\ - (info, abfd, name, flags, section, value, string, cp, coll, hashp)) - -#define bfd_coff_link_output_has_begun(a,p) \ - ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a, p)) -#define bfd_coff_final_link_postscript(a,p) \ - ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a, p)) - -@end example -@subsubsection Writing relocations -To write relocations, the back end steps though the -canonical relocation table and create an -@code{internal_reloc}. The symbol index to use is removed from -the @code{offset} field in the symbol table supplied. The -address comes directly from the sum of the section base -address and the relocation offset; the type is dug directly -from the howto field. Then the @code{internal_reloc} is -swapped into the shape of an @code{external_reloc} and written -out to disk. - -@subsubsection Reading linenumbers -Creating the linenumber table is done by reading in the entire -coff linenumber table, and creating another table for internal use. - -A coff linenumber table is structured so that each function -is marked as having a line number of 0. Each line within the -function is an offset from the first line in the function. The -base of the line number information for the table is stored in -the symbol associated with the function. - -Note: The PE format uses line number 0 for a flag indicating a -new source file. - -The information is copied from the external to the internal -table, and each symbol which marks a function is marked by -pointing its... - -How does this work ? - -@subsubsection Reading relocations -Coff relocations are easily transformed into the internal BFD form -(@code{arelent}). - -Reading a coff relocation table is done in the following stages: - -@itemize @bullet - -@item -Read the entire coff relocation table into memory. - -@item -Process each relocation in turn; first swap it from the -external to the internal form. - -@item -Turn the symbol referenced in the relocation's symbol index -into a pointer into the canonical symbol table. -This table is the same as the one returned by a call to -@code{bfd_canonicalize_symtab}. The back end will call that -routine and save the result if a canonicalization hasn't been done. - -@item -The reloc index is turned into a pointer to a howto -structure, in a back end specific way. For instance, the 386 -and 960 use the @code{r_type} to directly produce an index -into a howto table vector; the 88k subtracts a number from the -@code{r_type} field and creates an addend field. -@end itemize - diff --git a/contrib/binutils/bfd/doc/core.texi b/contrib/binutils/bfd/doc/core.texi deleted file mode 100644 index 1f09445ef76d..000000000000 --- a/contrib/binutils/bfd/doc/core.texi +++ /dev/null @@ -1,60 +0,0 @@ -@section Core files - - -@subsection Core file functions - - -@strong{Description}@* -These are functions pertaining to core files. - -@findex bfd_core_file_failing_command -@subsubsection @code{bfd_core_file_failing_command} -@strong{Synopsis} -@example -const char *bfd_core_file_failing_command (bfd *abfd); -@end example -@strong{Description}@* -Return a read-only string explaining which program was running -when it failed and produced the core file @var{abfd}. - -@findex bfd_core_file_failing_signal -@subsubsection @code{bfd_core_file_failing_signal} -@strong{Synopsis} -@example -int bfd_core_file_failing_signal (bfd *abfd); -@end example -@strong{Description}@* -Returns the signal number which caused the core dump which -generated the file the BFD @var{abfd} is attached to. - -@findex core_file_matches_executable_p -@subsubsection @code{core_file_matches_executable_p} -@strong{Synopsis} -@example -bfd_boolean core_file_matches_executable_p - (bfd *core_bfd, bfd *exec_bfd); -@end example -@strong{Description}@* -Return @code{TRUE} if the core file attached to @var{core_bfd} -was generated by a run of the executable file attached to -@var{exec_bfd}, @code{FALSE} otherwise. - -@findex generic_core_file_matches_executable_p -@subsubsection @code{generic_core_file_matches_executable_p} -@strong{Synopsis} -@example -bfd_boolean generic_core_file_matches_executable_p - (bfd *core_bfd, bfd *exec_bfd); -@end example -@strong{Description}@* -Return TRUE if the core file attached to @var{core_bfd} -was generated by a run of the executable file attached -to @var{exec_bfd}. The match is based on executable -basenames only. - -Note: When not able to determine the core file failing -command or the executable name, we still return TRUE even -though we're not sure that core file and executable match. -This is to avoid generating a false warning in situations -where we really don't know whether they match or not. - diff --git a/contrib/binutils/bfd/doc/elf.texi b/contrib/binutils/bfd/doc/elf.texi deleted file mode 100644 index 4f9434cf69d4..000000000000 --- a/contrib/binutils/bfd/doc/elf.texi +++ /dev/null @@ -1,22 +0,0 @@ -@section ELF backends -BFD support for ELF formats is being worked on. -Currently, the best supported back ends are for sparc and i386 -(running svr4 or Solaris 2). - -Documentation of the internals of the support code still needs -to be written. The code is changing quickly enough that we -haven't bothered yet. - -@findex bfd_elf_find_section -@subsubsection @code{bfd_elf_find_section} -@strong{Synopsis} -@example -struct elf_internal_shdr *bfd_elf_find_section (bfd *abfd, char *name); -@end example -@strong{Description}@* -Helper functions for GDB to locate the string tables. -Since BFD hides string tables from callers, GDB needs to use an -internal hook to find them. Sun's .stabstr, in particular, -isn't even pointed to by the .stab section, so ordinary -mechanisms wouldn't work to find it, even if we had some. - diff --git a/contrib/binutils/bfd/doc/elfcode.texi b/contrib/binutils/bfd/doc/elfcode.texi deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/contrib/binutils/bfd/doc/elfcode.texi +++ /dev/null diff --git a/contrib/binutils/bfd/doc/format.texi b/contrib/binutils/bfd/doc/format.texi deleted file mode 100644 index 9674acff440b..000000000000 --- a/contrib/binutils/bfd/doc/format.texi +++ /dev/null @@ -1,112 +0,0 @@ -@section File formats -A format is a BFD concept of high level file contents type. The -formats supported by BFD are: - -@itemize @bullet - -@item -@code{bfd_object} -@end itemize -The BFD may contain data, symbols, relocations and debug info. - -@itemize @bullet - -@item -@code{bfd_archive} -@end itemize -The BFD contains other BFDs and an optional index. - -@itemize @bullet - -@item -@code{bfd_core} -@end itemize -The BFD contains the result of an executable core dump. - -@subsection File format functions - - -@findex bfd_check_format -@subsubsection @code{bfd_check_format} -@strong{Synopsis} -@example -bfd_boolean bfd_check_format (bfd *abfd, bfd_format format); -@end example -@strong{Description}@* -Verify if the file attached to the BFD @var{abfd} is compatible -with the format @var{format} (i.e., one of @code{bfd_object}, -@code{bfd_archive} or @code{bfd_core}). - -If the BFD has been set to a specific target before the -call, only the named target and format combination is -checked. If the target has not been set, or has been set to -@code{default}, then all the known target backends is -interrogated to determine a match. If the default target -matches, it is used. If not, exactly one target must recognize -the file, or an error results. - -The function returns @code{TRUE} on success, otherwise @code{FALSE} -with one of the following error codes: - -@itemize @bullet - -@item -@code{bfd_error_invalid_operation} - -if @code{format} is not one of @code{bfd_object}, @code{bfd_archive} or -@code{bfd_core}. - -@item -@code{bfd_error_system_call} - -if an error occured during a read - even some file mismatches -can cause bfd_error_system_calls. - -@item -@code{file_not_recognised} - -none of the backends recognised the file format. - -@item -@code{bfd_error_file_ambiguously_recognized} - -more than one backend recognised the file format. -@end itemize - -@findex bfd_check_format_matches -@subsubsection @code{bfd_check_format_matches} -@strong{Synopsis} -@example -bfd_boolean bfd_check_format_matches - (bfd *abfd, bfd_format format, char ***matching); -@end example -@strong{Description}@* -Like @code{bfd_check_format}, except when it returns FALSE with -@code{bfd_errno} set to @code{bfd_error_file_ambiguously_recognized}. In that -case, if @var{matching} is not NULL, it will be filled in with -a NULL-terminated list of the names of the formats that matched, -allocated with @code{malloc}. -Then the user may choose a format and try again. - -When done with the list that @var{matching} points to, the caller -should free it. - -@findex bfd_set_format -@subsubsection @code{bfd_set_format} -@strong{Synopsis} -@example -bfd_boolean bfd_set_format (bfd *abfd, bfd_format format); -@end example -@strong{Description}@* -This function sets the file format of the BFD @var{abfd} to the -format @var{format}. If the target set in the BFD does not -support the format requested, the format is invalid, or the BFD -is not open for writing, then an error occurs. - -@findex bfd_format_string -@subsubsection @code{bfd_format_string} -@strong{Synopsis} -@example -const char *bfd_format_string (bfd_format format); -@end example -@strong{Description}@* -Return a pointer to a const string -@code{invalid}, @code{object}, @code{archive}, @code{core}, or @code{unknown}, -depending upon the value of @var{format}. - diff --git a/contrib/binutils/bfd/doc/hash.texi b/contrib/binutils/bfd/doc/hash.texi deleted file mode 100644 index 88d9585cc405..000000000000 --- a/contrib/binutils/bfd/doc/hash.texi +++ /dev/null @@ -1,247 +0,0 @@ -@section Hash Tables -@cindex Hash tables -BFD provides a simple set of hash table functions. Routines -are provided to initialize a hash table, to free a hash table, -to look up a string in a hash table and optionally create an -entry for it, and to traverse a hash table. There is -currently no routine to delete an string from a hash table. - -The basic hash table does not permit any data to be stored -with a string. However, a hash table is designed to present a -base class from which other types of hash tables may be -derived. These derived types may store additional information -with the string. Hash tables were implemented in this way, -rather than simply providing a data pointer in a hash table -entry, because they were designed for use by the linker back -ends. The linker may create thousands of hash table entries, -and the overhead of allocating private data and storing and -following pointers becomes noticeable. - -The basic hash table code is in @code{hash.c}. - -@menu -* Creating and Freeing a Hash Table:: -* Looking Up or Entering a String:: -* Traversing a Hash Table:: -* Deriving a New Hash Table Type:: -@end menu - -@node Creating and Freeing a Hash Table, Looking Up or Entering a String, Hash Tables, Hash Tables -@subsection Creating and freeing a hash table -@findex bfd_hash_table_init -@findex bfd_hash_table_init_n -To create a hash table, create an instance of a @code{struct -bfd_hash_table} (defined in @code{bfd.h}) and call -@code{bfd_hash_table_init} (if you know approximately how many -entries you will need, the function @code{bfd_hash_table_init_n}, -which takes a @var{size} argument, may be used). -@code{bfd_hash_table_init} returns @code{FALSE} if some sort of -error occurs. - -@findex bfd_hash_newfunc -The function @code{bfd_hash_table_init} take as an argument a -function to use to create new entries. For a basic hash -table, use the function @code{bfd_hash_newfunc}. @xref{Deriving -a New Hash Table Type}, for why you would want to use a -different value for this argument. - -@findex bfd_hash_allocate -@code{bfd_hash_table_init} will create an objalloc which will be -used to allocate new entries. You may allocate memory on this -objalloc using @code{bfd_hash_allocate}. - -@findex bfd_hash_table_free -Use @code{bfd_hash_table_free} to free up all the memory that has -been allocated for a hash table. This will not free up the -@code{struct bfd_hash_table} itself, which you must provide. - -@findex bfd_hash_set_default_size -Use @code{bfd_hash_set_default_size} to set the default size of -hash table to use. - -@node Looking Up or Entering a String, Traversing a Hash Table, Creating and Freeing a Hash Table, Hash Tables -@subsection Looking up or entering a string -@findex bfd_hash_lookup -The function @code{bfd_hash_lookup} is used both to look up a -string in the hash table and to create a new entry. - -If the @var{create} argument is @code{FALSE}, @code{bfd_hash_lookup} -will look up a string. If the string is found, it will -returns a pointer to a @code{struct bfd_hash_entry}. If the -string is not found in the table @code{bfd_hash_lookup} will -return @code{NULL}. You should not modify any of the fields in -the returns @code{struct bfd_hash_entry}. - -If the @var{create} argument is @code{TRUE}, the string will be -entered into the hash table if it is not already there. -Either way a pointer to a @code{struct bfd_hash_entry} will be -returned, either to the existing structure or to a newly -created one. In this case, a @code{NULL} return means that an -error occurred. - -If the @var{create} argument is @code{TRUE}, and a new entry is -created, the @var{copy} argument is used to decide whether to -copy the string onto the hash table objalloc or not. If -@var{copy} is passed as @code{FALSE}, you must be careful not to -deallocate or modify the string as long as the hash table -exists. - -@node Traversing a Hash Table, Deriving a New Hash Table Type, Looking Up or Entering a String, Hash Tables -@subsection Traversing a hash table -@findex bfd_hash_traverse -The function @code{bfd_hash_traverse} may be used to traverse a -hash table, calling a function on each element. The traversal -is done in a random order. - -@code{bfd_hash_traverse} takes as arguments a function and a -generic @code{void *} pointer. The function is called with a -hash table entry (a @code{struct bfd_hash_entry *}) and the -generic pointer passed to @code{bfd_hash_traverse}. The function -must return a @code{boolean} value, which indicates whether to -continue traversing the hash table. If the function returns -@code{FALSE}, @code{bfd_hash_traverse} will stop the traversal and -return immediately. - -@node Deriving a New Hash Table Type, , Traversing a Hash Table, Hash Tables -@subsection Deriving a new hash table type -Many uses of hash tables want to store additional information -which each entry in the hash table. Some also find it -convenient to store additional information with the hash table -itself. This may be done using a derived hash table. - -Since C is not an object oriented language, creating a derived -hash table requires sticking together some boilerplate -routines with a few differences specific to the type of hash -table you want to create. - -An example of a derived hash table is the linker hash table. -The structures for this are defined in @code{bfdlink.h}. The -functions are in @code{linker.c}. - -You may also derive a hash table from an already derived hash -table. For example, the a.out linker backend code uses a hash -table derived from the linker hash table. - -@menu -* Define the Derived Structures:: -* Write the Derived Creation Routine:: -* Write Other Derived Routines:: -@end menu - -@node Define the Derived Structures, Write the Derived Creation Routine, Deriving a New Hash Table Type, Deriving a New Hash Table Type -@subsubsection Define the derived structures -You must define a structure for an entry in the hash table, -and a structure for the hash table itself. - -The first field in the structure for an entry in the hash -table must be of the type used for an entry in the hash table -you are deriving from. If you are deriving from a basic hash -table this is @code{struct bfd_hash_entry}, which is defined in -@code{bfd.h}. The first field in the structure for the hash -table itself must be of the type of the hash table you are -deriving from itself. If you are deriving from a basic hash -table, this is @code{struct bfd_hash_table}. - -For example, the linker hash table defines @code{struct -bfd_link_hash_entry} (in @code{bfdlink.h}). The first field, -@code{root}, is of type @code{struct bfd_hash_entry}. Similarly, -the first field in @code{struct bfd_link_hash_table}, @code{table}, -is of type @code{struct bfd_hash_table}. - -@node Write the Derived Creation Routine, Write Other Derived Routines, Define the Derived Structures, Deriving a New Hash Table Type -@subsubsection Write the derived creation routine -You must write a routine which will create and initialize an -entry in the hash table. This routine is passed as the -function argument to @code{bfd_hash_table_init}. - -In order to permit other hash tables to be derived from the -hash table you are creating, this routine must be written in a -standard way. - -The first argument to the creation routine is a pointer to a -hash table entry. This may be @code{NULL}, in which case the -routine should allocate the right amount of space. Otherwise -the space has already been allocated by a hash table type -derived from this one. - -After allocating space, the creation routine must call the -creation routine of the hash table type it is derived from, -passing in a pointer to the space it just allocated. This -will initialize any fields used by the base hash table. - -Finally the creation routine must initialize any local fields -for the new hash table type. - -Here is a boilerplate example of a creation routine. -@var{function_name} is the name of the routine. -@var{entry_type} is the type of an entry in the hash table you -are creating. @var{base_newfunc} is the name of the creation -routine of the hash table type your hash table is derived -from. - - -@example -struct bfd_hash_entry * -@var{function_name} (struct bfd_hash_entry *entry, - struct bfd_hash_table *table, - const char *string) -@{ - struct @var{entry_type} *ret = (@var{entry_type} *) entry; - - /* Allocate the structure if it has not already been allocated by a - derived class. */ - if (ret == NULL) - @{ - ret = bfd_hash_allocate (table, sizeof (* ret)); - if (ret == NULL) - return NULL; - @} - - /* Call the allocation method of the base class. */ - ret = ((@var{entry_type} *) - @var{base_newfunc} ((struct bfd_hash_entry *) ret, table, string)); - - /* Initialize the local fields here. */ - - return (struct bfd_hash_entry *) ret; -@} -@end example -@strong{Description}@* -The creation routine for the linker hash table, which is in -@code{linker.c}, looks just like this example. -@var{function_name} is @code{_bfd_link_hash_newfunc}. -@var{entry_type} is @code{struct bfd_link_hash_entry}. -@var{base_newfunc} is @code{bfd_hash_newfunc}, the creation -routine for a basic hash table. - -@code{_bfd_link_hash_newfunc} also initializes the local fields -in a linker hash table entry: @code{type}, @code{written} and -@code{next}. - -@node Write Other Derived Routines, , Write the Derived Creation Routine, Deriving a New Hash Table Type -@subsubsection Write other derived routines -You will want to write other routines for your new hash table, -as well. - -You will want an initialization routine which calls the -initialization routine of the hash table you are deriving from -and initializes any other local fields. For the linker hash -table, this is @code{_bfd_link_hash_table_init} in @code{linker.c}. - -You will want a lookup routine which calls the lookup routine -of the hash table you are deriving from and casts the result. -The linker hash table uses @code{bfd_link_hash_lookup} in -@code{linker.c} (this actually takes an additional argument which -it uses to decide how to return the looked up value). - -You may want a traversal routine. This should just call the -traversal routine of the hash table you are deriving from with -appropriate casts. The linker hash table uses -@code{bfd_link_hash_traverse} in @code{linker.c}. - -These routines may simply be defined as macros. For example, -the a.out backend linker hash table, which is derived from the -linker hash table, uses macros for the lookup and traversal -routines. These are @code{aout_link_hash_lookup} and -@code{aout_link_hash_traverse} in aoutx.h. - diff --git a/contrib/binutils/bfd/doc/init.texi b/contrib/binutils/bfd/doc/init.texi deleted file mode 100644 index ab735f8e986c..000000000000 --- a/contrib/binutils/bfd/doc/init.texi +++ /dev/null @@ -1,16 +0,0 @@ -@section Initialization - - -@subsection Initialization functions -These are the functions that handle initializing a BFD. - -@findex bfd_init -@subsubsection @code{bfd_init} -@strong{Synopsis} -@example -void bfd_init (void); -@end example -@strong{Description}@* -This routine must be called before any other BFD function to -initialize magical internal data structures. - diff --git a/contrib/binutils/bfd/doc/libbfd.texi b/contrib/binutils/bfd/doc/libbfd.texi deleted file mode 100644 index fef6e0e842ec..000000000000 --- a/contrib/binutils/bfd/doc/libbfd.texi +++ /dev/null @@ -1,179 +0,0 @@ -@section Implementation details - - -@subsection Internal functions - - -@strong{Description}@* -These routines are used within BFD. -They are not intended for export, but are documented here for -completeness. - -@findex bfd_write_bigendian_4byte_int -@subsubsection @code{bfd_write_bigendian_4byte_int} -@strong{Synopsis} -@example -bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int); -@end example -@strong{Description}@* -Write a 4 byte integer @var{i} to the output BFD @var{abfd}, in big -endian order regardless of what else is going on. This is useful in -archives. - -@findex bfd_put_size -@subsubsection @code{bfd_put_size} -@findex bfd_get_size -@subsubsection @code{bfd_get_size} -@strong{Description}@* -These macros as used for reading and writing raw data in -sections; each access (except for bytes) is vectored through -the target format of the BFD and mangled accordingly. The -mangling performs any necessary endian translations and -removes alignment restrictions. Note that types accepted and -returned by these macros are identical so they can be swapped -around in macros---for example, @file{libaout.h} defines @code{GET_WORD} -to either @code{bfd_get_32} or @code{bfd_get_64}. - -In the put routines, @var{val} must be a @code{bfd_vma}. If we are on a -system without prototypes, the caller is responsible for making -sure that is true, with a cast if necessary. We don't cast -them in the macro definitions because that would prevent @code{lint} -or @code{gcc -Wall} from detecting sins such as passing a pointer. -To detect calling these with less than a @code{bfd_vma}, use -@code{gcc -Wconversion} on a host with 64 bit @code{bfd_vma}'s. -@example - -/* Byte swapping macros for user section data. */ - -#define bfd_put_8(abfd, val, ptr) \ - ((void) (*((unsigned char *) (ptr)) = (val) & 0xff)) -#define bfd_put_signed_8 \ - bfd_put_8 -#define bfd_get_8(abfd, ptr) \ - (*(unsigned char *) (ptr) & 0xff) -#define bfd_get_signed_8(abfd, ptr) \ - (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80) - -#define bfd_put_16(abfd, val, ptr) \ - BFD_SEND (abfd, bfd_putx16, ((val),(ptr))) -#define bfd_put_signed_16 \ - bfd_put_16 -#define bfd_get_16(abfd, ptr) \ - BFD_SEND (abfd, bfd_getx16, (ptr)) -#define bfd_get_signed_16(abfd, ptr) \ - BFD_SEND (abfd, bfd_getx_signed_16, (ptr)) - -#define bfd_put_32(abfd, val, ptr) \ - BFD_SEND (abfd, bfd_putx32, ((val),(ptr))) -#define bfd_put_signed_32 \ - bfd_put_32 -#define bfd_get_32(abfd, ptr) \ - BFD_SEND (abfd, bfd_getx32, (ptr)) -#define bfd_get_signed_32(abfd, ptr) \ - BFD_SEND (abfd, bfd_getx_signed_32, (ptr)) - -#define bfd_put_64(abfd, val, ptr) \ - BFD_SEND (abfd, bfd_putx64, ((val), (ptr))) -#define bfd_put_signed_64 \ - bfd_put_64 -#define bfd_get_64(abfd, ptr) \ - BFD_SEND (abfd, bfd_getx64, (ptr)) -#define bfd_get_signed_64(abfd, ptr) \ - BFD_SEND (abfd, bfd_getx_signed_64, (ptr)) - -#define bfd_get(bits, abfd, ptr) \ - ((bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \ - : (bits) == 16 ? bfd_get_16 (abfd, ptr) \ - : (bits) == 32 ? bfd_get_32 (abfd, ptr) \ - : (bits) == 64 ? bfd_get_64 (abfd, ptr) \ - : (abort (), (bfd_vma) - 1)) - -#define bfd_put(bits, abfd, val, ptr) \ - ((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \ - : (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \ - : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \ - : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \ - : (abort (), (void) 0)) - -@end example - -@findex bfd_h_put_size -@subsubsection @code{bfd_h_put_size} -@strong{Description}@* -These macros have the same function as their @code{bfd_get_x} -brethren, except that they are used for removing information -for the header records of object files. Believe it or not, -some object files keep their header records in big endian -order and their data in little endian order. -@example - -/* Byte swapping macros for file header data. */ - -#define bfd_h_put_8(abfd, val, ptr) \ - bfd_put_8 (abfd, val, ptr) -#define bfd_h_put_signed_8(abfd, val, ptr) \ - bfd_put_8 (abfd, val, ptr) -#define bfd_h_get_8(abfd, ptr) \ - bfd_get_8 (abfd, ptr) -#define bfd_h_get_signed_8(abfd, ptr) \ - bfd_get_signed_8 (abfd, ptr) - -#define bfd_h_put_16(abfd, val, ptr) \ - BFD_SEND (abfd, bfd_h_putx16, (val, ptr)) -#define bfd_h_put_signed_16 \ - bfd_h_put_16 -#define bfd_h_get_16(abfd, ptr) \ - BFD_SEND (abfd, bfd_h_getx16, (ptr)) -#define bfd_h_get_signed_16(abfd, ptr) \ - BFD_SEND (abfd, bfd_h_getx_signed_16, (ptr)) - -#define bfd_h_put_32(abfd, val, ptr) \ - BFD_SEND (abfd, bfd_h_putx32, (val, ptr)) -#define bfd_h_put_signed_32 \ - bfd_h_put_32 -#define bfd_h_get_32(abfd, ptr) \ - BFD_SEND (abfd, bfd_h_getx32, (ptr)) -#define bfd_h_get_signed_32(abfd, ptr) \ - BFD_SEND (abfd, bfd_h_getx_signed_32, (ptr)) - -#define bfd_h_put_64(abfd, val, ptr) \ - BFD_SEND (abfd, bfd_h_putx64, (val, ptr)) -#define bfd_h_put_signed_64 \ - bfd_h_put_64 -#define bfd_h_get_64(abfd, ptr) \ - BFD_SEND (abfd, bfd_h_getx64, (ptr)) -#define bfd_h_get_signed_64(abfd, ptr) \ - BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr)) - -/* Aliases for the above, which should eventually go away. */ - -#define H_PUT_64 bfd_h_put_64 -#define H_PUT_32 bfd_h_put_32 -#define H_PUT_16 bfd_h_put_16 -#define H_PUT_8 bfd_h_put_8 -#define H_PUT_S64 bfd_h_put_signed_64 -#define H_PUT_S32 bfd_h_put_signed_32 -#define H_PUT_S16 bfd_h_put_signed_16 -#define H_PUT_S8 bfd_h_put_signed_8 -#define H_GET_64 bfd_h_get_64 -#define H_GET_32 bfd_h_get_32 -#define H_GET_16 bfd_h_get_16 -#define H_GET_8 bfd_h_get_8 -#define H_GET_S64 bfd_h_get_signed_64 -#define H_GET_S32 bfd_h_get_signed_32 -#define H_GET_S16 bfd_h_get_signed_16 -#define H_GET_S8 bfd_h_get_signed_8 - - -@end example - -@findex bfd_log2 -@subsubsection @code{bfd_log2} -@strong{Synopsis} -@example -unsigned int bfd_log2 (bfd_vma x); -@end example -@strong{Description}@* -Return the log base 2 of the value supplied, rounded up. E.g., an -@var{x} of 1025 returns 11. A @var{x} of 0 returns 0. - diff --git a/contrib/binutils/bfd/doc/linker.texi b/contrib/binutils/bfd/doc/linker.texi deleted file mode 100644 index 8a55006a187c..000000000000 --- a/contrib/binutils/bfd/doc/linker.texi +++ /dev/null @@ -1,380 +0,0 @@ -@section Linker Functions -@cindex Linker -The linker uses three special entry points in the BFD target -vector. It is not necessary to write special routines for -these entry points when creating a new BFD back end, since -generic versions are provided. However, writing them can -speed up linking and make it use significantly less runtime -memory. - -The first routine creates a hash table used by the other -routines. The second routine adds the symbols from an object -file to the hash table. The third routine takes all the -object files and links them together to create the output -file. These routines are designed so that the linker proper -does not need to know anything about the symbols in the object -files that it is linking. The linker merely arranges the -sections as directed by the linker script and lets BFD handle -the details of symbols and relocs. - -The second routine and third routines are passed a pointer to -a @code{struct bfd_link_info} structure (defined in -@code{bfdlink.h}) which holds information relevant to the link, -including the linker hash table (which was created by the -first routine) and a set of callback functions to the linker -proper. - -The generic linker routines are in @code{linker.c}, and use the -header file @code{genlink.h}. As of this writing, the only back -ends which have implemented versions of these routines are -a.out (in @code{aoutx.h}) and ECOFF (in @code{ecoff.c}). The a.out -routines are used as examples throughout this section. - -@menu -* Creating a Linker Hash Table:: -* Adding Symbols to the Hash Table:: -* Performing the Final Link:: -@end menu - -@node Creating a Linker Hash Table, Adding Symbols to the Hash Table, Linker Functions, Linker Functions -@subsection Creating a linker hash table -@cindex _bfd_link_hash_table_create in target vector -@cindex target vector (_bfd_link_hash_table_create) -The linker routines must create a hash table, which must be -derived from @code{struct bfd_link_hash_table} described in -@code{bfdlink.c}. @xref{Hash Tables}, for information on how to -create a derived hash table. This entry point is called using -the target vector of the linker output file. - -The @code{_bfd_link_hash_table_create} entry point must allocate -and initialize an instance of the desired hash table. If the -back end does not require any additional information to be -stored with the entries in the hash table, the entry point may -simply create a @code{struct bfd_link_hash_table}. Most likely, -however, some additional information will be needed. - -For example, with each entry in the hash table the a.out -linker keeps the index the symbol has in the final output file -(this index number is used so that when doing a relocatable -link the symbol index used in the output file can be quickly -filled in when copying over a reloc). The a.out linker code -defines the required structures and functions for a hash table -derived from @code{struct bfd_link_hash_table}. The a.out linker -hash table is created by the function -@code{NAME(aout,link_hash_table_create)}; it simply allocates -space for the hash table, initializes it, and returns a -pointer to it. - -When writing the linker routines for a new back end, you will -generally not know exactly which fields will be required until -you have finished. You should simply create a new hash table -which defines no additional fields, and then simply add fields -as they become necessary. - -@node Adding Symbols to the Hash Table, Performing the Final Link, Creating a Linker Hash Table, Linker Functions -@subsection Adding symbols to the hash table -@cindex _bfd_link_add_symbols in target vector -@cindex target vector (_bfd_link_add_symbols) -The linker proper will call the @code{_bfd_link_add_symbols} -entry point for each object file or archive which is to be -linked (typically these are the files named on the command -line, but some may also come from the linker script). The -entry point is responsible for examining the file. For an -object file, BFD must add any relevant symbol information to -the hash table. For an archive, BFD must determine which -elements of the archive should be used and adding them to the -link. - -The a.out version of this entry point is -@code{NAME(aout,link_add_symbols)}. - -@menu -* Differing file formats:: -* Adding symbols from an object file:: -* Adding symbols from an archive:: -@end menu - -@node Differing file formats, Adding symbols from an object file, Adding Symbols to the Hash Table, Adding Symbols to the Hash Table -@subsubsection Differing file formats -Normally all the files involved in a link will be of the same -format, but it is also possible to link together different -format object files, and the back end must support that. The -@code{_bfd_link_add_symbols} entry point is called via the target -vector of the file to be added. This has an important -consequence: the function may not assume that the hash table -is the type created by the corresponding -@code{_bfd_link_hash_table_create} vector. All the -@code{_bfd_link_add_symbols} function can assume about the hash -table is that it is derived from @code{struct -bfd_link_hash_table}. - -Sometimes the @code{_bfd_link_add_symbols} function must store -some information in the hash table entry to be used by the -@code{_bfd_final_link} function. In such a case the @code{creator} -field of the hash table must be checked to make sure that the -hash table was created by an object file of the same format. - -The @code{_bfd_final_link} routine must be prepared to handle a -hash entry without any extra information added by the -@code{_bfd_link_add_symbols} function. A hash entry without -extra information will also occur when the linker script -directs the linker to create a symbol. Note that, regardless -of how a hash table entry is added, all the fields will be -initialized to some sort of null value by the hash table entry -initialization function. - -See @code{ecoff_link_add_externals} for an example of how to -check the @code{creator} field before saving information (in this -case, the ECOFF external symbol debugging information) in a -hash table entry. - -@node Adding symbols from an object file, Adding symbols from an archive, Differing file formats, Adding Symbols to the Hash Table -@subsubsection Adding symbols from an object file -When the @code{_bfd_link_add_symbols} routine is passed an object -file, it must add all externally visible symbols in that -object file to the hash table. The actual work of adding the -symbol to the hash table is normally handled by the function -@code{_bfd_generic_link_add_one_symbol}. The -@code{_bfd_link_add_symbols} routine is responsible for reading -all the symbols from the object file and passing the correct -information to @code{_bfd_generic_link_add_one_symbol}. - -The @code{_bfd_link_add_symbols} routine should not use -@code{bfd_canonicalize_symtab} to read the symbols. The point of -providing this routine is to avoid the overhead of converting -the symbols into generic @code{asymbol} structures. - -@findex _bfd_generic_link_add_one_symbol -@code{_bfd_generic_link_add_one_symbol} handles the details of -combining common symbols, warning about multiple definitions, -and so forth. It takes arguments which describe the symbol to -add, notably symbol flags, a section, and an offset. The -symbol flags include such things as @code{BSF_WEAK} or -@code{BSF_INDIRECT}. The section is a section in the object -file, or something like @code{bfd_und_section_ptr} for an undefined -symbol or @code{bfd_com_section_ptr} for a common symbol. - -If the @code{_bfd_final_link} routine is also going to need to -read the symbol information, the @code{_bfd_link_add_symbols} -routine should save it somewhere attached to the object file -BFD. However, the information should only be saved if the -@code{keep_memory} field of the @code{info} argument is TRUE, so -that the @code{-no-keep-memory} linker switch is effective. - -The a.out function which adds symbols from an object file is -@code{aout_link_add_object_symbols}, and most of the interesting -work is in @code{aout_link_add_symbols}. The latter saves -pointers to the hash tables entries created by -@code{_bfd_generic_link_add_one_symbol} indexed by symbol number, -so that the @code{_bfd_final_link} routine does not have to call -the hash table lookup routine to locate the entry. - -@node Adding symbols from an archive, , Adding symbols from an object file, Adding Symbols to the Hash Table -@subsubsection Adding symbols from an archive -When the @code{_bfd_link_add_symbols} routine is passed an -archive, it must look through the symbols defined by the -archive and decide which elements of the archive should be -included in the link. For each such element it must call the -@code{add_archive_element} linker callback, and it must add the -symbols from the object file to the linker hash table. - -@findex _bfd_generic_link_add_archive_symbols -In most cases the work of looking through the symbols in the -archive should be done by the -@code{_bfd_generic_link_add_archive_symbols} function. This -function builds a hash table from the archive symbol table and -looks through the list of undefined symbols to see which -elements should be included. -@code{_bfd_generic_link_add_archive_symbols} is passed a function -to call to make the final decision about adding an archive -element to the link and to do the actual work of adding the -symbols to the linker hash table. - -The function passed to -@code{_bfd_generic_link_add_archive_symbols} must read the -symbols of the archive element and decide whether the archive -element should be included in the link. If the element is to -be included, the @code{add_archive_element} linker callback -routine must be called with the element as an argument, and -the elements symbols must be added to the linker hash table -just as though the element had itself been passed to the -@code{_bfd_link_add_symbols} function. - -When the a.out @code{_bfd_link_add_symbols} function receives an -archive, it calls @code{_bfd_generic_link_add_archive_symbols} -passing @code{aout_link_check_archive_element} as the function -argument. @code{aout_link_check_archive_element} calls -@code{aout_link_check_ar_symbols}. If the latter decides to add -the element (an element is only added if it provides a real, -non-common, definition for a previously undefined or common -symbol) it calls the @code{add_archive_element} callback and then -@code{aout_link_check_archive_element} calls -@code{aout_link_add_symbols} to actually add the symbols to the -linker hash table. - -The ECOFF back end is unusual in that it does not normally -call @code{_bfd_generic_link_add_archive_symbols}, because ECOFF -archives already contain a hash table of symbols. The ECOFF -back end searches the archive itself to avoid the overhead of -creating a new hash table. - -@node Performing the Final Link, , Adding Symbols to the Hash Table, Linker Functions -@subsection Performing the final link -@cindex _bfd_link_final_link in target vector -@cindex target vector (_bfd_final_link) -When all the input files have been processed, the linker calls -the @code{_bfd_final_link} entry point of the output BFD. This -routine is responsible for producing the final output file, -which has several aspects. It must relocate the contents of -the input sections and copy the data into the output sections. -It must build an output symbol table including any local -symbols from the input files and the global symbols from the -hash table. When producing relocatable output, it must -modify the input relocs and write them into the output file. -There may also be object format dependent work to be done. - -The linker will also call the @code{write_object_contents} entry -point when the BFD is closed. The two entry points must work -together in order to produce the correct output file. - -The details of how this works are inevitably dependent upon -the specific object file format. The a.out -@code{_bfd_final_link} routine is @code{NAME(aout,final_link)}. - -@menu -* Information provided by the linker:: -* Relocating the section contents:: -* Writing the symbol table:: -@end menu - -@node Information provided by the linker, Relocating the section contents, Performing the Final Link, Performing the Final Link -@subsubsection Information provided by the linker -Before the linker calls the @code{_bfd_final_link} entry point, -it sets up some data structures for the function to use. - -The @code{input_bfds} field of the @code{bfd_link_info} structure -will point to a list of all the input files included in the -link. These files are linked through the @code{link_next} field -of the @code{bfd} structure. - -Each section in the output file will have a list of -@code{link_order} structures attached to the @code{map_head.link_order} -field (the @code{link_order} structure is defined in -@code{bfdlink.h}). These structures describe how to create the -contents of the output section in terms of the contents of -various input sections, fill constants, and, eventually, other -types of information. They also describe relocs that must be -created by the BFD backend, but do not correspond to any input -file; this is used to support -Ur, which builds constructors -while generating a relocatable object file. - -@node Relocating the section contents, Writing the symbol table, Information provided by the linker, Performing the Final Link -@subsubsection Relocating the section contents -The @code{_bfd_final_link} function should look through the -@code{link_order} structures attached to each section of the -output file. Each @code{link_order} structure should either be -handled specially, or it should be passed to the function -@code{_bfd_default_link_order} which will do the right thing -(@code{_bfd_default_link_order} is defined in @code{linker.c}). - -For efficiency, a @code{link_order} of type -@code{bfd_indirect_link_order} whose associated section belongs -to a BFD of the same format as the output BFD must be handled -specially. This type of @code{link_order} describes part of an -output section in terms of a section belonging to one of the -input files. The @code{_bfd_final_link} function should read the -contents of the section and any associated relocs, apply the -relocs to the section contents, and write out the modified -section contents. If performing a relocatable link, the -relocs themselves must also be modified and written out. - -@findex _bfd_relocate_contents -@findex _bfd_final_link_relocate -The functions @code{_bfd_relocate_contents} and -@code{_bfd_final_link_relocate} provide some general support for -performing the actual relocations, notably overflow checking. -Their arguments include information about the symbol the -relocation is against and a @code{reloc_howto_type} argument -which describes the relocation to perform. These functions -are defined in @code{reloc.c}. - -The a.out function which handles reading, relocating, and -writing section contents is @code{aout_link_input_section}. The -actual relocation is done in @code{aout_link_input_section_std} -and @code{aout_link_input_section_ext}. - -@node Writing the symbol table, , Relocating the section contents, Performing the Final Link -@subsubsection Writing the symbol table -The @code{_bfd_final_link} function must gather all the symbols -in the input files and write them out. It must also write out -all the symbols in the global hash table. This must be -controlled by the @code{strip} and @code{discard} fields of the -@code{bfd_link_info} structure. - -The local symbols of the input files will not have been -entered into the linker hash table. The @code{_bfd_final_link} -routine must consider each input file and include the symbols -in the output file. It may be convenient to do this when -looking through the @code{link_order} structures, or it may be -done by stepping through the @code{input_bfds} list. - -The @code{_bfd_final_link} routine must also traverse the global -hash table to gather all the externally visible symbols. It -is possible that most of the externally visible symbols may be -written out when considering the symbols of each input file, -but it is still necessary to traverse the hash table since the -linker script may have defined some symbols that are not in -any of the input files. - -The @code{strip} field of the @code{bfd_link_info} structure -controls which symbols are written out. The possible values -are listed in @code{bfdlink.h}. If the value is @code{strip_some}, -then the @code{keep_hash} field of the @code{bfd_link_info} -structure is a hash table of symbols to keep; each symbol -should be looked up in this hash table, and only symbols which -are present should be included in the output file. - -If the @code{strip} field of the @code{bfd_link_info} structure -permits local symbols to be written out, the @code{discard} field -is used to further controls which local symbols are included -in the output file. If the value is @code{discard_l}, then all -local symbols which begin with a certain prefix are discarded; -this is controlled by the @code{bfd_is_local_label_name} entry point. - -The a.out backend handles symbols by calling -@code{aout_link_write_symbols} on each input BFD and then -traversing the global hash table with the function -@code{aout_link_write_other_symbol}. It builds a string table -while writing out the symbols, which is written to the output -file at the end of @code{NAME(aout,final_link)}. - -@findex bfd_link_split_section -@subsubsection @code{bfd_link_split_section} -@strong{Synopsis} -@example -bfd_boolean bfd_link_split_section (bfd *abfd, asection *sec); -@end example -@strong{Description}@* -Return nonzero if @var{sec} should be split during a -reloceatable or final link. -@example -#define bfd_link_split_section(abfd, sec) \ - BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec)) - -@end example - -@findex bfd_section_already_linked -@subsubsection @code{bfd_section_already_linked} -@strong{Synopsis} -@example -void bfd_section_already_linked (bfd *abfd, asection *sec); -@end example -@strong{Description}@* -Check if @var{sec} has been already linked during a reloceatable -or final link. -@example -#define bfd_section_already_linked(abfd, sec) \ - BFD_SEND (abfd, _section_already_linked, (abfd, sec)) - -@end example - diff --git a/contrib/binutils/bfd/doc/mmo.texi b/contrib/binutils/bfd/doc/mmo.texi deleted file mode 100644 index b0d726aad9c1..000000000000 --- a/contrib/binutils/bfd/doc/mmo.texi +++ /dev/null @@ -1,365 +0,0 @@ -@section mmo backend -The mmo object format is used exclusively together with Professor -Donald E.@: Knuth's educational 64-bit processor MMIX. The simulator -@command{mmix} which is available at -@url{http://www-cs-faculty.stanford.edu/~knuth/programs/mmix.tar.gz} -understands this format. That package also includes a combined -assembler and linker called @command{mmixal}. The mmo format has -no advantages feature-wise compared to e.g. ELF. It is a simple -non-relocatable object format with no support for archives or -debugging information, except for symbol value information and -line numbers (which is not yet implemented in BFD). See -@url{http://www-cs-faculty.stanford.edu/~knuth/mmix.html} for more -information about MMIX. The ELF format is used for intermediate -object files in the BFD implementation. - -@c We want to xref the symbol table node. A feature in "chew" -@c requires that "commands" do not contain spaces in the -@c arguments. Hence the hyphen in "Symbol-table". -@menu -* File layout:: -* Symbol-table:: -* mmo section mapping:: -@end menu - -@node File layout, Symbol-table, mmo, mmo -@subsection File layout -The mmo file contents is not partitioned into named sections as -with e.g.@: ELF. Memory areas is formed by specifying the -location of the data that follows. Only the memory area -@samp{0x0000@dots{}00} to @samp{0x01ff@dots{}ff} is executable, so -it is used for code (and constants) and the area -@samp{0x2000@dots{}00} to @samp{0x20ff@dots{}ff} is used for -writable data. @xref{mmo section mapping}. - -There is provision for specifying ``special data'' of 65536 -different types. We use type 80 (decimal), arbitrarily chosen the -same as the ELF @code{e_machine} number for MMIX, filling it with -section information normally found in ELF objects. @xref{mmo -section mapping}. - -Contents is entered as 32-bit words, xor:ed over previous -contents, always zero-initialized. A word that starts with the -byte @samp{0x98} forms a command called a @samp{lopcode}, where -the next byte distinguished between the thirteen lopcodes. The -two remaining bytes, called the @samp{Y} and @samp{Z} fields, or -the @samp{YZ} field (a 16-bit big-endian number), are used for -various purposes different for each lopcode. As documented in -@url{http://www-cs-faculty.stanford.edu/~knuth/mmixal-intro.ps.gz}, -the lopcodes are: - -@table @code -@item lop_quote -0x98000001. The next word is contents, regardless of whether it -starts with 0x98 or not. - -@item lop_loc -0x9801YYZZ, where @samp{Z} is 1 or 2. This is a location -directive, setting the location for the next data to the next -32-bit word (for @math{Z = 1}) or 64-bit word (for @math{Z = 2}), -plus @math{Y * 2^56}. Normally @samp{Y} is 0 for the text segment -and 2 for the data segment. - -@item lop_skip -0x9802YYZZ. Increase the current location by @samp{YZ} bytes. - -@item lop_fixo -0x9803YYZZ, where @samp{Z} is 1 or 2. Store the current location -as 64 bits into the location pointed to by the next 32-bit -(@math{Z = 1}) or 64-bit (@math{Z = 2}) word, plus @math{Y * -2^56}. - -@item lop_fixr -0x9804YYZZ. @samp{YZ} is stored into the current location plus -@math{2 - 4 * YZ}. - -@item lop_fixrx -0x980500ZZ. @samp{Z} is 16 or 24. A value @samp{L} derived from -the following 32-bit word are used in a manner similar to -@samp{YZ} in lop_fixr: it is xor:ed into the current location -minus @math{4 * L}. The first byte of the word is 0 or 1. If it -is 1, then @math{L = (@var{lowest 24 bits of word}) - 2^Z}, if 0, -then @math{L = (@var{lowest 24 bits of word})}. - -@item lop_file -0x9806YYZZ. @samp{Y} is the file number, @samp{Z} is count of -32-bit words. Set the file number to @samp{Y} and the line -counter to 0. The next @math{Z * 4} bytes contain the file name, -padded with zeros if the count is not a multiple of four. The -same @samp{Y} may occur multiple times, but @samp{Z} must be 0 for -all but the first occurrence. - -@item lop_line -0x9807YYZZ. @samp{YZ} is the line number. Together with -lop_file, it forms the source location for the next 32-bit word. -Note that for each non-lopcode 32-bit word, line numbers are -assumed incremented by one. - -@item lop_spec -0x9808YYZZ. @samp{YZ} is the type number. Data until the next -lopcode other than lop_quote forms special data of type @samp{YZ}. -@xref{mmo section mapping}. - -Other types than 80, (or type 80 with a content that does not -parse) is stored in sections named @code{.MMIX.spec_data.@var{n}} -where @var{n} is the @samp{YZ}-type. The flags for such a -sections say not to allocate or load the data. The vma is 0. -Contents of multiple occurrences of special data @var{n} is -concatenated to the data of the previous lop_spec @var{n}s. The -location in data or code at which the lop_spec occurred is lost. - -@item lop_pre -0x980901ZZ. The first lopcode in a file. The @samp{Z} field forms the -length of header information in 32-bit words, where the first word -tells the time in seconds since @samp{00:00:00 GMT Jan 1 1970}. - -@item lop_post -0x980a00ZZ. @math{Z > 32}. This lopcode follows after all -content-generating lopcodes in a program. The @samp{Z} field -denotes the value of @samp{rG} at the beginning of the program. -The following @math{256 - Z} big-endian 64-bit words are loaded -into global registers @samp{$G} @dots{} @samp{$255}. - -@item lop_stab -0x980b0000. The next-to-last lopcode in a program. Must follow -immediately after the lop_post lopcode and its data. After this -lopcode follows all symbols in a compressed format -(@pxref{Symbol-table}). - -@item lop_end -0x980cYYZZ. The last lopcode in a program. It must follow the -lop_stab lopcode and its data. The @samp{YZ} field contains the -number of 32-bit words of symbol table information after the -preceding lop_stab lopcode. -@end table - -Note that the lopcode "fixups"; @code{lop_fixr}, @code{lop_fixrx} and -@code{lop_fixo} are not generated by BFD, but are handled. They are -generated by @code{mmixal}. - -This trivial one-label, one-instruction file: - -@example - :Main TRAP 1,2,3 -@end example - -can be represented this way in mmo: - -@example - 0x98090101 - lop_pre, one 32-bit word with timestamp. - <timestamp> - 0x98010002 - lop_loc, text segment, using a 64-bit address. - Note that mmixal does not emit this for the file above. - 0x00000000 - Address, high 32 bits. - 0x00000000 - Address, low 32 bits. - 0x98060002 - lop_file, 2 32-bit words for file-name. - 0x74657374 - "test" - 0x2e730000 - ".s\0\0" - 0x98070001 - lop_line, line 1. - 0x00010203 - TRAP 1,2,3 - 0x980a00ff - lop_post, setting $255 to 0. - 0x00000000 - 0x00000000 - 0x980b0000 - lop_stab for ":Main" = 0, serial 1. - 0x203a4040 @xref{Symbol-table}. - 0x10404020 - 0x4d206120 - 0x69016e00 - 0x81000000 - 0x980c0005 - lop_end; symbol table contained five 32-bit words. -@end example -@node Symbol-table, mmo section mapping, File layout, mmo -@subsection Symbol table format -From mmixal.w (or really, the generated mmixal.tex) in -@url{http://www-cs-faculty.stanford.edu/~knuth/programs/mmix.tar.gz}): -``Symbols are stored and retrieved by means of a @samp{ternary -search trie}, following ideas of Bentley and Sedgewick. (See -ACM--SIAM Symp.@: on Discrete Algorithms @samp{8} (1997), 360--369; -R.@:Sedgewick, @samp{Algorithms in C} (Reading, Mass.@: -Addison--Wesley, 1998), @samp{15.4}.) Each trie node stores a -character, and there are branches to subtries for the cases where -a given character is less than, equal to, or greater than the -character in the trie. There also is a pointer to a symbol table -entry if a symbol ends at the current node.'' - -So it's a tree encoded as a stream of bytes. The stream of bytes -acts on a single virtual global symbol, adding and removing -characters and signalling complete symbol points. Here, we read -the stream and create symbols at the completion points. - -First, there's a control byte @code{m}. If any of the listed bits -in @code{m} is nonzero, we execute what stands at the right, in -the listed order: - -@example - (MMO3_LEFT) - 0x40 - Traverse left trie. - (Read a new command byte and recurse.) - - (MMO3_SYMBITS) - 0x2f - Read the next byte as a character and store it in the - current character position; increment character position. - Test the bits of @code{m}: - - (MMO3_WCHAR) - 0x80 - The character is 16-bit (so read another byte, - merge into current character. - - (MMO3_TYPEBITS) - 0xf - We have a complete symbol; parse the type, value - and serial number and do what should be done - with a symbol. The type and length information - is in j = (m & 0xf). - - (MMO3_REGQUAL_BITS) - j == 0xf: A register variable. The following - byte tells which register. - j <= 8: An absolute symbol. Read j bytes as the - big-endian number the symbol equals. - A j = 2 with two zero bytes denotes an - unknown symbol. - j > 8: As with j <= 8, but add (0x20 << 56) - to the value in the following j - 8 - bytes. - - Then comes the serial number, as a variant of - uleb128, but better named ubeb128: - Read bytes and shift the previous value left 7 - (multiply by 128). Add in the new byte, repeat - until a byte has bit 7 set. The serial number - is the computed value minus 128. - - (MMO3_MIDDLE) - 0x20 - Traverse middle trie. (Read a new command byte - and recurse.) Decrement character position. - - (MMO3_RIGHT) - 0x10 - Traverse right trie. (Read a new command byte and - recurse.) -@end example - -Let's look again at the @code{lop_stab} for the trivial file -(@pxref{File layout}). - -@example - 0x980b0000 - lop_stab for ":Main" = 0, serial 1. - 0x203a4040 - 0x10404020 - 0x4d206120 - 0x69016e00 - 0x81000000 -@end example - -This forms the trivial trie (note that the path between ``:'' and -``M'' is redundant): - -@example - 203a ":" - 40 / - 40 / - 10 \ - 40 / - 40 / - 204d "M" - 2061 "a" - 2069 "i" - 016e "n" is the last character in a full symbol, and - with a value represented in one byte. - 00 The value is 0. - 81 The serial number is 1. -@end example - -@node mmo section mapping, , Symbol-table, mmo -@subsection mmo section mapping -The implementation in BFD uses special data type 80 (decimal) to -encapsulate and describe named sections, containing e.g.@: debug -information. If needed, any datum in the encapsulation will be -quoted using lop_quote. First comes a 32-bit word holding the -number of 32-bit words containing the zero-terminated zero-padded -segment name. After the name there's a 32-bit word holding flags -describing the section type. Then comes a 64-bit big-endian word -with the section length (in bytes), then another with the section -start address. Depending on the type of section, the contents -might follow, zero-padded to 32-bit boundary. For a loadable -section (such as data or code), the contents might follow at some -later point, not necessarily immediately, as a lop_loc with the -same start address as in the section description, followed by the -contents. This in effect forms a descriptor that must be emitted -before the actual contents. Sections described this way must not -overlap. - -For areas that don't have such descriptors, synthetic sections are -formed by BFD. Consecutive contents in the two memory areas -@samp{0x0000@dots{}00} to @samp{0x01ff@dots{}ff} and -@samp{0x2000@dots{}00} to @samp{0x20ff@dots{}ff} are entered in -sections named @code{.text} and @code{.data} respectively. If an area -is not otherwise described, but would together with a neighboring -lower area be less than @samp{0x40000000} bytes long, it is joined -with the lower area and the gap is zero-filled. For other cases, -a new section is formed, named @code{.MMIX.sec.@var{n}}. Here, -@var{n} is a number, a running count through the mmo file, -starting at 0. - -A loadable section specified as: - -@example - .section secname,"ax" - TETRA 1,2,3,4,-1,-2009 - BYTE 80 -@end example - -and linked to address @samp{0x4}, is represented by the sequence: - -@example - 0x98080050 - lop_spec 80 - 0x00000002 - two 32-bit words for the section name - 0x7365636e - "secn" - 0x616d6500 - "ame\0" - 0x00000033 - flags CODE, READONLY, LOAD, ALLOC - 0x00000000 - high 32 bits of section length - 0x0000001c - section length is 28 bytes; 6 * 4 + 1 + alignment to 32 bits - 0x00000000 - high 32 bits of section address - 0x00000004 - section address is 4 - 0x98010002 - 64 bits with address of following data - 0x00000000 - high 32 bits of address - 0x00000004 - low 32 bits: data starts at address 4 - 0x00000001 - 1 - 0x00000002 - 2 - 0x00000003 - 3 - 0x00000004 - 4 - 0xffffffff - -1 - 0xfffff827 - -2009 - 0x50000000 - 80 as a byte, padded with zeros. -@end example - -Note that the lop_spec wrapping does not include the section -contents. Compare this to a non-loaded section specified as: - -@example - .section thirdsec - TETRA 200001,100002 - BYTE 38,40 -@end example - -This, when linked to address @samp{0x200000000000001c}, is -represented by: - -@example - 0x98080050 - lop_spec 80 - 0x00000002 - two 32-bit words for the section name - 0x7365636e - "thir" - 0x616d6500 - "dsec" - 0x00000010 - flag READONLY - 0x00000000 - high 32 bits of section length - 0x0000000c - section length is 12 bytes; 2 * 4 + 2 + alignment to 32 bits - 0x20000000 - high 32 bits of address - 0x0000001c - low 32 bits of address 0x200000000000001c - 0x00030d41 - 200001 - 0x000186a2 - 100002 - 0x26280000 - 38, 40 as bytes, padded with zeros -@end example - -For the latter example, the section contents must not be -loaded in memory, and is therefore specified as part of the -special data. The address is usually unimportant but might -provide information for e.g.@: the DWARF 2 debugging format. diff --git a/contrib/binutils/bfd/doc/opncls.texi b/contrib/binutils/bfd/doc/opncls.texi deleted file mode 100644 index 6b47adfbb45d..000000000000 --- a/contrib/binutils/bfd/doc/opncls.texi +++ /dev/null @@ -1,365 +0,0 @@ -@section Opening and closing BFDs - - -@subsection Functions for opening and closing - - -@findex bfd_fopen -@subsubsection @code{bfd_fopen} -@strong{Synopsis} -@example -bfd *bfd_fopen (const char *filename, const char *target, - const char *mode, int fd); -@end example -@strong{Description}@* -Open the file @var{filename} with the target @var{target}. -Return a pointer to the created BFD. If @var{fd} is not -1, -then @code{fdopen} is used to open the file; otherwise, @code{fopen} -is used. @var{mode} is passed directly to @code{fopen} or -@code{fdopen}. - -Calls @code{bfd_find_target}, so @var{target} is interpreted as by -that function. - -The new BFD is marked as cacheable iff @var{fd} is -1. - -If @code{NULL} is returned then an error has occured. Possible errors -are @code{bfd_error_no_memory}, @code{bfd_error_invalid_target} or -@code{system_call} error. - -@findex bfd_openr -@subsubsection @code{bfd_openr} -@strong{Synopsis} -@example -bfd *bfd_openr (const char *filename, const char *target); -@end example -@strong{Description}@* -Open the file @var{filename} (using @code{fopen}) with the target -@var{target}. Return a pointer to the created BFD. - -Calls @code{bfd_find_target}, so @var{target} is interpreted as by -that function. - -If @code{NULL} is returned then an error has occured. Possible errors -are @code{bfd_error_no_memory}, @code{bfd_error_invalid_target} or -@code{system_call} error. - -@findex bfd_fdopenr -@subsubsection @code{bfd_fdopenr} -@strong{Synopsis} -@example -bfd *bfd_fdopenr (const char *filename, const char *target, int fd); -@end example -@strong{Description}@* -@code{bfd_fdopenr} is to @code{bfd_fopenr} much like @code{fdopen} is to -@code{fopen}. It opens a BFD on a file already described by the -@var{fd} supplied. - -When the file is later @code{bfd_close}d, the file descriptor will -be closed. If the caller desires that this file descriptor be -cached by BFD (opened as needed, closed as needed to free -descriptors for other opens), with the supplied @var{fd} used as -an initial file descriptor (but subject to closure at any time), -call bfd_set_cacheable(bfd, 1) on the returned BFD. The default -is to assume no caching; the file descriptor will remain open -until @code{bfd_close}, and will not be affected by BFD operations -on other files. - -Possible errors are @code{bfd_error_no_memory}, -@code{bfd_error_invalid_target} and @code{bfd_error_system_call}. - -@findex bfd_openstreamr -@subsubsection @code{bfd_openstreamr} -@strong{Synopsis} -@example -bfd *bfd_openstreamr (const char *, const char *, void *); -@end example -@strong{Description}@* -Open a BFD for read access on an existing stdio stream. When -the BFD is passed to @code{bfd_close}, the stream will be closed. - -@findex bfd_openr_iovec -@subsubsection @code{bfd_openr_iovec} -@strong{Synopsis} -@example -bfd *bfd_openr_iovec (const char *filename, const char *target, - void *(*open) (struct bfd *nbfd, - void *open_closure), - void *open_closure, - file_ptr (*pread) (struct bfd *nbfd, - void *stream, - void *buf, - file_ptr nbytes, - file_ptr offset), - int (*close) (struct bfd *nbfd, - void *stream)); -@end example -@strong{Description}@* -Create and return a BFD backed by a read-only @var{stream}. -The @var{stream} is created using @var{open}, accessed using -@var{pread} and destroyed using @var{close}. - -Calls @code{bfd_find_target}, so @var{target} is interpreted as by -that function. - -Calls @var{open} (which can call @code{bfd_zalloc} and -@code{bfd_get_filename}) to obtain the read-only stream backing -the BFD. @var{open} either succeeds returning the -non-@code{NULL} @var{stream}, or fails returning @code{NULL} -(setting @code{bfd_error}). - -Calls @var{pread} to request @var{nbytes} of data from -@var{stream} starting at @var{offset} (e.g., via a call to -@code{bfd_read}). @var{pread} either succeeds returning the -number of bytes read (which can be less than @var{nbytes} when -end-of-file), or fails returning -1 (setting @code{bfd_error}). - -Calls @var{close} when the BFD is later closed using -@code{bfd_close}. @var{close} either succeeds returning 0, or -fails returning -1 (setting @code{bfd_error}). - -If @code{bfd_openr_iovec} returns @code{NULL} then an error has -occurred. Possible errors are @code{bfd_error_no_memory}, -@code{bfd_error_invalid_target} and @code{bfd_error_system_call}. - -@findex bfd_openw -@subsubsection @code{bfd_openw} -@strong{Synopsis} -@example -bfd *bfd_openw (const char *filename, const char *target); -@end example -@strong{Description}@* -Create a BFD, associated with file @var{filename}, using the -file format @var{target}, and return a pointer to it. - -Possible errors are @code{bfd_error_system_call}, @code{bfd_error_no_memory}, -@code{bfd_error_invalid_target}. - -@findex bfd_close -@subsubsection @code{bfd_close} -@strong{Synopsis} -@example -bfd_boolean bfd_close (bfd *abfd); -@end example -@strong{Description}@* -Close a BFD. If the BFD was open for writing, then pending -operations are completed and the file written out and closed. -If the created file is executable, then @code{chmod} is called -to mark it as such. - -All memory attached to the BFD is released. - -The file descriptor associated with the BFD is closed (even -if it was passed in to BFD by @code{bfd_fdopenr}). - -@strong{Returns}@* -@code{TRUE} is returned if all is ok, otherwise @code{FALSE}. - -@findex bfd_close_all_done -@subsubsection @code{bfd_close_all_done} -@strong{Synopsis} -@example -bfd_boolean bfd_close_all_done (bfd *); -@end example -@strong{Description}@* -Close a BFD. Differs from @code{bfd_close} since it does not -complete any pending operations. This routine would be used -if the application had just used BFD for swapping and didn't -want to use any of the writing code. - -If the created file is executable, then @code{chmod} is called -to mark it as such. - -All memory attached to the BFD is released. - -@strong{Returns}@* -@code{TRUE} is returned if all is ok, otherwise @code{FALSE}. - -@findex bfd_create -@subsubsection @code{bfd_create} -@strong{Synopsis} -@example -bfd *bfd_create (const char *filename, bfd *templ); -@end example -@strong{Description}@* -Create a new BFD in the manner of @code{bfd_openw}, but without -opening a file. The new BFD takes the target from the target -used by @var{template}. The format is always set to @code{bfd_object}. - -@findex bfd_make_writable -@subsubsection @code{bfd_make_writable} -@strong{Synopsis} -@example -bfd_boolean bfd_make_writable (bfd *abfd); -@end example -@strong{Description}@* -Takes a BFD as created by @code{bfd_create} and converts it -into one like as returned by @code{bfd_openw}. It does this -by converting the BFD to BFD_IN_MEMORY. It's assumed that -you will call @code{bfd_make_readable} on this bfd later. - -@strong{Returns}@* -@code{TRUE} is returned if all is ok, otherwise @code{FALSE}. - -@findex bfd_make_readable -@subsubsection @code{bfd_make_readable} -@strong{Synopsis} -@example -bfd_boolean bfd_make_readable (bfd *abfd); -@end example -@strong{Description}@* -Takes a BFD as created by @code{bfd_create} and -@code{bfd_make_writable} and converts it into one like as -returned by @code{bfd_openr}. It does this by writing the -contents out to the memory buffer, then reversing the -direction. - -@strong{Returns}@* -@code{TRUE} is returned if all is ok, otherwise @code{FALSE}. - -@findex bfd_alloc -@subsubsection @code{bfd_alloc} -@strong{Synopsis} -@example -void *bfd_alloc (bfd *abfd, bfd_size_type wanted); -@end example -@strong{Description}@* -Allocate a block of @var{wanted} bytes of memory attached to -@code{abfd} and return a pointer to it. - -@findex bfd_alloc2 -@subsubsection @code{bfd_alloc2} -@strong{Synopsis} -@example -void *bfd_alloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size); -@end example -@strong{Description}@* -Allocate a block of @var{nmemb} elements of @var{size} bytes each -of memory attached to @code{abfd} and return a pointer to it. - -@findex bfd_zalloc -@subsubsection @code{bfd_zalloc} -@strong{Synopsis} -@example -void *bfd_zalloc (bfd *abfd, bfd_size_type wanted); -@end example -@strong{Description}@* -Allocate a block of @var{wanted} bytes of zeroed memory -attached to @code{abfd} and return a pointer to it. - -@findex bfd_zalloc2 -@subsubsection @code{bfd_zalloc2} -@strong{Synopsis} -@example -void *bfd_zalloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size); -@end example -@strong{Description}@* -Allocate a block of @var{nmemb} elements of @var{size} bytes each -of zeroed memory attached to @code{abfd} and return a pointer to it. - -@findex bfd_calc_gnu_debuglink_crc32 -@subsubsection @code{bfd_calc_gnu_debuglink_crc32} -@strong{Synopsis} -@example -unsigned long bfd_calc_gnu_debuglink_crc32 - (unsigned long crc, const unsigned char *buf, bfd_size_type len); -@end example -@strong{Description}@* -Computes a CRC value as used in the .gnu_debuglink section. -Advances the previously computed @var{crc} value by computing -and adding in the crc32 for @var{len} bytes of @var{buf}. - -@strong{Returns}@* -Return the updated CRC32 value. - -@findex get_debug_link_info -@subsubsection @code{get_debug_link_info} -@strong{Synopsis} -@example -char *get_debug_link_info (bfd *abfd, unsigned long *crc32_out); -@end example -@strong{Description}@* -fetch the filename and CRC32 value for any separate debuginfo -associated with @var{abfd}. Return NULL if no such info found, -otherwise return filename and update @var{crc32_out}. - -@findex separate_debug_file_exists -@subsubsection @code{separate_debug_file_exists} -@strong{Synopsis} -@example -bfd_boolean separate_debug_file_exists - (char *name, unsigned long crc32); -@end example -@strong{Description}@* -Checks to see if @var{name} is a file and if its contents -match @var{crc32}. - -@findex find_separate_debug_file -@subsubsection @code{find_separate_debug_file} -@strong{Synopsis} -@example -char *find_separate_debug_file (bfd *abfd); -@end example -@strong{Description}@* -Searches @var{abfd} for a reference to separate debugging -information, scans various locations in the filesystem, including -the file tree rooted at @var{debug_file_directory}, and returns a -filename of such debugging information if the file is found and has -matching CRC32. Returns NULL if no reference to debugging file -exists, or file cannot be found. - -@findex bfd_follow_gnu_debuglink -@subsubsection @code{bfd_follow_gnu_debuglink} -@strong{Synopsis} -@example -char *bfd_follow_gnu_debuglink (bfd *abfd, const char *dir); -@end example -@strong{Description}@* -Takes a BFD and searches it for a .gnu_debuglink section. If this -section is found, it examines the section for the name and checksum -of a '.debug' file containing auxiliary debugging information. It -then searches the filesystem for this .debug file in some standard -locations, including the directory tree rooted at @var{dir}, and if -found returns the full filename. - -If @var{dir} is NULL, it will search a default path configured into -libbfd at build time. [XXX this feature is not currently -implemented]. - -@strong{Returns}@* -@code{NULL} on any errors or failure to locate the .debug file, -otherwise a pointer to a heap-allocated string containing the -filename. The caller is responsible for freeing this string. - -@findex bfd_create_gnu_debuglink_section -@subsubsection @code{bfd_create_gnu_debuglink_section} -@strong{Synopsis} -@example -struct bfd_section *bfd_create_gnu_debuglink_section - (bfd *abfd, const char *filename); -@end example -@strong{Description}@* -Takes a @var{BFD} and adds a .gnu_debuglink section to it. The section is sized -to be big enough to contain a link to the specified @var{filename}. - -@strong{Returns}@* -A pointer to the new section is returned if all is ok. Otherwise @code{NULL} is -returned and bfd_error is set. - -@findex bfd_fill_in_gnu_debuglink_section -@subsubsection @code{bfd_fill_in_gnu_debuglink_section} -@strong{Synopsis} -@example -bfd_boolean bfd_fill_in_gnu_debuglink_section - (bfd *abfd, struct bfd_section *sect, const char *filename); -@end example -@strong{Description}@* -Takes a @var{BFD} and containing a .gnu_debuglink section @var{SECT} -and fills in the contents of the section to contain a link to the -specified @var{filename}. The filename should be relative to the -current directory. - -@strong{Returns}@* -@code{TRUE} is returned if all is ok. Otherwise @code{FALSE} is returned -and bfd_error is set. - diff --git a/contrib/binutils/bfd/doc/reloc.texi b/contrib/binutils/bfd/doc/reloc.texi deleted file mode 100644 index 0540be862551..000000000000 --- a/contrib/binutils/bfd/doc/reloc.texi +++ /dev/null @@ -1,2494 +0,0 @@ -@section Relocations -BFD maintains relocations in much the same way it maintains -symbols: they are left alone until required, then read in -en-masse and translated into an internal form. A common -routine @code{bfd_perform_relocation} acts upon the -canonical form to do the fixup. - -Relocations are maintained on a per section basis, -while symbols are maintained on a per BFD basis. - -All that a back end has to do to fit the BFD interface is to create -a @code{struct reloc_cache_entry} for each relocation -in a particular section, and fill in the right bits of the structures. - -@menu -* typedef arelent:: -* howto manager:: -@end menu - - -@node typedef arelent, howto manager, Relocations, Relocations -@subsection typedef arelent -This is the structure of a relocation entry: - - -@example - -typedef enum bfd_reloc_status -@{ - /* No errors detected. */ - bfd_reloc_ok, - - /* The relocation was performed, but there was an overflow. */ - bfd_reloc_overflow, - - /* The address to relocate was not within the section supplied. */ - bfd_reloc_outofrange, - - /* Used by special functions. */ - bfd_reloc_continue, - - /* Unsupported relocation size requested. */ - bfd_reloc_notsupported, - - /* Unused. */ - bfd_reloc_other, - - /* The symbol to relocate against was undefined. */ - bfd_reloc_undefined, - - /* The relocation was performed, but may not be ok - presently - generated only when linking i960 coff files with i960 b.out - symbols. If this type is returned, the error_message argument - to bfd_perform_relocation will be set. */ - bfd_reloc_dangerous - @} - bfd_reloc_status_type; - - -typedef struct reloc_cache_entry -@{ - /* A pointer into the canonical table of pointers. */ - struct bfd_symbol **sym_ptr_ptr; - - /* offset in section. */ - bfd_size_type address; - - /* addend for relocation value. */ - bfd_vma addend; - - /* Pointer to how to perform the required relocation. */ - reloc_howto_type *howto; - -@} -arelent; - -@end example -@strong{Description}@* -Here is a description of each of the fields within an @code{arelent}: - -@itemize @bullet - -@item -@code{sym_ptr_ptr} -@end itemize -The symbol table pointer points to a pointer to the symbol -associated with the relocation request. It is the pointer -into the table returned by the back end's -@code{canonicalize_symtab} action. @xref{Symbols}. The symbol is -referenced through a pointer to a pointer so that tools like -the linker can fix up all the symbols of the same name by -modifying only one pointer. The relocation routine looks in -the symbol and uses the base of the section the symbol is -attached to and the value of the symbol as the initial -relocation offset. If the symbol pointer is zero, then the -section provided is looked up. - -@itemize @bullet - -@item -@code{address} -@end itemize -The @code{address} field gives the offset in bytes from the base of -the section data which owns the relocation record to the first -byte of relocatable information. The actual data relocated -will be relative to this point; for example, a relocation -type which modifies the bottom two bytes of a four byte word -would not touch the first byte pointed to in a big endian -world. - -@itemize @bullet - -@item -@code{addend} -@end itemize -The @code{addend} is a value provided by the back end to be added (!) -to the relocation offset. Its interpretation is dependent upon -the howto. For example, on the 68k the code: - -@example - char foo[]; - main() - @{ - return foo[0x12345678]; - @} -@end example - -Could be compiled into: - -@example - linkw fp,#-4 - moveb @@#12345678,d0 - extbl d0 - unlk fp - rts -@end example - -This could create a reloc pointing to @code{foo}, but leave the -offset in the data, something like: - -@example -RELOCATION RECORDS FOR [.text]: -offset type value -00000006 32 _foo - -00000000 4e56 fffc ; linkw fp,#-4 -00000004 1039 1234 5678 ; moveb @@#12345678,d0 -0000000a 49c0 ; extbl d0 -0000000c 4e5e ; unlk fp -0000000e 4e75 ; rts -@end example - -Using coff and an 88k, some instructions don't have enough -space in them to represent the full address range, and -pointers have to be loaded in two parts. So you'd get something like: - -@example - or.u r13,r0,hi16(_foo+0x12345678) - ld.b r2,r13,lo16(_foo+0x12345678) - jmp r1 -@end example - -This should create two relocs, both pointing to @code{_foo}, and with -0x12340000 in their addend field. The data would consist of: - -@example -RELOCATION RECORDS FOR [.text]: -offset type value -00000002 HVRT16 _foo+0x12340000 -00000006 LVRT16 _foo+0x12340000 - -00000000 5da05678 ; or.u r13,r0,0x5678 -00000004 1c4d5678 ; ld.b r2,r13,0x5678 -00000008 f400c001 ; jmp r1 -@end example - -The relocation routine digs out the value from the data, adds -it to the addend to get the original offset, and then adds the -value of @code{_foo}. Note that all 32 bits have to be kept around -somewhere, to cope with carry from bit 15 to bit 16. - -One further example is the sparc and the a.out format. The -sparc has a similar problem to the 88k, in that some -instructions don't have room for an entire offset, but on the -sparc the parts are created in odd sized lumps. The designers of -the a.out format chose to not use the data within the section -for storing part of the offset; all the offset is kept within -the reloc. Anything in the data should be ignored. - -@example - save %sp,-112,%sp - sethi %hi(_foo+0x12345678),%g2 - ldsb [%g2+%lo(_foo+0x12345678)],%i0 - ret - restore -@end example - -Both relocs contain a pointer to @code{foo}, and the offsets -contain junk. - -@example -RELOCATION RECORDS FOR [.text]: -offset type value -00000004 HI22 _foo+0x12345678 -00000008 LO10 _foo+0x12345678 - -00000000 9de3bf90 ; save %sp,-112,%sp -00000004 05000000 ; sethi %hi(_foo+0),%g2 -00000008 f048a000 ; ldsb [%g2+%lo(_foo+0)],%i0 -0000000c 81c7e008 ; ret -00000010 81e80000 ; restore -@end example - -@itemize @bullet - -@item -@code{howto} -@end itemize -The @code{howto} field can be imagined as a -relocation instruction. It is a pointer to a structure which -contains information on what to do with all of the other -information in the reloc record and data section. A back end -would normally have a relocation instruction set and turn -relocations into pointers to the correct structure on input - -but it would be possible to create each howto field on demand. - -@subsubsection @code{enum complain_overflow} -Indicates what sort of overflow checking should be done when -performing a relocation. - - -@example - -enum complain_overflow -@{ - /* Do not complain on overflow. */ - complain_overflow_dont, - - /* Complain if the value overflows when considered as a signed - number one bit larger than the field. ie. A bitfield of N bits - is allowed to represent -2**n to 2**n-1. */ - complain_overflow_bitfield, - - /* Complain if the value overflows when considered as a signed - number. */ - complain_overflow_signed, - - /* Complain if the value overflows when considered as an - unsigned number. */ - complain_overflow_unsigned -@}; -@end example -@subsubsection @code{reloc_howto_type} -The @code{reloc_howto_type} is a structure which contains all the -information that libbfd needs to know to tie up a back end's data. - - -@example -struct bfd_symbol; /* Forward declaration. */ - -struct reloc_howto_struct -@{ - /* The type field has mainly a documentary use - the back end can - do what it wants with it, though normally the back end's - external idea of what a reloc number is stored - in this field. For example, a PC relative word relocation - in a coff environment has the type 023 - because that's - what the outside world calls a R_PCRWORD reloc. */ - unsigned int type; - - /* The value the final relocation is shifted right by. This drops - unwanted data from the relocation. */ - unsigned int rightshift; - - /* The size of the item to be relocated. This is *not* a - power-of-two measure. To get the number of bytes operated - on by a type of relocation, use bfd_get_reloc_size. */ - int size; - - /* The number of bits in the item to be relocated. This is used - when doing overflow checking. */ - unsigned int bitsize; - - /* Notes that the relocation is relative to the location in the - data section of the addend. The relocation function will - subtract from the relocation value the address of the location - being relocated. */ - bfd_boolean pc_relative; - - /* The bit position of the reloc value in the destination. - The relocated value is left shifted by this amount. */ - unsigned int bitpos; - - /* What type of overflow error should be checked for when - relocating. */ - enum complain_overflow complain_on_overflow; - - /* If this field is non null, then the supplied function is - called rather than the normal function. This allows really - strange relocation methods to be accommodated (e.g., i960 callj - instructions). */ - bfd_reloc_status_type (*special_function) - (bfd *, arelent *, struct bfd_symbol *, void *, asection *, - bfd *, char **); - - /* The textual name of the relocation type. */ - char *name; - - /* Some formats record a relocation addend in the section contents - rather than with the relocation. For ELF formats this is the - distinction between USE_REL and USE_RELA (though the code checks - for USE_REL == 1/0). The value of this field is TRUE if the - addend is recorded with the section contents; when performing a - partial link (ld -r) the section contents (the data) will be - modified. The value of this field is FALSE if addends are - recorded with the relocation (in arelent.addend); when performing - a partial link the relocation will be modified. - All relocations for all ELF USE_RELA targets should set this field - to FALSE (values of TRUE should be looked on with suspicion). - However, the converse is not true: not all relocations of all ELF - USE_REL targets set this field to TRUE. Why this is so is peculiar - to each particular target. For relocs that aren't used in partial - links (e.g. GOT stuff) it doesn't matter what this is set to. */ - bfd_boolean partial_inplace; - - /* src_mask selects the part of the instruction (or data) to be used - in the relocation sum. If the target relocations don't have an - addend in the reloc, eg. ELF USE_REL, src_mask will normally equal - dst_mask to extract the addend from the section contents. If - relocations do have an addend in the reloc, eg. ELF USE_RELA, this - field should be zero. Non-zero values for ELF USE_RELA targets are - bogus as in those cases the value in the dst_mask part of the - section contents should be treated as garbage. */ - bfd_vma src_mask; - - /* dst_mask selects which parts of the instruction (or data) are - replaced with a relocated value. */ - bfd_vma dst_mask; - - /* When some formats create PC relative instructions, they leave - the value of the pc of the place being relocated in the offset - slot of the instruction, so that a PC relative relocation can - be made just by adding in an ordinary offset (e.g., sun3 a.out). - Some formats leave the displacement part of an instruction - empty (e.g., m88k bcs); this flag signals the fact. */ - bfd_boolean pcrel_offset; -@}; - -@end example -@findex The HOWTO Macro -@subsubsection @code{The HOWTO Macro} -@strong{Description}@* -The HOWTO define is horrible and will go away. -@example -#define HOWTO(C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \ - @{ (unsigned) C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC @} -@end example - -@strong{Description}@* -And will be replaced with the totally magic way. But for the -moment, we are compatible, so do it this way. -@example -#define NEWHOWTO(FUNCTION, NAME, SIZE, REL, IN) \ - HOWTO (0, 0, SIZE, 0, REL, 0, complain_overflow_dont, FUNCTION, \ - NAME, FALSE, 0, 0, IN) - -@end example - -@strong{Description}@* -This is used to fill in an empty howto entry in an array. -@example -#define EMPTY_HOWTO(C) \ - HOWTO ((C), 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL, \ - NULL, FALSE, 0, 0, FALSE) - -@end example - -@strong{Description}@* -Helper routine to turn a symbol into a relocation value. -@example -#define HOWTO_PREPARE(relocation, symbol) \ - @{ \ - if (symbol != NULL) \ - @{ \ - if (bfd_is_com_section (symbol->section)) \ - @{ \ - relocation = 0; \ - @} \ - else \ - @{ \ - relocation = symbol->value; \ - @} \ - @} \ - @} - -@end example - -@findex bfd_get_reloc_size -@subsubsection @code{bfd_get_reloc_size} -@strong{Synopsis} -@example -unsigned int bfd_get_reloc_size (reloc_howto_type *); -@end example -@strong{Description}@* -For a reloc_howto_type that operates on a fixed number of bytes, -this returns the number of bytes operated on. - -@findex arelent_chain -@subsubsection @code{arelent_chain} -@strong{Description}@* -How relocs are tied together in an @code{asection}: -@example -typedef struct relent_chain -@{ - arelent relent; - struct relent_chain *next; -@} -arelent_chain; - -@end example - -@findex bfd_check_overflow -@subsubsection @code{bfd_check_overflow} -@strong{Synopsis} -@example -bfd_reloc_status_type bfd_check_overflow - (enum complain_overflow how, - unsigned int bitsize, - unsigned int rightshift, - unsigned int addrsize, - bfd_vma relocation); -@end example -@strong{Description}@* -Perform overflow checking on @var{relocation} which has -@var{bitsize} significant bits and will be shifted right by -@var{rightshift} bits, on a machine with addresses containing -@var{addrsize} significant bits. The result is either of -@code{bfd_reloc_ok} or @code{bfd_reloc_overflow}. - -@findex bfd_perform_relocation -@subsubsection @code{bfd_perform_relocation} -@strong{Synopsis} -@example -bfd_reloc_status_type bfd_perform_relocation - (bfd *abfd, - arelent *reloc_entry, - void *data, - asection *input_section, - bfd *output_bfd, - char **error_message); -@end example -@strong{Description}@* -If @var{output_bfd} is supplied to this function, the -generated image will be relocatable; the relocations are -copied to the output file after they have been changed to -reflect the new state of the world. There are two ways of -reflecting the results of partial linkage in an output file: -by modifying the output data in place, and by modifying the -relocation record. Some native formats (e.g., basic a.out and -basic coff) have no way of specifying an addend in the -relocation type, so the addend has to go in the output data. -This is no big deal since in these formats the output data -slot will always be big enough for the addend. Complex reloc -types with addends were invented to solve just this problem. -The @var{error_message} argument is set to an error message if -this return @code{bfd_reloc_dangerous}. - -@findex bfd_install_relocation -@subsubsection @code{bfd_install_relocation} -@strong{Synopsis} -@example -bfd_reloc_status_type bfd_install_relocation - (bfd *abfd, - arelent *reloc_entry, - void *data, bfd_vma data_start, - asection *input_section, - char **error_message); -@end example -@strong{Description}@* -This looks remarkably like @code{bfd_perform_relocation}, except it -does not expect that the section contents have been filled in. -I.e., it's suitable for use when creating, rather than applying -a relocation. - -For now, this function should be considered reserved for the -assembler. - - -@node howto manager, , typedef arelent, Relocations -@subsection The howto manager -When an application wants to create a relocation, but doesn't -know what the target machine might call it, it can find out by -using this bit of code. - -@findex bfd_reloc_code_type -@subsubsection @code{bfd_reloc_code_type} -@strong{Description}@* -The insides of a reloc code. The idea is that, eventually, there -will be one enumerator for every type of relocation we ever do. -Pass one of these values to @code{bfd_reloc_type_lookup}, and it'll -return a howto pointer. - -This does mean that the application must determine the correct -enumerator value; you can't get a howto pointer from a random set -of attributes. - -Here are the possible values for @code{enum bfd_reloc_code_real}: - -@deffn {} BFD_RELOC_64 -@deffnx {} BFD_RELOC_32 -@deffnx {} BFD_RELOC_26 -@deffnx {} BFD_RELOC_24 -@deffnx {} BFD_RELOC_16 -@deffnx {} BFD_RELOC_14 -@deffnx {} BFD_RELOC_8 -Basic absolute relocations of N bits. -@end deffn -@deffn {} BFD_RELOC_64_PCREL -@deffnx {} BFD_RELOC_32_PCREL -@deffnx {} BFD_RELOC_24_PCREL -@deffnx {} BFD_RELOC_16_PCREL -@deffnx {} BFD_RELOC_12_PCREL -@deffnx {} BFD_RELOC_8_PCREL -PC-relative relocations. Sometimes these are relative to the address -of the relocation itself; sometimes they are relative to the start of -the section containing the relocation. It depends on the specific target. - -The 24-bit relocation is used in some Intel 960 configurations. -@end deffn -@deffn {} BFD_RELOC_32_SECREL -Section relative relocations. Some targets need this for DWARF2. -@end deffn -@deffn {} BFD_RELOC_32_GOT_PCREL -@deffnx {} BFD_RELOC_16_GOT_PCREL -@deffnx {} BFD_RELOC_8_GOT_PCREL -@deffnx {} BFD_RELOC_32_GOTOFF -@deffnx {} BFD_RELOC_16_GOTOFF -@deffnx {} BFD_RELOC_LO16_GOTOFF -@deffnx {} BFD_RELOC_HI16_GOTOFF -@deffnx {} BFD_RELOC_HI16_S_GOTOFF -@deffnx {} BFD_RELOC_8_GOTOFF -@deffnx {} BFD_RELOC_64_PLT_PCREL -@deffnx {} BFD_RELOC_32_PLT_PCREL -@deffnx {} BFD_RELOC_24_PLT_PCREL -@deffnx {} BFD_RELOC_16_PLT_PCREL -@deffnx {} BFD_RELOC_8_PLT_PCREL -@deffnx {} BFD_RELOC_64_PLTOFF -@deffnx {} BFD_RELOC_32_PLTOFF -@deffnx {} BFD_RELOC_16_PLTOFF -@deffnx {} BFD_RELOC_LO16_PLTOFF -@deffnx {} BFD_RELOC_HI16_PLTOFF -@deffnx {} BFD_RELOC_HI16_S_PLTOFF -@deffnx {} BFD_RELOC_8_PLTOFF -For ELF. -@end deffn -@deffn {} BFD_RELOC_68K_GLOB_DAT -@deffnx {} BFD_RELOC_68K_JMP_SLOT -@deffnx {} BFD_RELOC_68K_RELATIVE -Relocations used by 68K ELF. -@end deffn -@deffn {} BFD_RELOC_32_BASEREL -@deffnx {} BFD_RELOC_16_BASEREL -@deffnx {} BFD_RELOC_LO16_BASEREL -@deffnx {} BFD_RELOC_HI16_BASEREL -@deffnx {} BFD_RELOC_HI16_S_BASEREL -@deffnx {} BFD_RELOC_8_BASEREL -@deffnx {} BFD_RELOC_RVA -Linkage-table relative. -@end deffn -@deffn {} BFD_RELOC_8_FFnn -Absolute 8-bit relocation, but used to form an address like 0xFFnn. -@end deffn -@deffn {} BFD_RELOC_32_PCREL_S2 -@deffnx {} BFD_RELOC_16_PCREL_S2 -@deffnx {} BFD_RELOC_23_PCREL_S2 -These PC-relative relocations are stored as word displacements -- -i.e., byte displacements shifted right two bits. The 30-bit word -displacement (<<32_PCREL_S2>> -- 32 bits, shifted 2) is used on the -SPARC. (SPARC tools generally refer to this as <<WDISP30>>.) The -signed 16-bit displacement is used on the MIPS, and the 23-bit -displacement is used on the Alpha. -@end deffn -@deffn {} BFD_RELOC_HI22 -@deffnx {} BFD_RELOC_LO10 -High 22 bits and low 10 bits of 32-bit value, placed into lower bits of -the target word. These are used on the SPARC. -@end deffn -@deffn {} BFD_RELOC_GPREL16 -@deffnx {} BFD_RELOC_GPREL32 -For systems that allocate a Global Pointer register, these are -displacements off that register. These relocation types are -handled specially, because the value the register will have is -decided relatively late. -@end deffn -@deffn {} BFD_RELOC_I960_CALLJ -Reloc types used for i960/b.out. -@end deffn -@deffn {} BFD_RELOC_NONE -@deffnx {} BFD_RELOC_SPARC_WDISP22 -@deffnx {} BFD_RELOC_SPARC22 -@deffnx {} BFD_RELOC_SPARC13 -@deffnx {} BFD_RELOC_SPARC_GOT10 -@deffnx {} BFD_RELOC_SPARC_GOT13 -@deffnx {} BFD_RELOC_SPARC_GOT22 -@deffnx {} BFD_RELOC_SPARC_PC10 -@deffnx {} BFD_RELOC_SPARC_PC22 -@deffnx {} BFD_RELOC_SPARC_WPLT30 -@deffnx {} BFD_RELOC_SPARC_COPY -@deffnx {} BFD_RELOC_SPARC_GLOB_DAT -@deffnx {} BFD_RELOC_SPARC_JMP_SLOT -@deffnx {} BFD_RELOC_SPARC_RELATIVE -@deffnx {} BFD_RELOC_SPARC_UA16 -@deffnx {} BFD_RELOC_SPARC_UA32 -@deffnx {} BFD_RELOC_SPARC_UA64 -SPARC ELF relocations. There is probably some overlap with other -relocation types already defined. -@end deffn -@deffn {} BFD_RELOC_SPARC_BASE13 -@deffnx {} BFD_RELOC_SPARC_BASE22 -I think these are specific to SPARC a.out (e.g., Sun 4). -@end deffn -@deffn {} BFD_RELOC_SPARC_64 -@deffnx {} BFD_RELOC_SPARC_10 -@deffnx {} BFD_RELOC_SPARC_11 -@deffnx {} BFD_RELOC_SPARC_OLO10 -@deffnx {} BFD_RELOC_SPARC_HH22 -@deffnx {} BFD_RELOC_SPARC_HM10 -@deffnx {} BFD_RELOC_SPARC_LM22 -@deffnx {} BFD_RELOC_SPARC_PC_HH22 -@deffnx {} BFD_RELOC_SPARC_PC_HM10 -@deffnx {} BFD_RELOC_SPARC_PC_LM22 -@deffnx {} BFD_RELOC_SPARC_WDISP16 -@deffnx {} BFD_RELOC_SPARC_WDISP19 -@deffnx {} BFD_RELOC_SPARC_7 -@deffnx {} BFD_RELOC_SPARC_6 -@deffnx {} BFD_RELOC_SPARC_5 -@deffnx {} BFD_RELOC_SPARC_DISP64 -@deffnx {} BFD_RELOC_SPARC_PLT32 -@deffnx {} BFD_RELOC_SPARC_PLT64 -@deffnx {} BFD_RELOC_SPARC_HIX22 -@deffnx {} BFD_RELOC_SPARC_LOX10 -@deffnx {} BFD_RELOC_SPARC_H44 -@deffnx {} BFD_RELOC_SPARC_M44 -@deffnx {} BFD_RELOC_SPARC_L44 -@deffnx {} BFD_RELOC_SPARC_REGISTER -SPARC64 relocations -@end deffn -@deffn {} BFD_RELOC_SPARC_REV32 -SPARC little endian relocation -@end deffn -@deffn {} BFD_RELOC_SPARC_TLS_GD_HI22 -@deffnx {} BFD_RELOC_SPARC_TLS_GD_LO10 -@deffnx {} BFD_RELOC_SPARC_TLS_GD_ADD -@deffnx {} BFD_RELOC_SPARC_TLS_GD_CALL -@deffnx {} BFD_RELOC_SPARC_TLS_LDM_HI22 -@deffnx {} BFD_RELOC_SPARC_TLS_LDM_LO10 -@deffnx {} BFD_RELOC_SPARC_TLS_LDM_ADD -@deffnx {} BFD_RELOC_SPARC_TLS_LDM_CALL -@deffnx {} BFD_RELOC_SPARC_TLS_LDO_HIX22 -@deffnx {} BFD_RELOC_SPARC_TLS_LDO_LOX10 -@deffnx {} BFD_RELOC_SPARC_TLS_LDO_ADD -@deffnx {} BFD_RELOC_SPARC_TLS_IE_HI22 -@deffnx {} BFD_RELOC_SPARC_TLS_IE_LO10 -@deffnx {} BFD_RELOC_SPARC_TLS_IE_LD -@deffnx {} BFD_RELOC_SPARC_TLS_IE_LDX -@deffnx {} BFD_RELOC_SPARC_TLS_IE_ADD -@deffnx {} BFD_RELOC_SPARC_TLS_LE_HIX22 -@deffnx {} BFD_RELOC_SPARC_TLS_LE_LOX10 -@deffnx {} BFD_RELOC_SPARC_TLS_DTPMOD32 -@deffnx {} BFD_RELOC_SPARC_TLS_DTPMOD64 -@deffnx {} BFD_RELOC_SPARC_TLS_DTPOFF32 -@deffnx {} BFD_RELOC_SPARC_TLS_DTPOFF64 -@deffnx {} BFD_RELOC_SPARC_TLS_TPOFF32 -@deffnx {} BFD_RELOC_SPARC_TLS_TPOFF64 -SPARC TLS relocations -@end deffn -@deffn {} BFD_RELOC_ALPHA_GPDISP_HI16 -Alpha ECOFF and ELF relocations. Some of these treat the symbol or -"addend" in some special way. -For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when -writing; when reading, it will be the absolute section symbol. The -addend is the displacement in bytes of the "lda" instruction from -the "ldah" instruction (which is at the address of this reloc). -@end deffn -@deffn {} BFD_RELOC_ALPHA_GPDISP_LO16 -For GPDISP_LO16 ("ignore") relocations, the symbol is handled as -with GPDISP_HI16 relocs. The addend is ignored when writing the -relocations out, and is filled in with the file's GP value on -reading, for convenience. -@end deffn -@deffn {} BFD_RELOC_ALPHA_GPDISP -The ELF GPDISP relocation is exactly the same as the GPDISP_HI16 -relocation except that there is no accompanying GPDISP_LO16 -relocation. -@end deffn -@deffn {} BFD_RELOC_ALPHA_LITERAL -@deffnx {} BFD_RELOC_ALPHA_ELF_LITERAL -@deffnx {} BFD_RELOC_ALPHA_LITUSE -The Alpha LITERAL/LITUSE relocs are produced by a symbol reference; -the assembler turns it into a LDQ instruction to load the address of -the symbol, and then fills in a register in the real instruction. - -The LITERAL reloc, at the LDQ instruction, refers to the .lita -section symbol. The addend is ignored when writing, but is filled -in with the file's GP value on reading, for convenience, as with the -GPDISP_LO16 reloc. - -The ELF_LITERAL reloc is somewhere between 16_GOTOFF and GPDISP_LO16. -It should refer to the symbol to be referenced, as with 16_GOTOFF, -but it generates output not based on the position within the .got -section, but relative to the GP value chosen for the file during the -final link stage. - -The LITUSE reloc, on the instruction using the loaded address, gives -information to the linker that it might be able to use to optimize -away some literal section references. The symbol is ignored (read -as the absolute section symbol), and the "addend" indicates the type -of instruction using the register: -1 - "memory" fmt insn -2 - byte-manipulation (byte offset reg) -3 - jsr (target of branch) -@end deffn -@deffn {} BFD_RELOC_ALPHA_HINT -The HINT relocation indicates a value that should be filled into the -"hint" field of a jmp/jsr/ret instruction, for possible branch- -prediction logic which may be provided on some processors. -@end deffn -@deffn {} BFD_RELOC_ALPHA_LINKAGE -The LINKAGE relocation outputs a linkage pair in the object file, -which is filled by the linker. -@end deffn -@deffn {} BFD_RELOC_ALPHA_CODEADDR -The CODEADDR relocation outputs a STO_CA in the object file, -which is filled by the linker. -@end deffn -@deffn {} BFD_RELOC_ALPHA_GPREL_HI16 -@deffnx {} BFD_RELOC_ALPHA_GPREL_LO16 -The GPREL_HI/LO relocations together form a 32-bit offset from the -GP register. -@end deffn -@deffn {} BFD_RELOC_ALPHA_BRSGP -Like BFD_RELOC_23_PCREL_S2, except that the source and target must -share a common GP, and the target address is adjusted for -STO_ALPHA_STD_GPLOAD. -@end deffn -@deffn {} BFD_RELOC_ALPHA_TLSGD -@deffnx {} BFD_RELOC_ALPHA_TLSLDM -@deffnx {} BFD_RELOC_ALPHA_DTPMOD64 -@deffnx {} BFD_RELOC_ALPHA_GOTDTPREL16 -@deffnx {} BFD_RELOC_ALPHA_DTPREL64 -@deffnx {} BFD_RELOC_ALPHA_DTPREL_HI16 -@deffnx {} BFD_RELOC_ALPHA_DTPREL_LO16 -@deffnx {} BFD_RELOC_ALPHA_DTPREL16 -@deffnx {} BFD_RELOC_ALPHA_GOTTPREL16 -@deffnx {} BFD_RELOC_ALPHA_TPREL64 -@deffnx {} BFD_RELOC_ALPHA_TPREL_HI16 -@deffnx {} BFD_RELOC_ALPHA_TPREL_LO16 -@deffnx {} BFD_RELOC_ALPHA_TPREL16 -Alpha thread-local storage relocations. -@end deffn -@deffn {} BFD_RELOC_MIPS_JMP -Bits 27..2 of the relocation address shifted right 2 bits; -simple reloc otherwise. -@end deffn -@deffn {} BFD_RELOC_MIPS16_JMP -The MIPS16 jump instruction. -@end deffn -@deffn {} BFD_RELOC_MIPS16_GPREL -MIPS16 GP relative reloc. -@end deffn -@deffn {} BFD_RELOC_HI16 -High 16 bits of 32-bit value; simple reloc. -@end deffn -@deffn {} BFD_RELOC_HI16_S -High 16 bits of 32-bit value but the low 16 bits will be sign -extended and added to form the final result. If the low 16 -bits form a negative number, we need to add one to the high value -to compensate for the borrow when the low bits are added. -@end deffn -@deffn {} BFD_RELOC_LO16 -Low 16 bits. -@end deffn -@deffn {} BFD_RELOC_HI16_PCREL -High 16 bits of 32-bit pc-relative value -@end deffn -@deffn {} BFD_RELOC_HI16_S_PCREL -High 16 bits of 32-bit pc-relative value, adjusted -@end deffn -@deffn {} BFD_RELOC_LO16_PCREL -Low 16 bits of pc-relative value -@end deffn -@deffn {} BFD_RELOC_MIPS16_HI16 -MIPS16 high 16 bits of 32-bit value. -@end deffn -@deffn {} BFD_RELOC_MIPS16_HI16_S -MIPS16 high 16 bits of 32-bit value but the low 16 bits will be sign -extended and added to form the final result. If the low 16 -bits form a negative number, we need to add one to the high value -to compensate for the borrow when the low bits are added. -@end deffn -@deffn {} BFD_RELOC_MIPS16_LO16 -MIPS16 low 16 bits. -@end deffn -@deffn {} BFD_RELOC_MIPS_LITERAL -Relocation against a MIPS literal section. -@end deffn -@deffn {} BFD_RELOC_MIPS_GOT16 -@deffnx {} BFD_RELOC_MIPS_CALL16 -@deffnx {} BFD_RELOC_MIPS_GOT_HI16 -@deffnx {} BFD_RELOC_MIPS_GOT_LO16 -@deffnx {} BFD_RELOC_MIPS_CALL_HI16 -@deffnx {} BFD_RELOC_MIPS_CALL_LO16 -@deffnx {} BFD_RELOC_MIPS_SUB -@deffnx {} BFD_RELOC_MIPS_GOT_PAGE -@deffnx {} BFD_RELOC_MIPS_GOT_OFST -@deffnx {} BFD_RELOC_MIPS_GOT_DISP -@deffnx {} BFD_RELOC_MIPS_SHIFT5 -@deffnx {} BFD_RELOC_MIPS_SHIFT6 -@deffnx {} BFD_RELOC_MIPS_INSERT_A -@deffnx {} BFD_RELOC_MIPS_INSERT_B -@deffnx {} BFD_RELOC_MIPS_DELETE -@deffnx {} BFD_RELOC_MIPS_HIGHEST -@deffnx {} BFD_RELOC_MIPS_HIGHER -@deffnx {} BFD_RELOC_MIPS_SCN_DISP -@deffnx {} BFD_RELOC_MIPS_REL16 -@deffnx {} BFD_RELOC_MIPS_RELGOT -@deffnx {} BFD_RELOC_MIPS_JALR -@deffnx {} BFD_RELOC_MIPS_TLS_DTPMOD32 -@deffnx {} BFD_RELOC_MIPS_TLS_DTPREL32 -@deffnx {} BFD_RELOC_MIPS_TLS_DTPMOD64 -@deffnx {} BFD_RELOC_MIPS_TLS_DTPREL64 -@deffnx {} BFD_RELOC_MIPS_TLS_GD -@deffnx {} BFD_RELOC_MIPS_TLS_LDM -@deffnx {} BFD_RELOC_MIPS_TLS_DTPREL_HI16 -@deffnx {} BFD_RELOC_MIPS_TLS_DTPREL_LO16 -@deffnx {} BFD_RELOC_MIPS_TLS_GOTTPREL -@deffnx {} BFD_RELOC_MIPS_TLS_TPREL32 -@deffnx {} BFD_RELOC_MIPS_TLS_TPREL64 -@deffnx {} BFD_RELOC_MIPS_TLS_TPREL_HI16 -@deffnx {} BFD_RELOC_MIPS_TLS_TPREL_LO16 -MIPS ELF relocations. -@end deffn -@deffn {} BFD_RELOC_MIPS_COPY -@deffnx {} BFD_RELOC_MIPS_JUMP_SLOT -MIPS ELF relocations (VxWorks extensions). -@end deffn -@deffn {} BFD_RELOC_FRV_LABEL16 -@deffnx {} BFD_RELOC_FRV_LABEL24 -@deffnx {} BFD_RELOC_FRV_LO16 -@deffnx {} BFD_RELOC_FRV_HI16 -@deffnx {} BFD_RELOC_FRV_GPREL12 -@deffnx {} BFD_RELOC_FRV_GPRELU12 -@deffnx {} BFD_RELOC_FRV_GPREL32 -@deffnx {} BFD_RELOC_FRV_GPRELHI -@deffnx {} BFD_RELOC_FRV_GPRELLO -@deffnx {} BFD_RELOC_FRV_GOT12 -@deffnx {} BFD_RELOC_FRV_GOTHI -@deffnx {} BFD_RELOC_FRV_GOTLO -@deffnx {} BFD_RELOC_FRV_FUNCDESC -@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOT12 -@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTHI -@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTLO -@deffnx {} BFD_RELOC_FRV_FUNCDESC_VALUE -@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTOFF12 -@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTOFFHI -@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTOFFLO -@deffnx {} BFD_RELOC_FRV_GOTOFF12 -@deffnx {} BFD_RELOC_FRV_GOTOFFHI -@deffnx {} BFD_RELOC_FRV_GOTOFFLO -@deffnx {} BFD_RELOC_FRV_GETTLSOFF -@deffnx {} BFD_RELOC_FRV_TLSDESC_VALUE -@deffnx {} BFD_RELOC_FRV_GOTTLSDESC12 -@deffnx {} BFD_RELOC_FRV_GOTTLSDESCHI -@deffnx {} BFD_RELOC_FRV_GOTTLSDESCLO -@deffnx {} BFD_RELOC_FRV_TLSMOFF12 -@deffnx {} BFD_RELOC_FRV_TLSMOFFHI -@deffnx {} BFD_RELOC_FRV_TLSMOFFLO -@deffnx {} BFD_RELOC_FRV_GOTTLSOFF12 -@deffnx {} BFD_RELOC_FRV_GOTTLSOFFHI -@deffnx {} BFD_RELOC_FRV_GOTTLSOFFLO -@deffnx {} BFD_RELOC_FRV_TLSOFF -@deffnx {} BFD_RELOC_FRV_TLSDESC_RELAX -@deffnx {} BFD_RELOC_FRV_GETTLSOFF_RELAX -@deffnx {} BFD_RELOC_FRV_TLSOFF_RELAX -@deffnx {} BFD_RELOC_FRV_TLSMOFF -Fujitsu Frv Relocations. -@end deffn -@deffn {} BFD_RELOC_MN10300_GOTOFF24 -This is a 24bit GOT-relative reloc for the mn10300. -@end deffn -@deffn {} BFD_RELOC_MN10300_GOT32 -This is a 32bit GOT-relative reloc for the mn10300, offset by two bytes -in the instruction. -@end deffn -@deffn {} BFD_RELOC_MN10300_GOT24 -This is a 24bit GOT-relative reloc for the mn10300, offset by two bytes -in the instruction. -@end deffn -@deffn {} BFD_RELOC_MN10300_GOT16 -This is a 16bit GOT-relative reloc for the mn10300, offset by two bytes -in the instruction. -@end deffn -@deffn {} BFD_RELOC_MN10300_COPY -Copy symbol at runtime. -@end deffn -@deffn {} BFD_RELOC_MN10300_GLOB_DAT -Create GOT entry. -@end deffn -@deffn {} BFD_RELOC_MN10300_JMP_SLOT -Create PLT entry. -@end deffn -@deffn {} BFD_RELOC_MN10300_RELATIVE -Adjust by program base. -@end deffn -@deffn {} BFD_RELOC_386_GOT32 -@deffnx {} BFD_RELOC_386_PLT32 -@deffnx {} BFD_RELOC_386_COPY -@deffnx {} BFD_RELOC_386_GLOB_DAT -@deffnx {} BFD_RELOC_386_JUMP_SLOT -@deffnx {} BFD_RELOC_386_RELATIVE -@deffnx {} BFD_RELOC_386_GOTOFF -@deffnx {} BFD_RELOC_386_GOTPC -@deffnx {} BFD_RELOC_386_TLS_TPOFF -@deffnx {} BFD_RELOC_386_TLS_IE -@deffnx {} BFD_RELOC_386_TLS_GOTIE -@deffnx {} BFD_RELOC_386_TLS_LE -@deffnx {} BFD_RELOC_386_TLS_GD -@deffnx {} BFD_RELOC_386_TLS_LDM -@deffnx {} BFD_RELOC_386_TLS_LDO_32 -@deffnx {} BFD_RELOC_386_TLS_IE_32 -@deffnx {} BFD_RELOC_386_TLS_LE_32 -@deffnx {} BFD_RELOC_386_TLS_DTPMOD32 -@deffnx {} BFD_RELOC_386_TLS_DTPOFF32 -@deffnx {} BFD_RELOC_386_TLS_TPOFF32 -@deffnx {} BFD_RELOC_386_TLS_GOTDESC -@deffnx {} BFD_RELOC_386_TLS_DESC_CALL -@deffnx {} BFD_RELOC_386_TLS_DESC -i386/elf relocations -@end deffn -@deffn {} BFD_RELOC_X86_64_GOT32 -@deffnx {} BFD_RELOC_X86_64_PLT32 -@deffnx {} BFD_RELOC_X86_64_COPY -@deffnx {} BFD_RELOC_X86_64_GLOB_DAT -@deffnx {} BFD_RELOC_X86_64_JUMP_SLOT -@deffnx {} BFD_RELOC_X86_64_RELATIVE -@deffnx {} BFD_RELOC_X86_64_GOTPCREL -@deffnx {} BFD_RELOC_X86_64_32S -@deffnx {} BFD_RELOC_X86_64_DTPMOD64 -@deffnx {} BFD_RELOC_X86_64_DTPOFF64 -@deffnx {} BFD_RELOC_X86_64_TPOFF64 -@deffnx {} BFD_RELOC_X86_64_TLSGD -@deffnx {} BFD_RELOC_X86_64_TLSLD -@deffnx {} BFD_RELOC_X86_64_DTPOFF32 -@deffnx {} BFD_RELOC_X86_64_GOTTPOFF -@deffnx {} BFD_RELOC_X86_64_TPOFF32 -@deffnx {} BFD_RELOC_X86_64_GOTOFF64 -@deffnx {} BFD_RELOC_X86_64_GOTPC32 -@deffnx {} BFD_RELOC_X86_64_GOT64 -@deffnx {} BFD_RELOC_X86_64_GOTPCREL64 -@deffnx {} BFD_RELOC_X86_64_GOTPC64 -@deffnx {} BFD_RELOC_X86_64_GOTPLT64 -@deffnx {} BFD_RELOC_X86_64_PLTOFF64 -@deffnx {} BFD_RELOC_X86_64_GOTPC32_TLSDESC -@deffnx {} BFD_RELOC_X86_64_TLSDESC_CALL -@deffnx {} BFD_RELOC_X86_64_TLSDESC -x86-64/elf relocations -@end deffn -@deffn {} BFD_RELOC_NS32K_IMM_8 -@deffnx {} BFD_RELOC_NS32K_IMM_16 -@deffnx {} BFD_RELOC_NS32K_IMM_32 -@deffnx {} BFD_RELOC_NS32K_IMM_8_PCREL -@deffnx {} BFD_RELOC_NS32K_IMM_16_PCREL -@deffnx {} BFD_RELOC_NS32K_IMM_32_PCREL -@deffnx {} BFD_RELOC_NS32K_DISP_8 -@deffnx {} BFD_RELOC_NS32K_DISP_16 -@deffnx {} BFD_RELOC_NS32K_DISP_32 -@deffnx {} BFD_RELOC_NS32K_DISP_8_PCREL -@deffnx {} BFD_RELOC_NS32K_DISP_16_PCREL -@deffnx {} BFD_RELOC_NS32K_DISP_32_PCREL -ns32k relocations -@end deffn -@deffn {} BFD_RELOC_PDP11_DISP_8_PCREL -@deffnx {} BFD_RELOC_PDP11_DISP_6_PCREL -PDP11 relocations -@end deffn -@deffn {} BFD_RELOC_PJ_CODE_HI16 -@deffnx {} BFD_RELOC_PJ_CODE_LO16 -@deffnx {} BFD_RELOC_PJ_CODE_DIR16 -@deffnx {} BFD_RELOC_PJ_CODE_DIR32 -@deffnx {} BFD_RELOC_PJ_CODE_REL16 -@deffnx {} BFD_RELOC_PJ_CODE_REL32 -Picojava relocs. Not all of these appear in object files. -@end deffn -@deffn {} BFD_RELOC_PPC_B26 -@deffnx {} BFD_RELOC_PPC_BA26 -@deffnx {} BFD_RELOC_PPC_TOC16 -@deffnx {} BFD_RELOC_PPC_B16 -@deffnx {} BFD_RELOC_PPC_B16_BRTAKEN -@deffnx {} BFD_RELOC_PPC_B16_BRNTAKEN -@deffnx {} BFD_RELOC_PPC_BA16 -@deffnx {} BFD_RELOC_PPC_BA16_BRTAKEN -@deffnx {} BFD_RELOC_PPC_BA16_BRNTAKEN -@deffnx {} BFD_RELOC_PPC_COPY -@deffnx {} BFD_RELOC_PPC_GLOB_DAT -@deffnx {} BFD_RELOC_PPC_JMP_SLOT -@deffnx {} BFD_RELOC_PPC_RELATIVE -@deffnx {} BFD_RELOC_PPC_LOCAL24PC -@deffnx {} BFD_RELOC_PPC_EMB_NADDR32 -@deffnx {} BFD_RELOC_PPC_EMB_NADDR16 -@deffnx {} BFD_RELOC_PPC_EMB_NADDR16_LO -@deffnx {} BFD_RELOC_PPC_EMB_NADDR16_HI -@deffnx {} BFD_RELOC_PPC_EMB_NADDR16_HA -@deffnx {} BFD_RELOC_PPC_EMB_SDAI16 -@deffnx {} BFD_RELOC_PPC_EMB_SDA2I16 -@deffnx {} BFD_RELOC_PPC_EMB_SDA2REL -@deffnx {} BFD_RELOC_PPC_EMB_SDA21 -@deffnx {} BFD_RELOC_PPC_EMB_MRKREF -@deffnx {} BFD_RELOC_PPC_EMB_RELSEC16 -@deffnx {} BFD_RELOC_PPC_EMB_RELST_LO -@deffnx {} BFD_RELOC_PPC_EMB_RELST_HI -@deffnx {} BFD_RELOC_PPC_EMB_RELST_HA -@deffnx {} BFD_RELOC_PPC_EMB_BIT_FLD -@deffnx {} BFD_RELOC_PPC_EMB_RELSDA -@deffnx {} BFD_RELOC_PPC64_HIGHER -@deffnx {} BFD_RELOC_PPC64_HIGHER_S -@deffnx {} BFD_RELOC_PPC64_HIGHEST -@deffnx {} BFD_RELOC_PPC64_HIGHEST_S -@deffnx {} BFD_RELOC_PPC64_TOC16_LO -@deffnx {} BFD_RELOC_PPC64_TOC16_HI -@deffnx {} BFD_RELOC_PPC64_TOC16_HA -@deffnx {} BFD_RELOC_PPC64_TOC -@deffnx {} BFD_RELOC_PPC64_PLTGOT16 -@deffnx {} BFD_RELOC_PPC64_PLTGOT16_LO -@deffnx {} BFD_RELOC_PPC64_PLTGOT16_HI -@deffnx {} BFD_RELOC_PPC64_PLTGOT16_HA -@deffnx {} BFD_RELOC_PPC64_ADDR16_DS -@deffnx {} BFD_RELOC_PPC64_ADDR16_LO_DS -@deffnx {} BFD_RELOC_PPC64_GOT16_DS -@deffnx {} BFD_RELOC_PPC64_GOT16_LO_DS -@deffnx {} BFD_RELOC_PPC64_PLT16_LO_DS -@deffnx {} BFD_RELOC_PPC64_SECTOFF_DS -@deffnx {} BFD_RELOC_PPC64_SECTOFF_LO_DS -@deffnx {} BFD_RELOC_PPC64_TOC16_DS -@deffnx {} BFD_RELOC_PPC64_TOC16_LO_DS -@deffnx {} BFD_RELOC_PPC64_PLTGOT16_DS -@deffnx {} BFD_RELOC_PPC64_PLTGOT16_LO_DS -Power(rs6000) and PowerPC relocations. -@end deffn -@deffn {} BFD_RELOC_PPC_TLS -@deffnx {} BFD_RELOC_PPC_DTPMOD -@deffnx {} BFD_RELOC_PPC_TPREL16 -@deffnx {} BFD_RELOC_PPC_TPREL16_LO -@deffnx {} BFD_RELOC_PPC_TPREL16_HI -@deffnx {} BFD_RELOC_PPC_TPREL16_HA -@deffnx {} BFD_RELOC_PPC_TPREL -@deffnx {} BFD_RELOC_PPC_DTPREL16 -@deffnx {} BFD_RELOC_PPC_DTPREL16_LO -@deffnx {} BFD_RELOC_PPC_DTPREL16_HI -@deffnx {} BFD_RELOC_PPC_DTPREL16_HA -@deffnx {} BFD_RELOC_PPC_DTPREL -@deffnx {} BFD_RELOC_PPC_GOT_TLSGD16 -@deffnx {} BFD_RELOC_PPC_GOT_TLSGD16_LO -@deffnx {} BFD_RELOC_PPC_GOT_TLSGD16_HI -@deffnx {} BFD_RELOC_PPC_GOT_TLSGD16_HA -@deffnx {} BFD_RELOC_PPC_GOT_TLSLD16 -@deffnx {} BFD_RELOC_PPC_GOT_TLSLD16_LO -@deffnx {} BFD_RELOC_PPC_GOT_TLSLD16_HI -@deffnx {} BFD_RELOC_PPC_GOT_TLSLD16_HA -@deffnx {} BFD_RELOC_PPC_GOT_TPREL16 -@deffnx {} BFD_RELOC_PPC_GOT_TPREL16_LO -@deffnx {} BFD_RELOC_PPC_GOT_TPREL16_HI -@deffnx {} BFD_RELOC_PPC_GOT_TPREL16_HA -@deffnx {} BFD_RELOC_PPC_GOT_DTPREL16 -@deffnx {} BFD_RELOC_PPC_GOT_DTPREL16_LO -@deffnx {} BFD_RELOC_PPC_GOT_DTPREL16_HI -@deffnx {} BFD_RELOC_PPC_GOT_DTPREL16_HA -@deffnx {} BFD_RELOC_PPC64_TPREL16_DS -@deffnx {} BFD_RELOC_PPC64_TPREL16_LO_DS -@deffnx {} BFD_RELOC_PPC64_TPREL16_HIGHER -@deffnx {} BFD_RELOC_PPC64_TPREL16_HIGHERA -@deffnx {} BFD_RELOC_PPC64_TPREL16_HIGHEST -@deffnx {} BFD_RELOC_PPC64_TPREL16_HIGHESTA -@deffnx {} BFD_RELOC_PPC64_DTPREL16_DS -@deffnx {} BFD_RELOC_PPC64_DTPREL16_LO_DS -@deffnx {} BFD_RELOC_PPC64_DTPREL16_HIGHER -@deffnx {} BFD_RELOC_PPC64_DTPREL16_HIGHERA -@deffnx {} BFD_RELOC_PPC64_DTPREL16_HIGHEST -@deffnx {} BFD_RELOC_PPC64_DTPREL16_HIGHESTA -PowerPC and PowerPC64 thread-local storage relocations. -@end deffn -@deffn {} BFD_RELOC_I370_D12 -IBM 370/390 relocations -@end deffn -@deffn {} BFD_RELOC_CTOR -The type of reloc used to build a constructor table - at the moment -probably a 32 bit wide absolute relocation, but the target can choose. -It generally does map to one of the other relocation types. -@end deffn -@deffn {} BFD_RELOC_ARM_PCREL_BRANCH -ARM 26 bit pc-relative branch. The lowest two bits must be zero and are -not stored in the instruction. -@end deffn -@deffn {} BFD_RELOC_ARM_PCREL_BLX -ARM 26 bit pc-relative branch. The lowest bit must be zero and is -not stored in the instruction. The 2nd lowest bit comes from a 1 bit -field in the instruction. -@end deffn -@deffn {} BFD_RELOC_THUMB_PCREL_BLX -Thumb 22 bit pc-relative branch. The lowest bit must be zero and is -not stored in the instruction. The 2nd lowest bit comes from a 1 bit -field in the instruction. -@end deffn -@deffn {} BFD_RELOC_ARM_PCREL_CALL -ARM 26-bit pc-relative branch for an unconditional BL or BLX instruction. -@end deffn -@deffn {} BFD_RELOC_ARM_PCREL_JUMP -ARM 26-bit pc-relative branch for B or conditional BL instruction. -@end deffn -@deffn {} BFD_RELOC_THUMB_PCREL_BRANCH7 -@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH9 -@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH12 -@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH20 -@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH23 -@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH25 -Thumb 7-, 9-, 12-, 20-, 23-, and 25-bit pc-relative branches. -The lowest bit must be zero and is not stored in the instruction. -Note that the corresponding ELF R_ARM_THM_JUMPnn constant has an -"nn" one smaller in all cases. Note further that BRANCH23 -corresponds to R_ARM_THM_CALL. -@end deffn -@deffn {} BFD_RELOC_ARM_OFFSET_IMM -12-bit immediate offset, used in ARM-format ldr and str instructions. -@end deffn -@deffn {} BFD_RELOC_ARM_THUMB_OFFSET -5-bit immediate offset, used in Thumb-format ldr and str instructions. -@end deffn -@deffn {} BFD_RELOC_ARM_TARGET1 -Pc-relative or absolute relocation depending on target. Used for -entries in .init_array sections. -@end deffn -@deffn {} BFD_RELOC_ARM_ROSEGREL32 -Read-only segment base relative address. -@end deffn -@deffn {} BFD_RELOC_ARM_SBREL32 -Data segment base relative address. -@end deffn -@deffn {} BFD_RELOC_ARM_TARGET2 -This reloc is used for references to RTTI data from exception handling -tables. The actual definition depends on the target. It may be a -pc-relative or some form of GOT-indirect relocation. -@end deffn -@deffn {} BFD_RELOC_ARM_PREL31 -31-bit PC relative address. -@end deffn -@deffn {} BFD_RELOC_ARM_JUMP_SLOT -@deffnx {} BFD_RELOC_ARM_GLOB_DAT -@deffnx {} BFD_RELOC_ARM_GOT32 -@deffnx {} BFD_RELOC_ARM_PLT32 -@deffnx {} BFD_RELOC_ARM_RELATIVE -@deffnx {} BFD_RELOC_ARM_GOTOFF -@deffnx {} BFD_RELOC_ARM_GOTPC -Relocations for setting up GOTs and PLTs for shared libraries. -@end deffn -@deffn {} BFD_RELOC_ARM_TLS_GD32 -@deffnx {} BFD_RELOC_ARM_TLS_LDO32 -@deffnx {} BFD_RELOC_ARM_TLS_LDM32 -@deffnx {} BFD_RELOC_ARM_TLS_DTPOFF32 -@deffnx {} BFD_RELOC_ARM_TLS_DTPMOD32 -@deffnx {} BFD_RELOC_ARM_TLS_TPOFF32 -@deffnx {} BFD_RELOC_ARM_TLS_IE32 -@deffnx {} BFD_RELOC_ARM_TLS_LE32 -ARM thread-local storage relocations. -@end deffn -@deffn {} BFD_RELOC_ARM_IMMEDIATE -@deffnx {} BFD_RELOC_ARM_ADRL_IMMEDIATE -@deffnx {} BFD_RELOC_ARM_T32_IMMEDIATE -@deffnx {} BFD_RELOC_ARM_T32_IMM12 -@deffnx {} BFD_RELOC_ARM_T32_ADD_PC12 -@deffnx {} BFD_RELOC_ARM_SHIFT_IMM -@deffnx {} BFD_RELOC_ARM_SMC -@deffnx {} BFD_RELOC_ARM_SWI -@deffnx {} BFD_RELOC_ARM_MULTI -@deffnx {} BFD_RELOC_ARM_CP_OFF_IMM -@deffnx {} BFD_RELOC_ARM_CP_OFF_IMM_S2 -@deffnx {} BFD_RELOC_ARM_T32_CP_OFF_IMM -@deffnx {} BFD_RELOC_ARM_T32_CP_OFF_IMM_S2 -@deffnx {} BFD_RELOC_ARM_ADR_IMM -@deffnx {} BFD_RELOC_ARM_LDR_IMM -@deffnx {} BFD_RELOC_ARM_LITERAL -@deffnx {} BFD_RELOC_ARM_IN_POOL -@deffnx {} BFD_RELOC_ARM_OFFSET_IMM8 -@deffnx {} BFD_RELOC_ARM_T32_OFFSET_U8 -@deffnx {} BFD_RELOC_ARM_T32_OFFSET_IMM -@deffnx {} BFD_RELOC_ARM_HWLITERAL -@deffnx {} BFD_RELOC_ARM_THUMB_ADD -@deffnx {} BFD_RELOC_ARM_THUMB_IMM -@deffnx {} BFD_RELOC_ARM_THUMB_SHIFT -These relocs are only used within the ARM assembler. They are not -(at present) written to any object files. -@end deffn -@deffn {} BFD_RELOC_SH_PCDISP8BY2 -@deffnx {} BFD_RELOC_SH_PCDISP12BY2 -@deffnx {} BFD_RELOC_SH_IMM3 -@deffnx {} BFD_RELOC_SH_IMM3U -@deffnx {} BFD_RELOC_SH_DISP12 -@deffnx {} BFD_RELOC_SH_DISP12BY2 -@deffnx {} BFD_RELOC_SH_DISP12BY4 -@deffnx {} BFD_RELOC_SH_DISP12BY8 -@deffnx {} BFD_RELOC_SH_DISP20 -@deffnx {} BFD_RELOC_SH_DISP20BY8 -@deffnx {} BFD_RELOC_SH_IMM4 -@deffnx {} BFD_RELOC_SH_IMM4BY2 -@deffnx {} BFD_RELOC_SH_IMM4BY4 -@deffnx {} BFD_RELOC_SH_IMM8 -@deffnx {} BFD_RELOC_SH_IMM8BY2 -@deffnx {} BFD_RELOC_SH_IMM8BY4 -@deffnx {} BFD_RELOC_SH_PCRELIMM8BY2 -@deffnx {} BFD_RELOC_SH_PCRELIMM8BY4 -@deffnx {} BFD_RELOC_SH_SWITCH16 -@deffnx {} BFD_RELOC_SH_SWITCH32 -@deffnx {} BFD_RELOC_SH_USES -@deffnx {} BFD_RELOC_SH_COUNT -@deffnx {} BFD_RELOC_SH_ALIGN -@deffnx {} BFD_RELOC_SH_CODE -@deffnx {} BFD_RELOC_SH_DATA -@deffnx {} BFD_RELOC_SH_LABEL -@deffnx {} BFD_RELOC_SH_LOOP_START -@deffnx {} BFD_RELOC_SH_LOOP_END -@deffnx {} BFD_RELOC_SH_COPY -@deffnx {} BFD_RELOC_SH_GLOB_DAT -@deffnx {} BFD_RELOC_SH_JMP_SLOT -@deffnx {} BFD_RELOC_SH_RELATIVE -@deffnx {} BFD_RELOC_SH_GOTPC -@deffnx {} BFD_RELOC_SH_GOT_LOW16 -@deffnx {} BFD_RELOC_SH_GOT_MEDLOW16 -@deffnx {} BFD_RELOC_SH_GOT_MEDHI16 -@deffnx {} BFD_RELOC_SH_GOT_HI16 -@deffnx {} BFD_RELOC_SH_GOTPLT_LOW16 -@deffnx {} BFD_RELOC_SH_GOTPLT_MEDLOW16 -@deffnx {} BFD_RELOC_SH_GOTPLT_MEDHI16 -@deffnx {} BFD_RELOC_SH_GOTPLT_HI16 -@deffnx {} BFD_RELOC_SH_PLT_LOW16 -@deffnx {} BFD_RELOC_SH_PLT_MEDLOW16 -@deffnx {} BFD_RELOC_SH_PLT_MEDHI16 -@deffnx {} BFD_RELOC_SH_PLT_HI16 -@deffnx {} BFD_RELOC_SH_GOTOFF_LOW16 -@deffnx {} BFD_RELOC_SH_GOTOFF_MEDLOW16 -@deffnx {} BFD_RELOC_SH_GOTOFF_MEDHI16 -@deffnx {} BFD_RELOC_SH_GOTOFF_HI16 -@deffnx {} BFD_RELOC_SH_GOTPC_LOW16 -@deffnx {} BFD_RELOC_SH_GOTPC_MEDLOW16 -@deffnx {} BFD_RELOC_SH_GOTPC_MEDHI16 -@deffnx {} BFD_RELOC_SH_GOTPC_HI16 -@deffnx {} BFD_RELOC_SH_COPY64 -@deffnx {} BFD_RELOC_SH_GLOB_DAT64 -@deffnx {} BFD_RELOC_SH_JMP_SLOT64 -@deffnx {} BFD_RELOC_SH_RELATIVE64 -@deffnx {} BFD_RELOC_SH_GOT10BY4 -@deffnx {} BFD_RELOC_SH_GOT10BY8 -@deffnx {} BFD_RELOC_SH_GOTPLT10BY4 -@deffnx {} BFD_RELOC_SH_GOTPLT10BY8 -@deffnx {} BFD_RELOC_SH_GOTPLT32 -@deffnx {} BFD_RELOC_SH_SHMEDIA_CODE -@deffnx {} BFD_RELOC_SH_IMMU5 -@deffnx {} BFD_RELOC_SH_IMMS6 -@deffnx {} BFD_RELOC_SH_IMMS6BY32 -@deffnx {} BFD_RELOC_SH_IMMU6 -@deffnx {} BFD_RELOC_SH_IMMS10 -@deffnx {} BFD_RELOC_SH_IMMS10BY2 -@deffnx {} BFD_RELOC_SH_IMMS10BY4 -@deffnx {} BFD_RELOC_SH_IMMS10BY8 -@deffnx {} BFD_RELOC_SH_IMMS16 -@deffnx {} BFD_RELOC_SH_IMMU16 -@deffnx {} BFD_RELOC_SH_IMM_LOW16 -@deffnx {} BFD_RELOC_SH_IMM_LOW16_PCREL -@deffnx {} BFD_RELOC_SH_IMM_MEDLOW16 -@deffnx {} BFD_RELOC_SH_IMM_MEDLOW16_PCREL -@deffnx {} BFD_RELOC_SH_IMM_MEDHI16 -@deffnx {} BFD_RELOC_SH_IMM_MEDHI16_PCREL -@deffnx {} BFD_RELOC_SH_IMM_HI16 -@deffnx {} BFD_RELOC_SH_IMM_HI16_PCREL -@deffnx {} BFD_RELOC_SH_PT_16 -@deffnx {} BFD_RELOC_SH_TLS_GD_32 -@deffnx {} BFD_RELOC_SH_TLS_LD_32 -@deffnx {} BFD_RELOC_SH_TLS_LDO_32 -@deffnx {} BFD_RELOC_SH_TLS_IE_32 -@deffnx {} BFD_RELOC_SH_TLS_LE_32 -@deffnx {} BFD_RELOC_SH_TLS_DTPMOD32 -@deffnx {} BFD_RELOC_SH_TLS_DTPOFF32 -@deffnx {} BFD_RELOC_SH_TLS_TPOFF32 -Renesas / SuperH SH relocs. Not all of these appear in object files. -@end deffn -@deffn {} BFD_RELOC_ARC_B22_PCREL -ARC Cores relocs. -ARC 22 bit pc-relative branch. The lowest two bits must be zero and are -not stored in the instruction. The high 20 bits are installed in bits 26 -through 7 of the instruction. -@end deffn -@deffn {} BFD_RELOC_ARC_B26 -ARC 26 bit absolute branch. The lowest two bits must be zero and are not -stored in the instruction. The high 24 bits are installed in bits 23 -through 0. -@end deffn -@deffn {} BFD_RELOC_BFIN_16_IMM -ADI Blackfin 16 bit immediate absolute reloc. -@end deffn -@deffn {} BFD_RELOC_BFIN_16_HIGH -ADI Blackfin 16 bit immediate absolute reloc higher 16 bits. -@end deffn -@deffn {} BFD_RELOC_BFIN_4_PCREL -ADI Blackfin 'a' part of LSETUP. -@end deffn -@deffn {} BFD_RELOC_BFIN_5_PCREL -ADI Blackfin. -@end deffn -@deffn {} BFD_RELOC_BFIN_16_LOW -ADI Blackfin 16 bit immediate absolute reloc lower 16 bits. -@end deffn -@deffn {} BFD_RELOC_BFIN_10_PCREL -ADI Blackfin. -@end deffn -@deffn {} BFD_RELOC_BFIN_11_PCREL -ADI Blackfin 'b' part of LSETUP. -@end deffn -@deffn {} BFD_RELOC_BFIN_12_PCREL_JUMP -ADI Blackfin. -@end deffn -@deffn {} BFD_RELOC_BFIN_12_PCREL_JUMP_S -ADI Blackfin Short jump, pcrel. -@end deffn -@deffn {} BFD_RELOC_BFIN_24_PCREL_CALL_X -ADI Blackfin Call.x not implemented. -@end deffn -@deffn {} BFD_RELOC_BFIN_24_PCREL_JUMP_L -ADI Blackfin Long Jump pcrel. -@end deffn -@deffn {} BFD_RELOC_BFIN_GOT17M4 -@deffnx {} BFD_RELOC_BFIN_GOTHI -@deffnx {} BFD_RELOC_BFIN_GOTLO -@deffnx {} BFD_RELOC_BFIN_FUNCDESC -@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOT17M4 -@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTHI -@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTLO -@deffnx {} BFD_RELOC_BFIN_FUNCDESC_VALUE -@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTOFF17M4 -@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTOFFHI -@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTOFFLO -@deffnx {} BFD_RELOC_BFIN_GOTOFF17M4 -@deffnx {} BFD_RELOC_BFIN_GOTOFFHI -@deffnx {} BFD_RELOC_BFIN_GOTOFFLO -ADI Blackfin FD-PIC relocations. -@end deffn -@deffn {} BFD_RELOC_BFIN_GOT -ADI Blackfin GOT relocation. -@end deffn -@deffn {} BFD_RELOC_BFIN_PLTPC -ADI Blackfin PLTPC relocation. -@end deffn -@deffn {} BFD_ARELOC_BFIN_PUSH -ADI Blackfin arithmetic relocation. -@end deffn -@deffn {} BFD_ARELOC_BFIN_CONST -ADI Blackfin arithmetic relocation. -@end deffn -@deffn {} BFD_ARELOC_BFIN_ADD -ADI Blackfin arithmetic relocation. -@end deffn -@deffn {} BFD_ARELOC_BFIN_SUB -ADI Blackfin arithmetic relocation. -@end deffn -@deffn {} BFD_ARELOC_BFIN_MULT -ADI Blackfin arithmetic relocation. -@end deffn -@deffn {} BFD_ARELOC_BFIN_DIV -ADI Blackfin arithmetic relocation. -@end deffn -@deffn {} BFD_ARELOC_BFIN_MOD -ADI Blackfin arithmetic relocation. -@end deffn -@deffn {} BFD_ARELOC_BFIN_LSHIFT -ADI Blackfin arithmetic relocation. -@end deffn -@deffn {} BFD_ARELOC_BFIN_RSHIFT -ADI Blackfin arithmetic relocation. -@end deffn -@deffn {} BFD_ARELOC_BFIN_AND -ADI Blackfin arithmetic relocation. -@end deffn -@deffn {} BFD_ARELOC_BFIN_OR -ADI Blackfin arithmetic relocation. -@end deffn -@deffn {} BFD_ARELOC_BFIN_XOR -ADI Blackfin arithmetic relocation. -@end deffn -@deffn {} BFD_ARELOC_BFIN_LAND -ADI Blackfin arithmetic relocation. -@end deffn -@deffn {} BFD_ARELOC_BFIN_LOR -ADI Blackfin arithmetic relocation. -@end deffn -@deffn {} BFD_ARELOC_BFIN_LEN -ADI Blackfin arithmetic relocation. -@end deffn -@deffn {} BFD_ARELOC_BFIN_NEG -ADI Blackfin arithmetic relocation. -@end deffn -@deffn {} BFD_ARELOC_BFIN_COMP -ADI Blackfin arithmetic relocation. -@end deffn -@deffn {} BFD_ARELOC_BFIN_PAGE -ADI Blackfin arithmetic relocation. -@end deffn -@deffn {} BFD_ARELOC_BFIN_HWPAGE -ADI Blackfin arithmetic relocation. -@end deffn -@deffn {} BFD_ARELOC_BFIN_ADDR -ADI Blackfin arithmetic relocation. -@end deffn -@deffn {} BFD_RELOC_D10V_10_PCREL_R -Mitsubishi D10V relocs. -This is a 10-bit reloc with the right 2 bits -assumed to be 0. -@end deffn -@deffn {} BFD_RELOC_D10V_10_PCREL_L -Mitsubishi D10V relocs. -This is a 10-bit reloc with the right 2 bits -assumed to be 0. This is the same as the previous reloc -except it is in the left container, i.e., -shifted left 15 bits. -@end deffn -@deffn {} BFD_RELOC_D10V_18 -This is an 18-bit reloc with the right 2 bits -assumed to be 0. -@end deffn -@deffn {} BFD_RELOC_D10V_18_PCREL -This is an 18-bit reloc with the right 2 bits -assumed to be 0. -@end deffn -@deffn {} BFD_RELOC_D30V_6 -Mitsubishi D30V relocs. -This is a 6-bit absolute reloc. -@end deffn -@deffn {} BFD_RELOC_D30V_9_PCREL -This is a 6-bit pc-relative reloc with -the right 3 bits assumed to be 0. -@end deffn -@deffn {} BFD_RELOC_D30V_9_PCREL_R -This is a 6-bit pc-relative reloc with -the right 3 bits assumed to be 0. Same -as the previous reloc but on the right side -of the container. -@end deffn -@deffn {} BFD_RELOC_D30V_15 -This is a 12-bit absolute reloc with the -right 3 bitsassumed to be 0. -@end deffn -@deffn {} BFD_RELOC_D30V_15_PCREL -This is a 12-bit pc-relative reloc with -the right 3 bits assumed to be 0. -@end deffn -@deffn {} BFD_RELOC_D30V_15_PCREL_R -This is a 12-bit pc-relative reloc with -the right 3 bits assumed to be 0. Same -as the previous reloc but on the right side -of the container. -@end deffn -@deffn {} BFD_RELOC_D30V_21 -This is an 18-bit absolute reloc with -the right 3 bits assumed to be 0. -@end deffn -@deffn {} BFD_RELOC_D30V_21_PCREL -This is an 18-bit pc-relative reloc with -the right 3 bits assumed to be 0. -@end deffn -@deffn {} BFD_RELOC_D30V_21_PCREL_R -This is an 18-bit pc-relative reloc with -the right 3 bits assumed to be 0. Same -as the previous reloc but on the right side -of the container. -@end deffn -@deffn {} BFD_RELOC_D30V_32 -This is a 32-bit absolute reloc. -@end deffn -@deffn {} BFD_RELOC_D30V_32_PCREL -This is a 32-bit pc-relative reloc. -@end deffn -@deffn {} BFD_RELOC_DLX_HI16_S -DLX relocs -@end deffn -@deffn {} BFD_RELOC_DLX_LO16 -DLX relocs -@end deffn -@deffn {} BFD_RELOC_DLX_JMP26 -DLX relocs -@end deffn -@deffn {} BFD_RELOC_M32C_HI8 -@deffnx {} BFD_RELOC_M32C_RL_JUMP -@deffnx {} BFD_RELOC_M32C_RL_1ADDR -@deffnx {} BFD_RELOC_M32C_RL_2ADDR -Renesas M16C/M32C Relocations. -@end deffn -@deffn {} BFD_RELOC_M32R_24 -Renesas M32R (formerly Mitsubishi M32R) relocs. -This is a 24 bit absolute address. -@end deffn -@deffn {} BFD_RELOC_M32R_10_PCREL -This is a 10-bit pc-relative reloc with the right 2 bits assumed to be 0. -@end deffn -@deffn {} BFD_RELOC_M32R_18_PCREL -This is an 18-bit reloc with the right 2 bits assumed to be 0. -@end deffn -@deffn {} BFD_RELOC_M32R_26_PCREL -This is a 26-bit reloc with the right 2 bits assumed to be 0. -@end deffn -@deffn {} BFD_RELOC_M32R_HI16_ULO -This is a 16-bit reloc containing the high 16 bits of an address -used when the lower 16 bits are treated as unsigned. -@end deffn -@deffn {} BFD_RELOC_M32R_HI16_SLO -This is a 16-bit reloc containing the high 16 bits of an address -used when the lower 16 bits are treated as signed. -@end deffn -@deffn {} BFD_RELOC_M32R_LO16 -This is a 16-bit reloc containing the lower 16 bits of an address. -@end deffn -@deffn {} BFD_RELOC_M32R_SDA16 -This is a 16-bit reloc containing the small data area offset for use in -add3, load, and store instructions. -@end deffn -@deffn {} BFD_RELOC_M32R_GOT24 -@deffnx {} BFD_RELOC_M32R_26_PLTREL -@deffnx {} BFD_RELOC_M32R_COPY -@deffnx {} BFD_RELOC_M32R_GLOB_DAT -@deffnx {} BFD_RELOC_M32R_JMP_SLOT -@deffnx {} BFD_RELOC_M32R_RELATIVE -@deffnx {} BFD_RELOC_M32R_GOTOFF -@deffnx {} BFD_RELOC_M32R_GOTOFF_HI_ULO -@deffnx {} BFD_RELOC_M32R_GOTOFF_HI_SLO -@deffnx {} BFD_RELOC_M32R_GOTOFF_LO -@deffnx {} BFD_RELOC_M32R_GOTPC24 -@deffnx {} BFD_RELOC_M32R_GOT16_HI_ULO -@deffnx {} BFD_RELOC_M32R_GOT16_HI_SLO -@deffnx {} BFD_RELOC_M32R_GOT16_LO -@deffnx {} BFD_RELOC_M32R_GOTPC_HI_ULO -@deffnx {} BFD_RELOC_M32R_GOTPC_HI_SLO -@deffnx {} BFD_RELOC_M32R_GOTPC_LO -For PIC. -@end deffn -@deffn {} BFD_RELOC_V850_9_PCREL -This is a 9-bit reloc -@end deffn -@deffn {} BFD_RELOC_V850_22_PCREL -This is a 22-bit reloc -@end deffn -@deffn {} BFD_RELOC_V850_SDA_16_16_OFFSET -This is a 16 bit offset from the short data area pointer. -@end deffn -@deffn {} BFD_RELOC_V850_SDA_15_16_OFFSET -This is a 16 bit offset (of which only 15 bits are used) from the -short data area pointer. -@end deffn -@deffn {} BFD_RELOC_V850_ZDA_16_16_OFFSET -This is a 16 bit offset from the zero data area pointer. -@end deffn -@deffn {} BFD_RELOC_V850_ZDA_15_16_OFFSET -This is a 16 bit offset (of which only 15 bits are used) from the -zero data area pointer. -@end deffn -@deffn {} BFD_RELOC_V850_TDA_6_8_OFFSET -This is an 8 bit offset (of which only 6 bits are used) from the -tiny data area pointer. -@end deffn -@deffn {} BFD_RELOC_V850_TDA_7_8_OFFSET -This is an 8bit offset (of which only 7 bits are used) from the tiny -data area pointer. -@end deffn -@deffn {} BFD_RELOC_V850_TDA_7_7_OFFSET -This is a 7 bit offset from the tiny data area pointer. -@end deffn -@deffn {} BFD_RELOC_V850_TDA_16_16_OFFSET -This is a 16 bit offset from the tiny data area pointer. -@end deffn -@deffn {} BFD_RELOC_V850_TDA_4_5_OFFSET -This is a 5 bit offset (of which only 4 bits are used) from the tiny -data area pointer. -@end deffn -@deffn {} BFD_RELOC_V850_TDA_4_4_OFFSET -This is a 4 bit offset from the tiny data area pointer. -@end deffn -@deffn {} BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET -This is a 16 bit offset from the short data area pointer, with the -bits placed non-contiguously in the instruction. -@end deffn -@deffn {} BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET -This is a 16 bit offset from the zero data area pointer, with the -bits placed non-contiguously in the instruction. -@end deffn -@deffn {} BFD_RELOC_V850_CALLT_6_7_OFFSET -This is a 6 bit offset from the call table base pointer. -@end deffn -@deffn {} BFD_RELOC_V850_CALLT_16_16_OFFSET -This is a 16 bit offset from the call table base pointer. -@end deffn -@deffn {} BFD_RELOC_V850_LONGCALL -Used for relaxing indirect function calls. -@end deffn -@deffn {} BFD_RELOC_V850_LONGJUMP -Used for relaxing indirect jumps. -@end deffn -@deffn {} BFD_RELOC_V850_ALIGN -Used to maintain alignment whilst relaxing. -@end deffn -@deffn {} BFD_RELOC_V850_LO16_SPLIT_OFFSET -This is a variation of BFD_RELOC_LO16 that can be used in v850e ld.bu -instructions. -@end deffn -@deffn {} BFD_RELOC_MN10300_32_PCREL -This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the -instruction. -@end deffn -@deffn {} BFD_RELOC_MN10300_16_PCREL -This is a 16bit pcrel reloc for the mn10300, offset by two bytes in the -instruction. -@end deffn -@deffn {} BFD_RELOC_TIC30_LDP -This is a 8bit DP reloc for the tms320c30, where the most -significant 8 bits of a 24 bit word are placed into the least -significant 8 bits of the opcode. -@end deffn -@deffn {} BFD_RELOC_TIC54X_PARTLS7 -This is a 7bit reloc for the tms320c54x, where the least -significant 7 bits of a 16 bit word are placed into the least -significant 7 bits of the opcode. -@end deffn -@deffn {} BFD_RELOC_TIC54X_PARTMS9 -This is a 9bit DP reloc for the tms320c54x, where the most -significant 9 bits of a 16 bit word are placed into the least -significant 9 bits of the opcode. -@end deffn -@deffn {} BFD_RELOC_TIC54X_23 -This is an extended address 23-bit reloc for the tms320c54x. -@end deffn -@deffn {} BFD_RELOC_TIC54X_16_OF_23 -This is a 16-bit reloc for the tms320c54x, where the least -significant 16 bits of a 23-bit extended address are placed into -the opcode. -@end deffn -@deffn {} BFD_RELOC_TIC54X_MS7_OF_23 -This is a reloc for the tms320c54x, where the most -significant 7 bits of a 23-bit extended address are placed into -the opcode. -@end deffn -@deffn {} BFD_RELOC_FR30_48 -This is a 48 bit reloc for the FR30 that stores 32 bits. -@end deffn -@deffn {} BFD_RELOC_FR30_20 -This is a 32 bit reloc for the FR30 that stores 20 bits split up into -two sections. -@end deffn -@deffn {} BFD_RELOC_FR30_6_IN_4 -This is a 16 bit reloc for the FR30 that stores a 6 bit word offset in -4 bits. -@end deffn -@deffn {} BFD_RELOC_FR30_8_IN_8 -This is a 16 bit reloc for the FR30 that stores an 8 bit byte offset -into 8 bits. -@end deffn -@deffn {} BFD_RELOC_FR30_9_IN_8 -This is a 16 bit reloc for the FR30 that stores a 9 bit short offset -into 8 bits. -@end deffn -@deffn {} BFD_RELOC_FR30_10_IN_8 -This is a 16 bit reloc for the FR30 that stores a 10 bit word offset -into 8 bits. -@end deffn -@deffn {} BFD_RELOC_FR30_9_PCREL -This is a 16 bit reloc for the FR30 that stores a 9 bit pc relative -short offset into 8 bits. -@end deffn -@deffn {} BFD_RELOC_FR30_12_PCREL -This is a 16 bit reloc for the FR30 that stores a 12 bit pc relative -short offset into 11 bits. -@end deffn -@deffn {} BFD_RELOC_MCORE_PCREL_IMM8BY4 -@deffnx {} BFD_RELOC_MCORE_PCREL_IMM11BY2 -@deffnx {} BFD_RELOC_MCORE_PCREL_IMM4BY2 -@deffnx {} BFD_RELOC_MCORE_PCREL_32 -@deffnx {} BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2 -@deffnx {} BFD_RELOC_MCORE_RVA -Motorola Mcore relocations. -@end deffn -@deffn {} BFD_RELOC_MMIX_GETA -@deffnx {} BFD_RELOC_MMIX_GETA_1 -@deffnx {} BFD_RELOC_MMIX_GETA_2 -@deffnx {} BFD_RELOC_MMIX_GETA_3 -These are relocations for the GETA instruction. -@end deffn -@deffn {} BFD_RELOC_MMIX_CBRANCH -@deffnx {} BFD_RELOC_MMIX_CBRANCH_J -@deffnx {} BFD_RELOC_MMIX_CBRANCH_1 -@deffnx {} BFD_RELOC_MMIX_CBRANCH_2 -@deffnx {} BFD_RELOC_MMIX_CBRANCH_3 -These are relocations for a conditional branch instruction. -@end deffn -@deffn {} BFD_RELOC_MMIX_PUSHJ -@deffnx {} BFD_RELOC_MMIX_PUSHJ_1 -@deffnx {} BFD_RELOC_MMIX_PUSHJ_2 -@deffnx {} BFD_RELOC_MMIX_PUSHJ_3 -@deffnx {} BFD_RELOC_MMIX_PUSHJ_STUBBABLE -These are relocations for the PUSHJ instruction. -@end deffn -@deffn {} BFD_RELOC_MMIX_JMP -@deffnx {} BFD_RELOC_MMIX_JMP_1 -@deffnx {} BFD_RELOC_MMIX_JMP_2 -@deffnx {} BFD_RELOC_MMIX_JMP_3 -These are relocations for the JMP instruction. -@end deffn -@deffn {} BFD_RELOC_MMIX_ADDR19 -This is a relocation for a relative address as in a GETA instruction or -a branch. -@end deffn -@deffn {} BFD_RELOC_MMIX_ADDR27 -This is a relocation for a relative address as in a JMP instruction. -@end deffn -@deffn {} BFD_RELOC_MMIX_REG_OR_BYTE -This is a relocation for an instruction field that may be a general -register or a value 0..255. -@end deffn -@deffn {} BFD_RELOC_MMIX_REG -This is a relocation for an instruction field that may be a general -register. -@end deffn -@deffn {} BFD_RELOC_MMIX_BASE_PLUS_OFFSET -This is a relocation for two instruction fields holding a register and -an offset, the equivalent of the relocation. -@end deffn -@deffn {} BFD_RELOC_MMIX_LOCAL -This relocation is an assertion that the expression is not allocated as -a global register. It does not modify contents. -@end deffn -@deffn {} BFD_RELOC_AVR_7_PCREL -This is a 16 bit reloc for the AVR that stores 8 bit pc relative -short offset into 7 bits. -@end deffn -@deffn {} BFD_RELOC_AVR_13_PCREL -This is a 16 bit reloc for the AVR that stores 13 bit pc relative -short offset into 12 bits. -@end deffn -@deffn {} BFD_RELOC_AVR_16_PM -This is a 16 bit reloc for the AVR that stores 17 bit value (usually -program memory address) into 16 bits. -@end deffn -@deffn {} BFD_RELOC_AVR_LO8_LDI -This is a 16 bit reloc for the AVR that stores 8 bit value (usually -data memory address) into 8 bit immediate value of LDI insn. -@end deffn -@deffn {} BFD_RELOC_AVR_HI8_LDI -This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit -of data memory address) into 8 bit immediate value of LDI insn. -@end deffn -@deffn {} BFD_RELOC_AVR_HH8_LDI -This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit -of program memory address) into 8 bit immediate value of LDI insn. -@end deffn -@deffn {} BFD_RELOC_AVR_MS8_LDI -This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit -of 32 bit value) into 8 bit immediate value of LDI insn. -@end deffn -@deffn {} BFD_RELOC_AVR_LO8_LDI_NEG -This is a 16 bit reloc for the AVR that stores negated 8 bit value -(usually data memory address) into 8 bit immediate value of SUBI insn. -@end deffn -@deffn {} BFD_RELOC_AVR_HI8_LDI_NEG -This is a 16 bit reloc for the AVR that stores negated 8 bit value -(high 8 bit of data memory address) into 8 bit immediate value of -SUBI insn. -@end deffn -@deffn {} BFD_RELOC_AVR_HH8_LDI_NEG -This is a 16 bit reloc for the AVR that stores negated 8 bit value -(most high 8 bit of program memory address) into 8 bit immediate value -of LDI or SUBI insn. -@end deffn -@deffn {} BFD_RELOC_AVR_MS8_LDI_NEG -This is a 16 bit reloc for the AVR that stores negated 8 bit value (msb -of 32 bit value) into 8 bit immediate value of LDI insn. -@end deffn -@deffn {} BFD_RELOC_AVR_LO8_LDI_PM -This is a 16 bit reloc for the AVR that stores 8 bit value (usually -command address) into 8 bit immediate value of LDI insn. -@end deffn -@deffn {} BFD_RELOC_AVR_HI8_LDI_PM -This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit -of command address) into 8 bit immediate value of LDI insn. -@end deffn -@deffn {} BFD_RELOC_AVR_HH8_LDI_PM -This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit -of command address) into 8 bit immediate value of LDI insn. -@end deffn -@deffn {} BFD_RELOC_AVR_LO8_LDI_PM_NEG -This is a 16 bit reloc for the AVR that stores negated 8 bit value -(usually command address) into 8 bit immediate value of SUBI insn. -@end deffn -@deffn {} BFD_RELOC_AVR_HI8_LDI_PM_NEG -This is a 16 bit reloc for the AVR that stores negated 8 bit value -(high 8 bit of 16 bit command address) into 8 bit immediate value -of SUBI insn. -@end deffn -@deffn {} BFD_RELOC_AVR_HH8_LDI_PM_NEG -This is a 16 bit reloc for the AVR that stores negated 8 bit value -(high 6 bit of 22 bit command address) into 8 bit immediate -value of SUBI insn. -@end deffn -@deffn {} BFD_RELOC_AVR_CALL -This is a 32 bit reloc for the AVR that stores 23 bit value -into 22 bits. -@end deffn -@deffn {} BFD_RELOC_AVR_LDI -This is a 16 bit reloc for the AVR that stores all needed bits -for absolute addressing with ldi with overflow check to linktime -@end deffn -@deffn {} BFD_RELOC_AVR_6 -This is a 6 bit reloc for the AVR that stores offset for ldd/std -instructions -@end deffn -@deffn {} BFD_RELOC_AVR_6_ADIW -This is a 6 bit reloc for the AVR that stores offset for adiw/sbiw -instructions -@end deffn -@deffn {} BFD_RELOC_390_12 -Direct 12 bit. -@end deffn -@deffn {} BFD_RELOC_390_GOT12 -12 bit GOT offset. -@end deffn -@deffn {} BFD_RELOC_390_PLT32 -32 bit PC relative PLT address. -@end deffn -@deffn {} BFD_RELOC_390_COPY -Copy symbol at runtime. -@end deffn -@deffn {} BFD_RELOC_390_GLOB_DAT -Create GOT entry. -@end deffn -@deffn {} BFD_RELOC_390_JMP_SLOT -Create PLT entry. -@end deffn -@deffn {} BFD_RELOC_390_RELATIVE -Adjust by program base. -@end deffn -@deffn {} BFD_RELOC_390_GOTPC -32 bit PC relative offset to GOT. -@end deffn -@deffn {} BFD_RELOC_390_GOT16 -16 bit GOT offset. -@end deffn -@deffn {} BFD_RELOC_390_PC16DBL -PC relative 16 bit shifted by 1. -@end deffn -@deffn {} BFD_RELOC_390_PLT16DBL -16 bit PC rel. PLT shifted by 1. -@end deffn -@deffn {} BFD_RELOC_390_PC32DBL -PC relative 32 bit shifted by 1. -@end deffn -@deffn {} BFD_RELOC_390_PLT32DBL -32 bit PC rel. PLT shifted by 1. -@end deffn -@deffn {} BFD_RELOC_390_GOTPCDBL -32 bit PC rel. GOT shifted by 1. -@end deffn -@deffn {} BFD_RELOC_390_GOT64 -64 bit GOT offset. -@end deffn -@deffn {} BFD_RELOC_390_PLT64 -64 bit PC relative PLT address. -@end deffn -@deffn {} BFD_RELOC_390_GOTENT -32 bit rel. offset to GOT entry. -@end deffn -@deffn {} BFD_RELOC_390_GOTOFF64 -64 bit offset to GOT. -@end deffn -@deffn {} BFD_RELOC_390_GOTPLT12 -12-bit offset to symbol-entry within GOT, with PLT handling. -@end deffn -@deffn {} BFD_RELOC_390_GOTPLT16 -16-bit offset to symbol-entry within GOT, with PLT handling. -@end deffn -@deffn {} BFD_RELOC_390_GOTPLT32 -32-bit offset to symbol-entry within GOT, with PLT handling. -@end deffn -@deffn {} BFD_RELOC_390_GOTPLT64 -64-bit offset to symbol-entry within GOT, with PLT handling. -@end deffn -@deffn {} BFD_RELOC_390_GOTPLTENT -32-bit rel. offset to symbol-entry within GOT, with PLT handling. -@end deffn -@deffn {} BFD_RELOC_390_PLTOFF16 -16-bit rel. offset from the GOT to a PLT entry. -@end deffn -@deffn {} BFD_RELOC_390_PLTOFF32 -32-bit rel. offset from the GOT to a PLT entry. -@end deffn -@deffn {} BFD_RELOC_390_PLTOFF64 -64-bit rel. offset from the GOT to a PLT entry. -@end deffn -@deffn {} BFD_RELOC_390_TLS_LOAD -@deffnx {} BFD_RELOC_390_TLS_GDCALL -@deffnx {} BFD_RELOC_390_TLS_LDCALL -@deffnx {} BFD_RELOC_390_TLS_GD32 -@deffnx {} BFD_RELOC_390_TLS_GD64 -@deffnx {} BFD_RELOC_390_TLS_GOTIE12 -@deffnx {} BFD_RELOC_390_TLS_GOTIE32 -@deffnx {} BFD_RELOC_390_TLS_GOTIE64 -@deffnx {} BFD_RELOC_390_TLS_LDM32 -@deffnx {} BFD_RELOC_390_TLS_LDM64 -@deffnx {} BFD_RELOC_390_TLS_IE32 -@deffnx {} BFD_RELOC_390_TLS_IE64 -@deffnx {} BFD_RELOC_390_TLS_IEENT -@deffnx {} BFD_RELOC_390_TLS_LE32 -@deffnx {} BFD_RELOC_390_TLS_LE64 -@deffnx {} BFD_RELOC_390_TLS_LDO32 -@deffnx {} BFD_RELOC_390_TLS_LDO64 -@deffnx {} BFD_RELOC_390_TLS_DTPMOD -@deffnx {} BFD_RELOC_390_TLS_DTPOFF -@deffnx {} BFD_RELOC_390_TLS_TPOFF -s390 tls relocations. -@end deffn -@deffn {} BFD_RELOC_390_20 -@deffnx {} BFD_RELOC_390_GOT20 -@deffnx {} BFD_RELOC_390_GOTPLT20 -@deffnx {} BFD_RELOC_390_TLS_GOTIE20 -Long displacement extension. -@end deffn -@deffn {} BFD_RELOC_IP2K_FR9 -Scenix IP2K - 9-bit register number / data address -@end deffn -@deffn {} BFD_RELOC_IP2K_BANK -Scenix IP2K - 4-bit register/data bank number -@end deffn -@deffn {} BFD_RELOC_IP2K_ADDR16CJP -Scenix IP2K - low 13 bits of instruction word address -@end deffn -@deffn {} BFD_RELOC_IP2K_PAGE3 -Scenix IP2K - high 3 bits of instruction word address -@end deffn -@deffn {} BFD_RELOC_IP2K_LO8DATA -@deffnx {} BFD_RELOC_IP2K_HI8DATA -@deffnx {} BFD_RELOC_IP2K_EX8DATA -Scenix IP2K - ext/low/high 8 bits of data address -@end deffn -@deffn {} BFD_RELOC_IP2K_LO8INSN -@deffnx {} BFD_RELOC_IP2K_HI8INSN -Scenix IP2K - low/high 8 bits of instruction word address -@end deffn -@deffn {} BFD_RELOC_IP2K_PC_SKIP -Scenix IP2K - even/odd PC modifier to modify snb pcl.0 -@end deffn -@deffn {} BFD_RELOC_IP2K_TEXT -Scenix IP2K - 16 bit word address in text section. -@end deffn -@deffn {} BFD_RELOC_IP2K_FR_OFFSET -Scenix IP2K - 7-bit sp or dp offset -@end deffn -@deffn {} BFD_RELOC_VPE4KMATH_DATA -@deffnx {} BFD_RELOC_VPE4KMATH_INSN -Scenix VPE4K coprocessor - data/insn-space addressing -@end deffn -@deffn {} BFD_RELOC_VTABLE_INHERIT -@deffnx {} BFD_RELOC_VTABLE_ENTRY -These two relocations are used by the linker to determine which of -the entries in a C++ virtual function table are actually used. When -the --gc-sections option is given, the linker will zero out the entries -that are not used, so that the code for those functions need not be -included in the output. - -VTABLE_INHERIT is a zero-space relocation used to describe to the -linker the inheritance tree of a C++ virtual function table. The -relocation's symbol should be the parent class' vtable, and the -relocation should be located at the child vtable. - -VTABLE_ENTRY is a zero-space relocation that describes the use of a -virtual function table entry. The reloc's symbol should refer to the -table of the class mentioned in the code. Off of that base, an offset -describes the entry that is being used. For Rela hosts, this offset -is stored in the reloc's addend. For Rel hosts, we are forced to put -this offset in the reloc's section offset. -@end deffn -@deffn {} BFD_RELOC_IA64_IMM14 -@deffnx {} BFD_RELOC_IA64_IMM22 -@deffnx {} BFD_RELOC_IA64_IMM64 -@deffnx {} BFD_RELOC_IA64_DIR32MSB -@deffnx {} BFD_RELOC_IA64_DIR32LSB -@deffnx {} BFD_RELOC_IA64_DIR64MSB -@deffnx {} BFD_RELOC_IA64_DIR64LSB -@deffnx {} BFD_RELOC_IA64_GPREL22 -@deffnx {} BFD_RELOC_IA64_GPREL64I -@deffnx {} BFD_RELOC_IA64_GPREL32MSB -@deffnx {} BFD_RELOC_IA64_GPREL32LSB -@deffnx {} BFD_RELOC_IA64_GPREL64MSB -@deffnx {} BFD_RELOC_IA64_GPREL64LSB -@deffnx {} BFD_RELOC_IA64_LTOFF22 -@deffnx {} BFD_RELOC_IA64_LTOFF64I -@deffnx {} BFD_RELOC_IA64_PLTOFF22 -@deffnx {} BFD_RELOC_IA64_PLTOFF64I -@deffnx {} BFD_RELOC_IA64_PLTOFF64MSB -@deffnx {} BFD_RELOC_IA64_PLTOFF64LSB -@deffnx {} BFD_RELOC_IA64_FPTR64I -@deffnx {} BFD_RELOC_IA64_FPTR32MSB -@deffnx {} BFD_RELOC_IA64_FPTR32LSB -@deffnx {} BFD_RELOC_IA64_FPTR64MSB -@deffnx {} BFD_RELOC_IA64_FPTR64LSB -@deffnx {} BFD_RELOC_IA64_PCREL21B -@deffnx {} BFD_RELOC_IA64_PCREL21BI -@deffnx {} BFD_RELOC_IA64_PCREL21M -@deffnx {} BFD_RELOC_IA64_PCREL21F -@deffnx {} BFD_RELOC_IA64_PCREL22 -@deffnx {} BFD_RELOC_IA64_PCREL60B -@deffnx {} BFD_RELOC_IA64_PCREL64I -@deffnx {} BFD_RELOC_IA64_PCREL32MSB -@deffnx {} BFD_RELOC_IA64_PCREL32LSB -@deffnx {} BFD_RELOC_IA64_PCREL64MSB -@deffnx {} BFD_RELOC_IA64_PCREL64LSB -@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR22 -@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR64I -@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR32MSB -@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR32LSB -@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR64MSB -@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR64LSB -@deffnx {} BFD_RELOC_IA64_SEGREL32MSB -@deffnx {} BFD_RELOC_IA64_SEGREL32LSB -@deffnx {} BFD_RELOC_IA64_SEGREL64MSB -@deffnx {} BFD_RELOC_IA64_SEGREL64LSB -@deffnx {} BFD_RELOC_IA64_SECREL32MSB -@deffnx {} BFD_RELOC_IA64_SECREL32LSB -@deffnx {} BFD_RELOC_IA64_SECREL64MSB -@deffnx {} BFD_RELOC_IA64_SECREL64LSB -@deffnx {} BFD_RELOC_IA64_REL32MSB -@deffnx {} BFD_RELOC_IA64_REL32LSB -@deffnx {} BFD_RELOC_IA64_REL64MSB -@deffnx {} BFD_RELOC_IA64_REL64LSB -@deffnx {} BFD_RELOC_IA64_LTV32MSB -@deffnx {} BFD_RELOC_IA64_LTV32LSB -@deffnx {} BFD_RELOC_IA64_LTV64MSB -@deffnx {} BFD_RELOC_IA64_LTV64LSB -@deffnx {} BFD_RELOC_IA64_IPLTMSB -@deffnx {} BFD_RELOC_IA64_IPLTLSB -@deffnx {} BFD_RELOC_IA64_COPY -@deffnx {} BFD_RELOC_IA64_LTOFF22X -@deffnx {} BFD_RELOC_IA64_LDXMOV -@deffnx {} BFD_RELOC_IA64_TPREL14 -@deffnx {} BFD_RELOC_IA64_TPREL22 -@deffnx {} BFD_RELOC_IA64_TPREL64I -@deffnx {} BFD_RELOC_IA64_TPREL64MSB -@deffnx {} BFD_RELOC_IA64_TPREL64LSB -@deffnx {} BFD_RELOC_IA64_LTOFF_TPREL22 -@deffnx {} BFD_RELOC_IA64_DTPMOD64MSB -@deffnx {} BFD_RELOC_IA64_DTPMOD64LSB -@deffnx {} BFD_RELOC_IA64_LTOFF_DTPMOD22 -@deffnx {} BFD_RELOC_IA64_DTPREL14 -@deffnx {} BFD_RELOC_IA64_DTPREL22 -@deffnx {} BFD_RELOC_IA64_DTPREL64I -@deffnx {} BFD_RELOC_IA64_DTPREL32MSB -@deffnx {} BFD_RELOC_IA64_DTPREL32LSB -@deffnx {} BFD_RELOC_IA64_DTPREL64MSB -@deffnx {} BFD_RELOC_IA64_DTPREL64LSB -@deffnx {} BFD_RELOC_IA64_LTOFF_DTPREL22 -Intel IA64 Relocations. -@end deffn -@deffn {} BFD_RELOC_M68HC11_HI8 -Motorola 68HC11 reloc. -This is the 8 bit high part of an absolute address. -@end deffn -@deffn {} BFD_RELOC_M68HC11_LO8 -Motorola 68HC11 reloc. -This is the 8 bit low part of an absolute address. -@end deffn -@deffn {} BFD_RELOC_M68HC11_3B -Motorola 68HC11 reloc. -This is the 3 bit of a value. -@end deffn -@deffn {} BFD_RELOC_M68HC11_RL_JUMP -Motorola 68HC11 reloc. -This reloc marks the beginning of a jump/call instruction. -It is used for linker relaxation to correctly identify beginning -of instruction and change some branches to use PC-relative -addressing mode. -@end deffn -@deffn {} BFD_RELOC_M68HC11_RL_GROUP -Motorola 68HC11 reloc. -This reloc marks a group of several instructions that gcc generates -and for which the linker relaxation pass can modify and/or remove -some of them. -@end deffn -@deffn {} BFD_RELOC_M68HC11_LO16 -Motorola 68HC11 reloc. -This is the 16-bit lower part of an address. It is used for 'call' -instruction to specify the symbol address without any special -transformation (due to memory bank window). -@end deffn -@deffn {} BFD_RELOC_M68HC11_PAGE -Motorola 68HC11 reloc. -This is a 8-bit reloc that specifies the page number of an address. -It is used by 'call' instruction to specify the page number of -the symbol. -@end deffn -@deffn {} BFD_RELOC_M68HC11_24 -Motorola 68HC11 reloc. -This is a 24-bit reloc that represents the address with a 16-bit -value and a 8-bit page number. The symbol address is transformed -to follow the 16K memory bank of 68HC12 (seen as mapped in the window). -@end deffn -@deffn {} BFD_RELOC_M68HC12_5B -Motorola 68HC12 reloc. -This is the 5 bits of a value. -@end deffn -@deffn {} BFD_RELOC_16C_NUM08 -@deffnx {} BFD_RELOC_16C_NUM08_C -@deffnx {} BFD_RELOC_16C_NUM16 -@deffnx {} BFD_RELOC_16C_NUM16_C -@deffnx {} BFD_RELOC_16C_NUM32 -@deffnx {} BFD_RELOC_16C_NUM32_C -@deffnx {} BFD_RELOC_16C_DISP04 -@deffnx {} BFD_RELOC_16C_DISP04_C -@deffnx {} BFD_RELOC_16C_DISP08 -@deffnx {} BFD_RELOC_16C_DISP08_C -@deffnx {} BFD_RELOC_16C_DISP16 -@deffnx {} BFD_RELOC_16C_DISP16_C -@deffnx {} BFD_RELOC_16C_DISP24 -@deffnx {} BFD_RELOC_16C_DISP24_C -@deffnx {} BFD_RELOC_16C_DISP24a -@deffnx {} BFD_RELOC_16C_DISP24a_C -@deffnx {} BFD_RELOC_16C_REG04 -@deffnx {} BFD_RELOC_16C_REG04_C -@deffnx {} BFD_RELOC_16C_REG04a -@deffnx {} BFD_RELOC_16C_REG04a_C -@deffnx {} BFD_RELOC_16C_REG14 -@deffnx {} BFD_RELOC_16C_REG14_C -@deffnx {} BFD_RELOC_16C_REG16 -@deffnx {} BFD_RELOC_16C_REG16_C -@deffnx {} BFD_RELOC_16C_REG20 -@deffnx {} BFD_RELOC_16C_REG20_C -@deffnx {} BFD_RELOC_16C_ABS20 -@deffnx {} BFD_RELOC_16C_ABS20_C -@deffnx {} BFD_RELOC_16C_ABS24 -@deffnx {} BFD_RELOC_16C_ABS24_C -@deffnx {} BFD_RELOC_16C_IMM04 -@deffnx {} BFD_RELOC_16C_IMM04_C -@deffnx {} BFD_RELOC_16C_IMM16 -@deffnx {} BFD_RELOC_16C_IMM16_C -@deffnx {} BFD_RELOC_16C_IMM20 -@deffnx {} BFD_RELOC_16C_IMM20_C -@deffnx {} BFD_RELOC_16C_IMM24 -@deffnx {} BFD_RELOC_16C_IMM24_C -@deffnx {} BFD_RELOC_16C_IMM32 -@deffnx {} BFD_RELOC_16C_IMM32_C -NS CR16C Relocations. -@end deffn -@deffn {} BFD_RELOC_CRX_REL4 -@deffnx {} BFD_RELOC_CRX_REL8 -@deffnx {} BFD_RELOC_CRX_REL8_CMP -@deffnx {} BFD_RELOC_CRX_REL16 -@deffnx {} BFD_RELOC_CRX_REL24 -@deffnx {} BFD_RELOC_CRX_REL32 -@deffnx {} BFD_RELOC_CRX_REGREL12 -@deffnx {} BFD_RELOC_CRX_REGREL22 -@deffnx {} BFD_RELOC_CRX_REGREL28 -@deffnx {} BFD_RELOC_CRX_REGREL32 -@deffnx {} BFD_RELOC_CRX_ABS16 -@deffnx {} BFD_RELOC_CRX_ABS32 -@deffnx {} BFD_RELOC_CRX_NUM8 -@deffnx {} BFD_RELOC_CRX_NUM16 -@deffnx {} BFD_RELOC_CRX_NUM32 -@deffnx {} BFD_RELOC_CRX_IMM16 -@deffnx {} BFD_RELOC_CRX_IMM32 -@deffnx {} BFD_RELOC_CRX_SWITCH8 -@deffnx {} BFD_RELOC_CRX_SWITCH16 -@deffnx {} BFD_RELOC_CRX_SWITCH32 -NS CRX Relocations. -@end deffn -@deffn {} BFD_RELOC_CRIS_BDISP8 -@deffnx {} BFD_RELOC_CRIS_UNSIGNED_5 -@deffnx {} BFD_RELOC_CRIS_SIGNED_6 -@deffnx {} BFD_RELOC_CRIS_UNSIGNED_6 -@deffnx {} BFD_RELOC_CRIS_SIGNED_8 -@deffnx {} BFD_RELOC_CRIS_UNSIGNED_8 -@deffnx {} BFD_RELOC_CRIS_SIGNED_16 -@deffnx {} BFD_RELOC_CRIS_UNSIGNED_16 -@deffnx {} BFD_RELOC_CRIS_LAPCQ_OFFSET -@deffnx {} BFD_RELOC_CRIS_UNSIGNED_4 -These relocs are only used within the CRIS assembler. They are not -(at present) written to any object files. -@end deffn -@deffn {} BFD_RELOC_CRIS_COPY -@deffnx {} BFD_RELOC_CRIS_GLOB_DAT -@deffnx {} BFD_RELOC_CRIS_JUMP_SLOT -@deffnx {} BFD_RELOC_CRIS_RELATIVE -Relocs used in ELF shared libraries for CRIS. -@end deffn -@deffn {} BFD_RELOC_CRIS_32_GOT -32-bit offset to symbol-entry within GOT. -@end deffn -@deffn {} BFD_RELOC_CRIS_16_GOT -16-bit offset to symbol-entry within GOT. -@end deffn -@deffn {} BFD_RELOC_CRIS_32_GOTPLT -32-bit offset to symbol-entry within GOT, with PLT handling. -@end deffn -@deffn {} BFD_RELOC_CRIS_16_GOTPLT -16-bit offset to symbol-entry within GOT, with PLT handling. -@end deffn -@deffn {} BFD_RELOC_CRIS_32_GOTREL -32-bit offset to symbol, relative to GOT. -@end deffn -@deffn {} BFD_RELOC_CRIS_32_PLT_GOTREL -32-bit offset to symbol with PLT entry, relative to GOT. -@end deffn -@deffn {} BFD_RELOC_CRIS_32_PLT_PCREL -32-bit offset to symbol with PLT entry, relative to this relocation. -@end deffn -@deffn {} BFD_RELOC_860_COPY -@deffnx {} BFD_RELOC_860_GLOB_DAT -@deffnx {} BFD_RELOC_860_JUMP_SLOT -@deffnx {} BFD_RELOC_860_RELATIVE -@deffnx {} BFD_RELOC_860_PC26 -@deffnx {} BFD_RELOC_860_PLT26 -@deffnx {} BFD_RELOC_860_PC16 -@deffnx {} BFD_RELOC_860_LOW0 -@deffnx {} BFD_RELOC_860_SPLIT0 -@deffnx {} BFD_RELOC_860_LOW1 -@deffnx {} BFD_RELOC_860_SPLIT1 -@deffnx {} BFD_RELOC_860_LOW2 -@deffnx {} BFD_RELOC_860_SPLIT2 -@deffnx {} BFD_RELOC_860_LOW3 -@deffnx {} BFD_RELOC_860_LOGOT0 -@deffnx {} BFD_RELOC_860_SPGOT0 -@deffnx {} BFD_RELOC_860_LOGOT1 -@deffnx {} BFD_RELOC_860_SPGOT1 -@deffnx {} BFD_RELOC_860_LOGOTOFF0 -@deffnx {} BFD_RELOC_860_SPGOTOFF0 -@deffnx {} BFD_RELOC_860_LOGOTOFF1 -@deffnx {} BFD_RELOC_860_SPGOTOFF1 -@deffnx {} BFD_RELOC_860_LOGOTOFF2 -@deffnx {} BFD_RELOC_860_LOGOTOFF3 -@deffnx {} BFD_RELOC_860_LOPC -@deffnx {} BFD_RELOC_860_HIGHADJ -@deffnx {} BFD_RELOC_860_HAGOT -@deffnx {} BFD_RELOC_860_HAGOTOFF -@deffnx {} BFD_RELOC_860_HAPC -@deffnx {} BFD_RELOC_860_HIGH -@deffnx {} BFD_RELOC_860_HIGOT -@deffnx {} BFD_RELOC_860_HIGOTOFF -Intel i860 Relocations. -@end deffn -@deffn {} BFD_RELOC_OPENRISC_ABS_26 -@deffnx {} BFD_RELOC_OPENRISC_REL_26 -OpenRISC Relocations. -@end deffn -@deffn {} BFD_RELOC_H8_DIR16A8 -@deffnx {} BFD_RELOC_H8_DIR16R8 -@deffnx {} BFD_RELOC_H8_DIR24A8 -@deffnx {} BFD_RELOC_H8_DIR24R8 -@deffnx {} BFD_RELOC_H8_DIR32A16 -H8 elf Relocations. -@end deffn -@deffn {} BFD_RELOC_XSTORMY16_REL_12 -@deffnx {} BFD_RELOC_XSTORMY16_12 -@deffnx {} BFD_RELOC_XSTORMY16_24 -@deffnx {} BFD_RELOC_XSTORMY16_FPTR16 -Sony Xstormy16 Relocations. -@end deffn -@deffn {} BFD_RELOC_XC16X_PAG -@deffnx {} BFD_RELOC_XC16X_POF -@deffnx {} BFD_RELOC_XC16X_SEG -@deffnx {} BFD_RELOC_XC16X_SOF -Infineon Relocations. -@end deffn -@deffn {} BFD_RELOC_VAX_GLOB_DAT -@deffnx {} BFD_RELOC_VAX_JMP_SLOT -@deffnx {} BFD_RELOC_VAX_RELATIVE -Relocations used by VAX ELF. -@end deffn -@deffn {} BFD_RELOC_MT_PC16 -Morpho MT - 16 bit immediate relocation. -@end deffn -@deffn {} BFD_RELOC_MT_HI16 -Morpho MT - Hi 16 bits of an address. -@end deffn -@deffn {} BFD_RELOC_MT_LO16 -Morpho MT - Low 16 bits of an address. -@end deffn -@deffn {} BFD_RELOC_MT_GNU_VTINHERIT -Morpho MT - Used to tell the linker which vtable entries are used. -@end deffn -@deffn {} BFD_RELOC_MT_GNU_VTENTRY -Morpho MT - Used to tell the linker which vtable entries are used. -@end deffn -@deffn {} BFD_RELOC_MT_PCINSN8 -Morpho MT - 8 bit immediate relocation. -@end deffn -@deffn {} BFD_RELOC_MSP430_10_PCREL -@deffnx {} BFD_RELOC_MSP430_16_PCREL -@deffnx {} BFD_RELOC_MSP430_16 -@deffnx {} BFD_RELOC_MSP430_16_PCREL_BYTE -@deffnx {} BFD_RELOC_MSP430_16_BYTE -@deffnx {} BFD_RELOC_MSP430_2X_PCREL -@deffnx {} BFD_RELOC_MSP430_RL_PCREL -msp430 specific relocation codes -@end deffn -@deffn {} BFD_RELOC_IQ2000_OFFSET_16 -@deffnx {} BFD_RELOC_IQ2000_OFFSET_21 -@deffnx {} BFD_RELOC_IQ2000_UHI16 -IQ2000 Relocations. -@end deffn -@deffn {} BFD_RELOC_XTENSA_RTLD -Special Xtensa relocation used only by PLT entries in ELF shared -objects to indicate that the runtime linker should set the value -to one of its own internal functions or data structures. -@end deffn -@deffn {} BFD_RELOC_XTENSA_GLOB_DAT -@deffnx {} BFD_RELOC_XTENSA_JMP_SLOT -@deffnx {} BFD_RELOC_XTENSA_RELATIVE -Xtensa relocations for ELF shared objects. -@end deffn -@deffn {} BFD_RELOC_XTENSA_PLT -Xtensa relocation used in ELF object files for symbols that may require -PLT entries. Otherwise, this is just a generic 32-bit relocation. -@end deffn -@deffn {} BFD_RELOC_XTENSA_DIFF8 -@deffnx {} BFD_RELOC_XTENSA_DIFF16 -@deffnx {} BFD_RELOC_XTENSA_DIFF32 -Xtensa relocations to mark the difference of two local symbols. -These are only needed to support linker relaxation and can be ignored -when not relaxing. The field is set to the value of the difference -assuming no relaxation. The relocation encodes the position of the -first symbol so the linker can determine whether to adjust the field -value. -@end deffn -@deffn {} BFD_RELOC_XTENSA_SLOT0_OP -@deffnx {} BFD_RELOC_XTENSA_SLOT1_OP -@deffnx {} BFD_RELOC_XTENSA_SLOT2_OP -@deffnx {} BFD_RELOC_XTENSA_SLOT3_OP -@deffnx {} BFD_RELOC_XTENSA_SLOT4_OP -@deffnx {} BFD_RELOC_XTENSA_SLOT5_OP -@deffnx {} BFD_RELOC_XTENSA_SLOT6_OP -@deffnx {} BFD_RELOC_XTENSA_SLOT7_OP -@deffnx {} BFD_RELOC_XTENSA_SLOT8_OP -@deffnx {} BFD_RELOC_XTENSA_SLOT9_OP -@deffnx {} BFD_RELOC_XTENSA_SLOT10_OP -@deffnx {} BFD_RELOC_XTENSA_SLOT11_OP -@deffnx {} BFD_RELOC_XTENSA_SLOT12_OP -@deffnx {} BFD_RELOC_XTENSA_SLOT13_OP -@deffnx {} BFD_RELOC_XTENSA_SLOT14_OP -Generic Xtensa relocations for instruction operands. Only the slot -number is encoded in the relocation. The relocation applies to the -last PC-relative immediate operand, or if there are no PC-relative -immediates, to the last immediate operand. -@end deffn -@deffn {} BFD_RELOC_XTENSA_SLOT0_ALT -@deffnx {} BFD_RELOC_XTENSA_SLOT1_ALT -@deffnx {} BFD_RELOC_XTENSA_SLOT2_ALT -@deffnx {} BFD_RELOC_XTENSA_SLOT3_ALT -@deffnx {} BFD_RELOC_XTENSA_SLOT4_ALT -@deffnx {} BFD_RELOC_XTENSA_SLOT5_ALT -@deffnx {} BFD_RELOC_XTENSA_SLOT6_ALT -@deffnx {} BFD_RELOC_XTENSA_SLOT7_ALT -@deffnx {} BFD_RELOC_XTENSA_SLOT8_ALT -@deffnx {} BFD_RELOC_XTENSA_SLOT9_ALT -@deffnx {} BFD_RELOC_XTENSA_SLOT10_ALT -@deffnx {} BFD_RELOC_XTENSA_SLOT11_ALT -@deffnx {} BFD_RELOC_XTENSA_SLOT12_ALT -@deffnx {} BFD_RELOC_XTENSA_SLOT13_ALT -@deffnx {} BFD_RELOC_XTENSA_SLOT14_ALT -Alternate Xtensa relocations. Only the slot is encoded in the -relocation. The meaning of these relocations is opcode-specific. -@end deffn -@deffn {} BFD_RELOC_XTENSA_OP0 -@deffnx {} BFD_RELOC_XTENSA_OP1 -@deffnx {} BFD_RELOC_XTENSA_OP2 -Xtensa relocations for backward compatibility. These have all been -replaced by BFD_RELOC_XTENSA_SLOT0_OP. -@end deffn -@deffn {} BFD_RELOC_XTENSA_ASM_EXPAND -Xtensa relocation to mark that the assembler expanded the -instructions from an original target. The expansion size is -encoded in the reloc size. -@end deffn -@deffn {} BFD_RELOC_XTENSA_ASM_SIMPLIFY -Xtensa relocation to mark that the linker should simplify -assembler-expanded instructions. This is commonly used -internally by the linker after analysis of a -BFD_RELOC_XTENSA_ASM_EXPAND. -@end deffn -@deffn {} BFD_RELOC_Z80_DISP8 -8 bit signed offset in (ix+d) or (iy+d). -@end deffn -@deffn {} BFD_RELOC_Z8K_DISP7 -DJNZ offset. -@end deffn -@deffn {} BFD_RELOC_Z8K_CALLR -CALR offset. -@end deffn -@deffn {} BFD_RELOC_Z8K_IMM4L -4 bit value. -@end deffn - -@example - -typedef enum bfd_reloc_code_real bfd_reloc_code_real_type; -@end example -@findex bfd_reloc_type_lookup -@subsubsection @code{bfd_reloc_type_lookup} -@strong{Synopsis} -@example -reloc_howto_type *bfd_reloc_type_lookup - (bfd *abfd, bfd_reloc_code_real_type code); -@end example -@strong{Description}@* -Return a pointer to a howto structure which, when -invoked, will perform the relocation @var{code} on data from the -architecture noted. - -@findex bfd_default_reloc_type_lookup -@subsubsection @code{bfd_default_reloc_type_lookup} -@strong{Synopsis} -@example -reloc_howto_type *bfd_default_reloc_type_lookup - (bfd *abfd, bfd_reloc_code_real_type code); -@end example -@strong{Description}@* -Provides a default relocation lookup routine for any architecture. - -@findex bfd_get_reloc_code_name -@subsubsection @code{bfd_get_reloc_code_name} -@strong{Synopsis} -@example -const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code); -@end example -@strong{Description}@* -Provides a printable name for the supplied relocation code. -Useful mainly for printing error messages. - -@findex bfd_generic_relax_section -@subsubsection @code{bfd_generic_relax_section} -@strong{Synopsis} -@example -bfd_boolean bfd_generic_relax_section - (bfd *abfd, - asection *section, - struct bfd_link_info *, - bfd_boolean *); -@end example -@strong{Description}@* -Provides default handling for relaxing for back ends which -don't do relaxing. - -@findex bfd_generic_gc_sections -@subsubsection @code{bfd_generic_gc_sections} -@strong{Synopsis} -@example -bfd_boolean bfd_generic_gc_sections - (bfd *, struct bfd_link_info *); -@end example -@strong{Description}@* -Provides default handling for relaxing for back ends which -don't do section gc -- i.e., does nothing. - -@findex bfd_generic_merge_sections -@subsubsection @code{bfd_generic_merge_sections} -@strong{Synopsis} -@example -bfd_boolean bfd_generic_merge_sections - (bfd *, struct bfd_link_info *); -@end example -@strong{Description}@* -Provides default handling for SEC_MERGE section merging for back ends -which don't have SEC_MERGE support -- i.e., does nothing. - -@findex bfd_generic_get_relocated_section_contents -@subsubsection @code{bfd_generic_get_relocated_section_contents} -@strong{Synopsis} -@example -bfd_byte *bfd_generic_get_relocated_section_contents - (bfd *abfd, - struct bfd_link_info *link_info, - struct bfd_link_order *link_order, - bfd_byte *data, - bfd_boolean relocatable, - asymbol **symbols); -@end example -@strong{Description}@* -Provides default handling of relocation effort for back ends -which can't be bothered to do it efficiently. - diff --git a/contrib/binutils/bfd/doc/section.texi b/contrib/binutils/bfd/doc/section.texi deleted file mode 100644 index 4347679ef49c..000000000000 --- a/contrib/binutils/bfd/doc/section.texi +++ /dev/null @@ -1,989 +0,0 @@ -@section Sections -The raw data contained within a BFD is maintained through the -section abstraction. A single BFD may have any number of -sections. It keeps hold of them by pointing to the first; -each one points to the next in the list. - -Sections are supported in BFD in @code{section.c}. - -@menu -* Section Input:: -* Section Output:: -* typedef asection:: -* section prototypes:: -@end menu - -@node Section Input, Section Output, Sections, Sections -@subsection Section input -When a BFD is opened for reading, the section structures are -created and attached to the BFD. - -Each section has a name which describes the section in the -outside world---for example, @code{a.out} would contain at least -three sections, called @code{.text}, @code{.data} and @code{.bss}. - -Names need not be unique; for example a COFF file may have several -sections named @code{.data}. - -Sometimes a BFD will contain more than the ``natural'' number of -sections. A back end may attach other sections containing -constructor data, or an application may add a section (using -@code{bfd_make_section}) to the sections attached to an already open -BFD. For example, the linker creates an extra section -@code{COMMON} for each input file's BFD to hold information about -common storage. - -The raw data is not necessarily read in when -the section descriptor is created. Some targets may leave the -data in place until a @code{bfd_get_section_contents} call is -made. Other back ends may read in all the data at once. For -example, an S-record file has to be read once to determine the -size of the data. An IEEE-695 file doesn't contain raw data in -sections, but data and relocation expressions intermixed, so -the data area has to be parsed to get out the data and -relocations. - -@node Section Output, typedef asection, Section Input, Sections -@subsection Section output -To write a new object style BFD, the various sections to be -written have to be created. They are attached to the BFD in -the same way as input sections; data is written to the -sections using @code{bfd_set_section_contents}. - -Any program that creates or combines sections (e.g., the assembler -and linker) must use the @code{asection} fields @code{output_section} and -@code{output_offset} to indicate the file sections to which each -section must be written. (If the section is being created from -scratch, @code{output_section} should probably point to the section -itself and @code{output_offset} should probably be zero.) - -The data to be written comes from input sections attached -(via @code{output_section} pointers) to -the output sections. The output section structure can be -considered a filter for the input section: the output section -determines the vma of the output data and the name, but the -input section determines the offset into the output section of -the data to be written. - -E.g., to create a section "O", starting at 0x100, 0x123 long, -containing two subsections, "A" at offset 0x0 (i.e., at vma -0x100) and "B" at offset 0x20 (i.e., at vma 0x120) the @code{asection} -structures would look like: - -@example - section name "A" - output_offset 0x00 - size 0x20 - output_section -----------> section name "O" - | vma 0x100 - section name "B" | size 0x123 - output_offset 0x20 | - size 0x103 | - output_section --------| -@end example - -@subsection Link orders -The data within a section is stored in a @dfn{link_order}. -These are much like the fixups in @code{gas}. The link_order -abstraction allows a section to grow and shrink within itself. - -A link_order knows how big it is, and which is the next -link_order and where the raw data for it is; it also points to -a list of relocations which apply to it. - -The link_order is used by the linker to perform relaxing on -final code. The compiler creates code which is as big as -necessary to make it work without relaxing, and the user can -select whether to relax. Sometimes relaxing takes a lot of -time. The linker runs around the relocations to see if any -are attached to data which can be shrunk, if so it does it on -a link_order by link_order basis. - - -@node typedef asection, section prototypes, Section Output, Sections -@subsection typedef asection -Here is the section structure: - - -@example - -typedef struct bfd_section -@{ - /* The name of the section; the name isn't a copy, the pointer is - the same as that passed to bfd_make_section. */ - const char *name; - - /* A unique sequence number. */ - int id; - - /* Which section in the bfd; 0..n-1 as sections are created in a bfd. */ - int index; - - /* The next section in the list belonging to the BFD, or NULL. */ - struct bfd_section *next; - - /* The previous section in the list belonging to the BFD, or NULL. */ - struct bfd_section *prev; - - /* The field flags contains attributes of the section. Some - flags are read in from the object file, and some are - synthesized from other information. */ - flagword flags; - -#define SEC_NO_FLAGS 0x000 - - /* Tells the OS to allocate space for this section when loading. - This is clear for a section containing debug information only. */ -#define SEC_ALLOC 0x001 - - /* Tells the OS to load the section from the file when loading. - This is clear for a .bss section. */ -#define SEC_LOAD 0x002 - - /* The section contains data still to be relocated, so there is - some relocation information too. */ -#define SEC_RELOC 0x004 - - /* A signal to the OS that the section contains read only data. */ -#define SEC_READONLY 0x008 - - /* The section contains code only. */ -#define SEC_CODE 0x010 - - /* The section contains data only. */ -#define SEC_DATA 0x020 - - /* The section will reside in ROM. */ -#define SEC_ROM 0x040 - - /* The section contains constructor information. This section - type is used by the linker to create lists of constructors and - destructors used by @code{g++}. When a back end sees a symbol - which should be used in a constructor list, it creates a new - section for the type of name (e.g., @code{__CTOR_LIST__}), attaches - the symbol to it, and builds a relocation. To build the lists - of constructors, all the linker has to do is catenate all the - sections called @code{__CTOR_LIST__} and relocate the data - contained within - exactly the operations it would peform on - standard data. */ -#define SEC_CONSTRUCTOR 0x080 - - /* The section has contents - a data section could be - @code{SEC_ALLOC} | @code{SEC_HAS_CONTENTS}; a debug section could be - @code{SEC_HAS_CONTENTS} */ -#define SEC_HAS_CONTENTS 0x100 - - /* An instruction to the linker to not output the section - even if it has information which would normally be written. */ -#define SEC_NEVER_LOAD 0x200 - - /* The section contains thread local data. */ -#define SEC_THREAD_LOCAL 0x400 - - /* The section has GOT references. This flag is only for the - linker, and is currently only used by the elf32-hppa back end. - It will be set if global offset table references were detected - in this section, which indicate to the linker that the section - contains PIC code, and must be handled specially when doing a - static link. */ -#define SEC_HAS_GOT_REF 0x800 - - /* The section contains common symbols (symbols may be defined - multiple times, the value of a symbol is the amount of - space it requires, and the largest symbol value is the one - used). Most targets have exactly one of these (which we - translate to bfd_com_section_ptr), but ECOFF has two. */ -#define SEC_IS_COMMON 0x1000 - - /* The section contains only debugging information. For - example, this is set for ELF .debug and .stab sections. - strip tests this flag to see if a section can be - discarded. */ -#define SEC_DEBUGGING 0x2000 - - /* The contents of this section are held in memory pointed to - by the contents field. This is checked by bfd_get_section_contents, - and the data is retrieved from memory if appropriate. */ -#define SEC_IN_MEMORY 0x4000 - - /* The contents of this section are to be excluded by the - linker for executable and shared objects unless those - objects are to be further relocated. */ -#define SEC_EXCLUDE 0x8000 - - /* The contents of this section are to be sorted based on the sum of - the symbol and addend values specified by the associated relocation - entries. Entries without associated relocation entries will be - appended to the end of the section in an unspecified order. */ -#define SEC_SORT_ENTRIES 0x10000 - - /* When linking, duplicate sections of the same name should be - discarded, rather than being combined into a single section as - is usually done. This is similar to how common symbols are - handled. See SEC_LINK_DUPLICATES below. */ -#define SEC_LINK_ONCE 0x20000 - - /* If SEC_LINK_ONCE is set, this bitfield describes how the linker - should handle duplicate sections. */ -#define SEC_LINK_DUPLICATES 0x40000 - - /* This value for SEC_LINK_DUPLICATES means that duplicate - sections with the same name should simply be discarded. */ -#define SEC_LINK_DUPLICATES_DISCARD 0x0 - - /* This value for SEC_LINK_DUPLICATES means that the linker - should warn if there are any duplicate sections, although - it should still only link one copy. */ -#define SEC_LINK_DUPLICATES_ONE_ONLY 0x80000 - - /* This value for SEC_LINK_DUPLICATES means that the linker - should warn if any duplicate sections are a different size. */ -#define SEC_LINK_DUPLICATES_SAME_SIZE 0x100000 - - /* This value for SEC_LINK_DUPLICATES means that the linker - should warn if any duplicate sections contain different - contents. */ -#define SEC_LINK_DUPLICATES_SAME_CONTENTS \ - (SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE) - - /* This section was created by the linker as part of dynamic - relocation or other arcane processing. It is skipped when - going through the first-pass output, trusting that someone - else up the line will take care of it later. */ -#define SEC_LINKER_CREATED 0x200000 - - /* This section should not be subject to garbage collection. */ -#define SEC_KEEP 0x400000 - - /* This section contains "short" data, and should be placed - "near" the GP. */ -#define SEC_SMALL_DATA 0x800000 - - /* Attempt to merge identical entities in the section. - Entity size is given in the entsize field. */ -#define SEC_MERGE 0x1000000 - - /* If given with SEC_MERGE, entities to merge are zero terminated - strings where entsize specifies character size instead of fixed - size entries. */ -#define SEC_STRINGS 0x2000000 - - /* This section contains data about section groups. */ -#define SEC_GROUP 0x4000000 - - /* The section is a COFF shared library section. This flag is - only for the linker. If this type of section appears in - the input file, the linker must copy it to the output file - without changing the vma or size. FIXME: Although this - was originally intended to be general, it really is COFF - specific (and the flag was renamed to indicate this). It - might be cleaner to have some more general mechanism to - allow the back end to control what the linker does with - sections. */ -#define SEC_COFF_SHARED_LIBRARY 0x10000000 - - /* This section contains data which may be shared with other - executables or shared objects. This is for COFF only. */ -#define SEC_COFF_SHARED 0x20000000 - - /* When a section with this flag is being linked, then if the size of - the input section is less than a page, it should not cross a page - boundary. If the size of the input section is one page or more, - it should be aligned on a page boundary. This is for TI - TMS320C54X only. */ -#define SEC_TIC54X_BLOCK 0x40000000 - - /* Conditionally link this section; do not link if there are no - references found to any symbol in the section. This is for TI - TMS320C54X only. */ -#define SEC_TIC54X_CLINK 0x80000000 - - /* End of section flags. */ - - /* Some internal packed boolean fields. */ - - /* See the vma field. */ - unsigned int user_set_vma : 1; - - /* A mark flag used by some of the linker backends. */ - unsigned int linker_mark : 1; - - /* Another mark flag used by some of the linker backends. Set for - output sections that have an input section. */ - unsigned int linker_has_input : 1; - - /* Mark flags used by some linker backends for garbage collection. */ - unsigned int gc_mark : 1; - unsigned int gc_mark_from_eh : 1; - - /* The following flags are used by the ELF linker. */ - - /* Mark sections which have been allocated to segments. */ - unsigned int segment_mark : 1; - - /* Type of sec_info information. */ - unsigned int sec_info_type:3; -#define ELF_INFO_TYPE_NONE 0 -#define ELF_INFO_TYPE_STABS 1 -#define ELF_INFO_TYPE_MERGE 2 -#define ELF_INFO_TYPE_EH_FRAME 3 -#define ELF_INFO_TYPE_JUST_SYMS 4 - - /* Nonzero if this section uses RELA relocations, rather than REL. */ - unsigned int use_rela_p:1; - - /* Bits used by various backends. The generic code doesn't touch - these fields. */ - - /* Nonzero if this section has TLS related relocations. */ - unsigned int has_tls_reloc:1; - - /* Nonzero if this section has a gp reloc. */ - unsigned int has_gp_reloc:1; - - /* Nonzero if this section needs the relax finalize pass. */ - unsigned int need_finalize_relax:1; - - /* Whether relocations have been processed. */ - unsigned int reloc_done : 1; - - /* End of internal packed boolean fields. */ - - /* The virtual memory address of the section - where it will be - at run time. The symbols are relocated against this. The - user_set_vma flag is maintained by bfd; if it's not set, the - backend can assign addresses (for example, in @code{a.out}, where - the default address for @code{.data} is dependent on the specific - target and various flags). */ - bfd_vma vma; - - /* The load address of the section - where it would be in a - rom image; really only used for writing section header - information. */ - bfd_vma lma; - - /* The size of the section in octets, as it will be output. - Contains a value even if the section has no contents (e.g., the - size of @code{.bss}). */ - bfd_size_type size; - - /* For input sections, the original size on disk of the section, in - octets. This field is used by the linker relaxation code. It is - currently only set for sections where the linker relaxation scheme - doesn't cache altered section and reloc contents (stabs, eh_frame, - SEC_MERGE, some coff relaxing targets), and thus the original size - needs to be kept to read the section multiple times. - For output sections, rawsize holds the section size calculated on - a previous linker relaxation pass. */ - bfd_size_type rawsize; - - /* If this section is going to be output, then this value is the - offset in *bytes* into the output section of the first byte in the - input section (byte ==> smallest addressable unit on the - target). In most cases, if this was going to start at the - 100th octet (8-bit quantity) in the output section, this value - would be 100. However, if the target byte size is 16 bits - (bfd_octets_per_byte is "2"), this value would be 50. */ - bfd_vma output_offset; - - /* The output section through which to map on output. */ - struct bfd_section *output_section; - - /* The alignment requirement of the section, as an exponent of 2 - - e.g., 3 aligns to 2^3 (or 8). */ - unsigned int alignment_power; - - /* If an input section, a pointer to a vector of relocation - records for the data in this section. */ - struct reloc_cache_entry *relocation; - - /* If an output section, a pointer to a vector of pointers to - relocation records for the data in this section. */ - struct reloc_cache_entry **orelocation; - - /* The number of relocation records in one of the above. */ - unsigned reloc_count; - - /* Information below is back end specific - and not always used - or updated. */ - - /* File position of section data. */ - file_ptr filepos; - - /* File position of relocation info. */ - file_ptr rel_filepos; - - /* File position of line data. */ - file_ptr line_filepos; - - /* Pointer to data for applications. */ - void *userdata; - - /* If the SEC_IN_MEMORY flag is set, this points to the actual - contents. */ - unsigned char *contents; - - /* Attached line number information. */ - alent *lineno; - - /* Number of line number records. */ - unsigned int lineno_count; - - /* Entity size for merging purposes. */ - unsigned int entsize; - - /* Points to the kept section if this section is a link-once section, - and is discarded. */ - struct bfd_section *kept_section; - - /* When a section is being output, this value changes as more - linenumbers are written out. */ - file_ptr moving_line_filepos; - - /* What the section number is in the target world. */ - int target_index; - - void *used_by_bfd; - - /* If this is a constructor section then here is a list of the - relocations created to relocate items within it. */ - struct relent_chain *constructor_chain; - - /* The BFD which owns the section. */ - bfd *owner; - - /* A symbol which points at this section only. */ - struct bfd_symbol *symbol; - struct bfd_symbol **symbol_ptr_ptr; - - /* Early in the link process, map_head and map_tail are used to build - a list of input sections attached to an output section. Later, - output sections use these fields for a list of bfd_link_order - structs. */ - union @{ - struct bfd_link_order *link_order; - struct bfd_section *s; - @} map_head, map_tail; -@} asection; - -/* These sections are global, and are managed by BFD. The application - and target back end are not permitted to change the values in - these sections. New code should use the section_ptr macros rather - than referring directly to the const sections. The const sections - may eventually vanish. */ -#define BFD_ABS_SECTION_NAME "*ABS*" -#define BFD_UND_SECTION_NAME "*UND*" -#define BFD_COM_SECTION_NAME "*COM*" -#define BFD_IND_SECTION_NAME "*IND*" - -/* The absolute section. */ -extern asection bfd_abs_section; -#define bfd_abs_section_ptr ((asection *) &bfd_abs_section) -#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr) -/* Pointer to the undefined section. */ -extern asection bfd_und_section; -#define bfd_und_section_ptr ((asection *) &bfd_und_section) -#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr) -/* Pointer to the common section. */ -extern asection bfd_com_section; -#define bfd_com_section_ptr ((asection *) &bfd_com_section) -/* Pointer to the indirect section. */ -extern asection bfd_ind_section; -#define bfd_ind_section_ptr ((asection *) &bfd_ind_section) -#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr) - -#define bfd_is_const_section(SEC) \ - ( ((SEC) == bfd_abs_section_ptr) \ - || ((SEC) == bfd_und_section_ptr) \ - || ((SEC) == bfd_com_section_ptr) \ - || ((SEC) == bfd_ind_section_ptr)) - -extern const struct bfd_symbol * const bfd_abs_symbol; -extern const struct bfd_symbol * const bfd_com_symbol; -extern const struct bfd_symbol * const bfd_und_symbol; -extern const struct bfd_symbol * const bfd_ind_symbol; - -/* Macros to handle insertion and deletion of a bfd's sections. These - only handle the list pointers, ie. do not adjust section_count, - target_index etc. */ -#define bfd_section_list_remove(ABFD, S) \ - do \ - @{ \ - asection *_s = S; \ - asection *_next = _s->next; \ - asection *_prev = _s->prev; \ - if (_prev) \ - _prev->next = _next; \ - else \ - (ABFD)->sections = _next; \ - if (_next) \ - _next->prev = _prev; \ - else \ - (ABFD)->section_last = _prev; \ - @} \ - while (0) -#define bfd_section_list_append(ABFD, S) \ - do \ - @{ \ - asection *_s = S; \ - bfd *_abfd = ABFD; \ - _s->next = NULL; \ - if (_abfd->section_last) \ - @{ \ - _s->prev = _abfd->section_last; \ - _abfd->section_last->next = _s; \ - @} \ - else \ - @{ \ - _s->prev = NULL; \ - _abfd->sections = _s; \ - @} \ - _abfd->section_last = _s; \ - @} \ - while (0) -#define bfd_section_list_prepend(ABFD, S) \ - do \ - @{ \ - asection *_s = S; \ - bfd *_abfd = ABFD; \ - _s->prev = NULL; \ - if (_abfd->sections) \ - @{ \ - _s->next = _abfd->sections; \ - _abfd->sections->prev = _s; \ - @} \ - else \ - @{ \ - _s->next = NULL; \ - _abfd->section_last = _s; \ - @} \ - _abfd->sections = _s; \ - @} \ - while (0) -#define bfd_section_list_insert_after(ABFD, A, S) \ - do \ - @{ \ - asection *_a = A; \ - asection *_s = S; \ - asection *_next = _a->next; \ - _s->next = _next; \ - _s->prev = _a; \ - _a->next = _s; \ - if (_next) \ - _next->prev = _s; \ - else \ - (ABFD)->section_last = _s; \ - @} \ - while (0) -#define bfd_section_list_insert_before(ABFD, B, S) \ - do \ - @{ \ - asection *_b = B; \ - asection *_s = S; \ - asection *_prev = _b->prev; \ - _s->prev = _prev; \ - _s->next = _b; \ - _b->prev = _s; \ - if (_prev) \ - _prev->next = _s; \ - else \ - (ABFD)->sections = _s; \ - @} \ - while (0) -#define bfd_section_removed_from_list(ABFD, S) \ - ((S)->next == NULL ? (ABFD)->section_last != (S) : (S)->next->prev != (S)) - -#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, SYM_PTR, NAME, IDX) \ - /* name, id, index, next, prev, flags, user_set_vma, */ \ - @{ NAME, IDX, 0, NULL, NULL, FLAGS, 0, \ - \ - /* linker_mark, linker_has_input, gc_mark, gc_mark_from_eh, */ \ - 0, 0, 1, 0, \ - \ - /* segment_mark, sec_info_type, use_rela_p, has_tls_reloc, */ \ - 0, 0, 0, 0, \ - \ - /* has_gp_reloc, need_finalize_relax, reloc_done, */ \ - 0, 0, 0, \ - \ - /* vma, lma, size, rawsize */ \ - 0, 0, 0, 0, \ - \ - /* output_offset, output_section, alignment_power, */ \ - 0, (struct bfd_section *) &SEC, 0, \ - \ - /* relocation, orelocation, reloc_count, filepos, rel_filepos, */ \ - NULL, NULL, 0, 0, 0, \ - \ - /* line_filepos, userdata, contents, lineno, lineno_count, */ \ - 0, NULL, NULL, NULL, 0, \ - \ - /* entsize, kept_section, moving_line_filepos, */ \ - 0, NULL, 0, \ - \ - /* target_index, used_by_bfd, constructor_chain, owner, */ \ - 0, NULL, NULL, NULL, \ - \ - /* symbol, */ \ - (struct bfd_symbol *) SYM, \ - \ - /* symbol_ptr_ptr, */ \ - (struct bfd_symbol **) SYM_PTR, \ - \ - /* map_head, map_tail */ \ - @{ NULL @}, @{ NULL @} \ - @} - -@end example - -@node section prototypes, , typedef asection, Sections -@subsection Section prototypes -These are the functions exported by the section handling part of BFD. - -@findex bfd_section_list_clear -@subsubsection @code{bfd_section_list_clear} -@strong{Synopsis} -@example -void bfd_section_list_clear (bfd *); -@end example -@strong{Description}@* -Clears the section list, and also resets the section count and -hash table entries. - -@findex bfd_get_section_by_name -@subsubsection @code{bfd_get_section_by_name} -@strong{Synopsis} -@example -asection *bfd_get_section_by_name (bfd *abfd, const char *name); -@end example -@strong{Description}@* -Run through @var{abfd} and return the one of the -@code{asection}s whose name matches @var{name}, otherwise @code{NULL}. -@xref{Sections}, for more information. - -This should only be used in special cases; the normal way to process -all sections of a given name is to use @code{bfd_map_over_sections} and -@code{strcmp} on the name (or better yet, base it on the section flags -or something else) for each section. - -@findex bfd_get_section_by_name_if -@subsubsection @code{bfd_get_section_by_name_if} -@strong{Synopsis} -@example -asection *bfd_get_section_by_name_if - (bfd *abfd, - const char *name, - bfd_boolean (*func) (bfd *abfd, asection *sect, void *obj), - void *obj); -@end example -@strong{Description}@* -Call the provided function @var{func} for each section -attached to the BFD @var{abfd} whose name matches @var{name}, -passing @var{obj} as an argument. The function will be called -as if by - -@example - func (abfd, the_section, obj); -@end example - -It returns the first section for which @var{func} returns true, -otherwise @code{NULL}. - -@findex bfd_get_unique_section_name -@subsubsection @code{bfd_get_unique_section_name} -@strong{Synopsis} -@example -char *bfd_get_unique_section_name - (bfd *abfd, const char *templat, int *count); -@end example -@strong{Description}@* -Invent a section name that is unique in @var{abfd} by tacking -a dot and a digit suffix onto the original @var{templat}. If -@var{count} is non-NULL, then it specifies the first number -tried as a suffix to generate a unique name. The value -pointed to by @var{count} will be incremented in this case. - -@findex bfd_make_section_old_way -@subsubsection @code{bfd_make_section_old_way} -@strong{Synopsis} -@example -asection *bfd_make_section_old_way (bfd *abfd, const char *name); -@end example -@strong{Description}@* -Create a new empty section called @var{name} -and attach it to the end of the chain of sections for the -BFD @var{abfd}. An attempt to create a section with a name which -is already in use returns its pointer without changing the -section chain. - -It has the funny name since this is the way it used to be -before it was rewritten.... - -Possible errors are: -@itemize @bullet - -@item -@code{bfd_error_invalid_operation} - -If output has already started for this BFD. -@item -@code{bfd_error_no_memory} - -If memory allocation fails. -@end itemize - -@findex bfd_make_section_anyway_with_flags -@subsubsection @code{bfd_make_section_anyway_with_flags} -@strong{Synopsis} -@example -asection *bfd_make_section_anyway_with_flags - (bfd *abfd, const char *name, flagword flags); -@end example -@strong{Description}@* -Create a new empty section called @var{name} and attach it to the end of -the chain of sections for @var{abfd}. Create a new section even if there -is already a section with that name. Also set the attributes of the -new section to the value @var{flags}. - -Return @code{NULL} and set @code{bfd_error} on error; possible errors are: -@itemize @bullet - -@item -@code{bfd_error_invalid_operation} - If output has already started for @var{abfd}. -@item -@code{bfd_error_no_memory} - If memory allocation fails. -@end itemize - -@findex bfd_make_section_anyway -@subsubsection @code{bfd_make_section_anyway} -@strong{Synopsis} -@example -asection *bfd_make_section_anyway (bfd *abfd, const char *name); -@end example -@strong{Description}@* -Create a new empty section called @var{name} and attach it to the end of -the chain of sections for @var{abfd}. Create a new section even if there -is already a section with that name. - -Return @code{NULL} and set @code{bfd_error} on error; possible errors are: -@itemize @bullet - -@item -@code{bfd_error_invalid_operation} - If output has already started for @var{abfd}. -@item -@code{bfd_error_no_memory} - If memory allocation fails. -@end itemize - -@findex bfd_make_section_with_flags -@subsubsection @code{bfd_make_section_with_flags} -@strong{Synopsis} -@example -asection *bfd_make_section_with_flags - (bfd *, const char *name, flagword flags); -@end example -@strong{Description}@* -Like @code{bfd_make_section_anyway}, but return @code{NULL} (without calling -bfd_set_error ()) without changing the section chain if there is already a -section named @var{name}. Also set the attributes of the new section to -the value @var{flags}. If there is an error, return @code{NULL} and set -@code{bfd_error}. - -@findex bfd_make_section -@subsubsection @code{bfd_make_section} -@strong{Synopsis} -@example -asection *bfd_make_section (bfd *, const char *name); -@end example -@strong{Description}@* -Like @code{bfd_make_section_anyway}, but return @code{NULL} (without calling -bfd_set_error ()) without changing the section chain if there is already a -section named @var{name}. If there is an error, return @code{NULL} and set -@code{bfd_error}. - -@findex bfd_set_section_flags -@subsubsection @code{bfd_set_section_flags} -@strong{Synopsis} -@example -bfd_boolean bfd_set_section_flags - (bfd *abfd, asection *sec, flagword flags); -@end example -@strong{Description}@* -Set the attributes of the section @var{sec} in the BFD -@var{abfd} to the value @var{flags}. Return @code{TRUE} on success, -@code{FALSE} on error. Possible error returns are: - -@itemize @bullet - -@item -@code{bfd_error_invalid_operation} - -The section cannot have one or more of the attributes -requested. For example, a .bss section in @code{a.out} may not -have the @code{SEC_HAS_CONTENTS} field set. -@end itemize - -@findex bfd_map_over_sections -@subsubsection @code{bfd_map_over_sections} -@strong{Synopsis} -@example -void bfd_map_over_sections - (bfd *abfd, - void (*func) (bfd *abfd, asection *sect, void *obj), - void *obj); -@end example -@strong{Description}@* -Call the provided function @var{func} for each section -attached to the BFD @var{abfd}, passing @var{obj} as an -argument. The function will be called as if by - -@example - func (abfd, the_section, obj); -@end example - -This is the preferred method for iterating over sections; an -alternative would be to use a loop: - -@example - section *p; - for (p = abfd->sections; p != NULL; p = p->next) - func (abfd, p, ...) -@end example - -@findex bfd_sections_find_if -@subsubsection @code{bfd_sections_find_if} -@strong{Synopsis} -@example -asection *bfd_sections_find_if - (bfd *abfd, - bfd_boolean (*operation) (bfd *abfd, asection *sect, void *obj), - void *obj); -@end example -@strong{Description}@* -Call the provided function @var{operation} for each section -attached to the BFD @var{abfd}, passing @var{obj} as an -argument. The function will be called as if by - -@example - operation (abfd, the_section, obj); -@end example - -It returns the first section for which @var{operation} returns true. - -@findex bfd_set_section_size -@subsubsection @code{bfd_set_section_size} -@strong{Synopsis} -@example -bfd_boolean bfd_set_section_size - (bfd *abfd, asection *sec, bfd_size_type val); -@end example -@strong{Description}@* -Set @var{sec} to the size @var{val}. If the operation is -ok, then @code{TRUE} is returned, else @code{FALSE}. - -Possible error returns: -@itemize @bullet - -@item -@code{bfd_error_invalid_operation} - -Writing has started to the BFD, so setting the size is invalid. -@end itemize - -@findex bfd_set_section_contents -@subsubsection @code{bfd_set_section_contents} -@strong{Synopsis} -@example -bfd_boolean bfd_set_section_contents - (bfd *abfd, asection *section, const void *data, - file_ptr offset, bfd_size_type count); -@end example -@strong{Description}@* -Sets the contents of the section @var{section} in BFD -@var{abfd} to the data starting in memory at @var{data}. The -data is written to the output section starting at offset -@var{offset} for @var{count} octets. - -Normally @code{TRUE} is returned, else @code{FALSE}. Possible error -returns are: -@itemize @bullet - -@item -@code{bfd_error_no_contents} - -The output section does not have the @code{SEC_HAS_CONTENTS} -attribute, so nothing can be written to it. -@item -and some more too -@end itemize -This routine is front end to the back end function -@code{_bfd_set_section_contents}. - -@findex bfd_get_section_contents -@subsubsection @code{bfd_get_section_contents} -@strong{Synopsis} -@example -bfd_boolean bfd_get_section_contents - (bfd *abfd, asection *section, void *location, file_ptr offset, - bfd_size_type count); -@end example -@strong{Description}@* -Read data from @var{section} in BFD @var{abfd} -into memory starting at @var{location}. The data is read at an -offset of @var{offset} from the start of the input section, -and is read for @var{count} bytes. - -If the contents of a constructor with the @code{SEC_CONSTRUCTOR} -flag set are requested or if the section does not have the -@code{SEC_HAS_CONTENTS} flag set, then the @var{location} is filled -with zeroes. If no errors occur, @code{TRUE} is returned, else -@code{FALSE}. - -@findex bfd_malloc_and_get_section -@subsubsection @code{bfd_malloc_and_get_section} -@strong{Synopsis} -@example -bfd_boolean bfd_malloc_and_get_section - (bfd *abfd, asection *section, bfd_byte **buf); -@end example -@strong{Description}@* -Read all data from @var{section} in BFD @var{abfd} -into a buffer, *@var{buf}, malloc'd by this function. - -@findex bfd_copy_private_section_data -@subsubsection @code{bfd_copy_private_section_data} -@strong{Synopsis} -@example -bfd_boolean bfd_copy_private_section_data - (bfd *ibfd, asection *isec, bfd *obfd, asection *osec); -@end example -@strong{Description}@* -Copy private section information from @var{isec} in the BFD -@var{ibfd} to the section @var{osec} in the BFD @var{obfd}. -Return @code{TRUE} on success, @code{FALSE} on error. Possible error -returns are: - -@itemize @bullet - -@item -@code{bfd_error_no_memory} - -Not enough memory exists to create private data for @var{osec}. -@end itemize -@example -#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \ - BFD_SEND (obfd, _bfd_copy_private_section_data, \ - (ibfd, isection, obfd, osection)) -@end example - -@findex bfd_generic_is_group_section -@subsubsection @code{bfd_generic_is_group_section} -@strong{Synopsis} -@example -bfd_boolean bfd_generic_is_group_section (bfd *, const asection *sec); -@end example -@strong{Description}@* -Returns TRUE if @var{sec} is a member of a group. - -@findex bfd_generic_discard_group -@subsubsection @code{bfd_generic_discard_group} -@strong{Synopsis} -@example -bfd_boolean bfd_generic_discard_group (bfd *abfd, asection *group); -@end example -@strong{Description}@* -Remove all members of @var{group} from the output. - diff --git a/contrib/binutils/bfd/doc/syms.texi b/contrib/binutils/bfd/doc/syms.texi deleted file mode 100644 index dc56bbc7e1b5..000000000000 --- a/contrib/binutils/bfd/doc/syms.texi +++ /dev/null @@ -1,461 +0,0 @@ -@section Symbols -BFD tries to maintain as much symbol information as it can when -it moves information from file to file. BFD passes information -to applications though the @code{asymbol} structure. When the -application requests the symbol table, BFD reads the table in -the native form and translates parts of it into the internal -format. To maintain more than the information passed to -applications, some targets keep some information ``behind the -scenes'' in a structure only the particular back end knows -about. For example, the coff back end keeps the original -symbol table structure as well as the canonical structure when -a BFD is read in. On output, the coff back end can reconstruct -the output symbol table so that no information is lost, even -information unique to coff which BFD doesn't know or -understand. If a coff symbol table were read, but were written -through an a.out back end, all the coff specific information -would be lost. The symbol table of a BFD -is not necessarily read in until a canonicalize request is -made. Then the BFD back end fills in a table provided by the -application with pointers to the canonical information. To -output symbols, the application provides BFD with a table of -pointers to pointers to @code{asymbol}s. This allows applications -like the linker to output a symbol as it was read, since the ``behind -the scenes'' information will be still available. -@menu -* Reading Symbols:: -* Writing Symbols:: -* Mini Symbols:: -* typedef asymbol:: -* symbol handling functions:: -@end menu - -@node Reading Symbols, Writing Symbols, Symbols, Symbols -@subsection Reading symbols -There are two stages to reading a symbol table from a BFD: -allocating storage, and the actual reading process. This is an -excerpt from an application which reads the symbol table: - -@example - long storage_needed; - asymbol **symbol_table; - long number_of_symbols; - long i; - - storage_needed = bfd_get_symtab_upper_bound (abfd); - - if (storage_needed < 0) - FAIL - - if (storage_needed == 0) - return; - - symbol_table = xmalloc (storage_needed); - ... - number_of_symbols = - bfd_canonicalize_symtab (abfd, symbol_table); - - if (number_of_symbols < 0) - FAIL - - for (i = 0; i < number_of_symbols; i++) - process_symbol (symbol_table[i]); -@end example - -All storage for the symbols themselves is in an objalloc -connected to the BFD; it is freed when the BFD is closed. - -@node Writing Symbols, Mini Symbols, Reading Symbols, Symbols -@subsection Writing symbols -Writing of a symbol table is automatic when a BFD open for -writing is closed. The application attaches a vector of -pointers to pointers to symbols to the BFD being written, and -fills in the symbol count. The close and cleanup code reads -through the table provided and performs all the necessary -operations. The BFD output code must always be provided with an -``owned'' symbol: one which has come from another BFD, or one -which has been created using @code{bfd_make_empty_symbol}. Here is an -example showing the creation of a symbol table with only one element: - -@example - #include "bfd.h" - int main (void) - @{ - bfd *abfd; - asymbol *ptrs[2]; - asymbol *new; - - abfd = bfd_openw ("foo","a.out-sunos-big"); - bfd_set_format (abfd, bfd_object); - new = bfd_make_empty_symbol (abfd); - new->name = "dummy_symbol"; - new->section = bfd_make_section_old_way (abfd, ".text"); - new->flags = BSF_GLOBAL; - new->value = 0x12345; - - ptrs[0] = new; - ptrs[1] = 0; - - bfd_set_symtab (abfd, ptrs, 1); - bfd_close (abfd); - return 0; - @} - - ./makesym - nm foo - 00012345 A dummy_symbol -@end example - -Many formats cannot represent arbitrary symbol information; for -instance, the @code{a.out} object format does not allow an -arbitrary number of sections. A symbol pointing to a section -which is not one of @code{.text}, @code{.data} or @code{.bss} cannot -be described. - -@node Mini Symbols, typedef asymbol, Writing Symbols, Symbols -@subsection Mini Symbols -Mini symbols provide read-only access to the symbol table. -They use less memory space, but require more time to access. -They can be useful for tools like nm or objdump, which may -have to handle symbol tables of extremely large executables. - -The @code{bfd_read_minisymbols} function will read the symbols -into memory in an internal form. It will return a @code{void *} -pointer to a block of memory, a symbol count, and the size of -each symbol. The pointer is allocated using @code{malloc}, and -should be freed by the caller when it is no longer needed. - -The function @code{bfd_minisymbol_to_symbol} will take a pointer -to a minisymbol, and a pointer to a structure returned by -@code{bfd_make_empty_symbol}, and return a @code{asymbol} structure. -The return value may or may not be the same as the value from -@code{bfd_make_empty_symbol} which was passed in. - - -@node typedef asymbol, symbol handling functions, Mini Symbols, Symbols -@subsection typedef asymbol -An @code{asymbol} has the form: - - -@example - -typedef struct bfd_symbol -@{ - /* A pointer to the BFD which owns the symbol. This information - is necessary so that a back end can work out what additional - information (invisible to the application writer) is carried - with the symbol. - - This field is *almost* redundant, since you can use section->owner - instead, except that some symbols point to the global sections - bfd_@{abs,com,und@}_section. This could be fixed by making - these globals be per-bfd (or per-target-flavor). FIXME. */ - struct bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field. */ - - /* The text of the symbol. The name is left alone, and not copied; the - application may not alter it. */ - const char *name; - - /* The value of the symbol. This really should be a union of a - numeric value with a pointer, since some flags indicate that - a pointer to another symbol is stored here. */ - symvalue value; - - /* Attributes of a symbol. */ -#define BSF_NO_FLAGS 0x00 - - /* The symbol has local scope; @code{static} in @code{C}. The value - is the offset into the section of the data. */ -#define BSF_LOCAL 0x01 - - /* The symbol has global scope; initialized data in @code{C}. The - value is the offset into the section of the data. */ -#define BSF_GLOBAL 0x02 - - /* The symbol has global scope and is exported. The value is - the offset into the section of the data. */ -#define BSF_EXPORT BSF_GLOBAL /* No real difference. */ - - /* A normal C symbol would be one of: - @code{BSF_LOCAL}, @code{BSF_FORT_COMM}, @code{BSF_UNDEFINED} or - @code{BSF_GLOBAL}. */ - - /* The symbol is a debugging record. The value has an arbitrary - meaning, unless BSF_DEBUGGING_RELOC is also set. */ -#define BSF_DEBUGGING 0x08 - - /* The symbol denotes a function entry point. Used in ELF, - perhaps others someday. */ -#define BSF_FUNCTION 0x10 - - /* Used by the linker. */ -#define BSF_KEEP 0x20 -#define BSF_KEEP_G 0x40 - - /* A weak global symbol, overridable without warnings by - a regular global symbol of the same name. */ -#define BSF_WEAK 0x80 - - /* This symbol was created to point to a section, e.g. ELF's - STT_SECTION symbols. */ -#define BSF_SECTION_SYM 0x100 - - /* The symbol used to be a common symbol, but now it is - allocated. */ -#define BSF_OLD_COMMON 0x200 - - /* The default value for common data. */ -#define BFD_FORT_COMM_DEFAULT_VALUE 0 - - /* In some files the type of a symbol sometimes alters its - location in an output file - ie in coff a @code{ISFCN} symbol - which is also @code{C_EXT} symbol appears where it was - declared and not at the end of a section. This bit is set - by the target BFD part to convey this information. */ -#define BSF_NOT_AT_END 0x400 - - /* Signal that the symbol is the label of constructor section. */ -#define BSF_CONSTRUCTOR 0x800 - - /* Signal that the symbol is a warning symbol. The name is a - warning. The name of the next symbol is the one to warn about; - if a reference is made to a symbol with the same name as the next - symbol, a warning is issued by the linker. */ -#define BSF_WARNING 0x1000 - - /* Signal that the symbol is indirect. This symbol is an indirect - pointer to the symbol with the same name as the next symbol. */ -#define BSF_INDIRECT 0x2000 - - /* BSF_FILE marks symbols that contain a file name. This is used - for ELF STT_FILE symbols. */ -#define BSF_FILE 0x4000 - - /* Symbol is from dynamic linking information. */ -#define BSF_DYNAMIC 0x8000 - - /* The symbol denotes a data object. Used in ELF, and perhaps - others someday. */ -#define BSF_OBJECT 0x10000 - - /* This symbol is a debugging symbol. The value is the offset - into the section of the data. BSF_DEBUGGING should be set - as well. */ -#define BSF_DEBUGGING_RELOC 0x20000 - - /* This symbol is thread local. Used in ELF. */ -#define BSF_THREAD_LOCAL 0x40000 - - flagword flags; - - /* A pointer to the section to which this symbol is - relative. This will always be non NULL, there are special - sections for undefined and absolute symbols. */ - struct bfd_section *section; - - /* Back end special data. */ - union - @{ - void *p; - bfd_vma i; - @} - udata; -@} -asymbol; - -@end example - -@node symbol handling functions, , typedef asymbol, Symbols -@subsection Symbol handling functions - - -@findex bfd_get_symtab_upper_bound -@subsubsection @code{bfd_get_symtab_upper_bound} -@strong{Description}@* -Return the number of bytes required to store a vector of pointers -to @code{asymbols} for all the symbols in the BFD @var{abfd}, -including a terminal NULL pointer. If there are no symbols in -the BFD, then return 0. If an error occurs, return -1. -@example -#define bfd_get_symtab_upper_bound(abfd) \ - BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd)) - -@end example - -@findex bfd_is_local_label -@subsubsection @code{bfd_is_local_label} -@strong{Synopsis} -@example -bfd_boolean bfd_is_local_label (bfd *abfd, asymbol *sym); -@end example -@strong{Description}@* -Return TRUE if the given symbol @var{sym} in the BFD @var{abfd} is -a compiler generated local label, else return FALSE. - -@findex bfd_is_local_label_name -@subsubsection @code{bfd_is_local_label_name} -@strong{Synopsis} -@example -bfd_boolean bfd_is_local_label_name (bfd *abfd, const char *name); -@end example -@strong{Description}@* -Return TRUE if a symbol with the name @var{name} in the BFD -@var{abfd} is a compiler generated local label, else return -FALSE. This just checks whether the name has the form of a -local label. -@example -#define bfd_is_local_label_name(abfd, name) \ - BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name)) - -@end example - -@findex bfd_is_target_special_symbol -@subsubsection @code{bfd_is_target_special_symbol} -@strong{Synopsis} -@example -bfd_boolean bfd_is_target_special_symbol (bfd *abfd, asymbol *sym); -@end example -@strong{Description}@* -Return TRUE iff a symbol @var{sym} in the BFD @var{abfd} is something -special to the particular target represented by the BFD. Such symbols -should normally not be mentioned to the user. -@example -#define bfd_is_target_special_symbol(abfd, sym) \ - BFD_SEND (abfd, _bfd_is_target_special_symbol, (abfd, sym)) - -@end example - -@findex bfd_canonicalize_symtab -@subsubsection @code{bfd_canonicalize_symtab} -@strong{Description}@* -Read the symbols from the BFD @var{abfd}, and fills in -the vector @var{location} with pointers to the symbols and -a trailing NULL. -Return the actual number of symbol pointers, not -including the NULL. -@example -#define bfd_canonicalize_symtab(abfd, location) \ - BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location)) - -@end example - -@findex bfd_set_symtab -@subsubsection @code{bfd_set_symtab} -@strong{Synopsis} -@example -bfd_boolean bfd_set_symtab - (bfd *abfd, asymbol **location, unsigned int count); -@end example -@strong{Description}@* -Arrange that when the output BFD @var{abfd} is closed, -the table @var{location} of @var{count} pointers to symbols -will be written. - -@findex bfd_print_symbol_vandf -@subsubsection @code{bfd_print_symbol_vandf} -@strong{Synopsis} -@example -void bfd_print_symbol_vandf (bfd *abfd, void *file, asymbol *symbol); -@end example -@strong{Description}@* -Print the value and flags of the @var{symbol} supplied to the -stream @var{file}. - -@findex bfd_make_empty_symbol -@subsubsection @code{bfd_make_empty_symbol} -@strong{Description}@* -Create a new @code{asymbol} structure for the BFD @var{abfd} -and return a pointer to it. - -This routine is necessary because each back end has private -information surrounding the @code{asymbol}. Building your own -@code{asymbol} and pointing to it will not create the private -information, and will cause problems later on. -@example -#define bfd_make_empty_symbol(abfd) \ - BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd)) - -@end example - -@findex _bfd_generic_make_empty_symbol -@subsubsection @code{_bfd_generic_make_empty_symbol} -@strong{Synopsis} -@example -asymbol *_bfd_generic_make_empty_symbol (bfd *); -@end example -@strong{Description}@* -Create a new @code{asymbol} structure for the BFD @var{abfd} -and return a pointer to it. Used by core file routines, -binary back-end and anywhere else where no private info -is needed. - -@findex bfd_make_debug_symbol -@subsubsection @code{bfd_make_debug_symbol} -@strong{Description}@* -Create a new @code{asymbol} structure for the BFD @var{abfd}, -to be used as a debugging symbol. Further details of its use have -yet to be worked out. -@example -#define bfd_make_debug_symbol(abfd,ptr,size) \ - BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size)) - -@end example - -@findex bfd_decode_symclass -@subsubsection @code{bfd_decode_symclass} -@strong{Description}@* -Return a character corresponding to the symbol -class of @var{symbol}, or '?' for an unknown class. - -@strong{Synopsis} -@example -int bfd_decode_symclass (asymbol *symbol); -@end example -@findex bfd_is_undefined_symclass -@subsubsection @code{bfd_is_undefined_symclass} -@strong{Description}@* -Returns non-zero if the class symbol returned by -bfd_decode_symclass represents an undefined symbol. -Returns zero otherwise. - -@strong{Synopsis} -@example -bfd_boolean bfd_is_undefined_symclass (int symclass); -@end example -@findex bfd_symbol_info -@subsubsection @code{bfd_symbol_info} -@strong{Description}@* -Fill in the basic info about symbol that nm needs. -Additional info may be added by the back-ends after -calling this function. - -@strong{Synopsis} -@example -void bfd_symbol_info (asymbol *symbol, symbol_info *ret); -@end example -@findex bfd_copy_private_symbol_data -@subsubsection @code{bfd_copy_private_symbol_data} -@strong{Synopsis} -@example -bfd_boolean bfd_copy_private_symbol_data - (bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym); -@end example -@strong{Description}@* -Copy private symbol information from @var{isym} in the BFD -@var{ibfd} to the symbol @var{osym} in the BFD @var{obfd}. -Return @code{TRUE} on success, @code{FALSE} on error. Possible error -returns are: - -@itemize @bullet - -@item -@code{bfd_error_no_memory} - -Not enough memory exists to create private data for @var{osec}. -@end itemize -@example -#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \ - BFD_SEND (obfd, _bfd_copy_private_symbol_data, \ - (ibfd, isymbol, obfd, osymbol)) - -@end example - diff --git a/contrib/binutils/bfd/doc/targets.texi b/contrib/binutils/bfd/doc/targets.texi deleted file mode 100644 index a85c84911080..000000000000 --- a/contrib/binutils/bfd/doc/targets.texi +++ /dev/null @@ -1,551 +0,0 @@ -@section Targets - - -@strong{Description}@* -Each port of BFD to a different machine requires the creation -of a target back end. All the back end provides to the root -part of BFD is a structure containing pointers to functions -which perform certain low level operations on files. BFD -translates the applications's requests through a pointer into -calls to the back end routines. - -When a file is opened with @code{bfd_openr}, its format and -target are unknown. BFD uses various mechanisms to determine -how to interpret the file. The operations performed are: - -@itemize @bullet - -@item -Create a BFD by calling the internal routine -@code{_bfd_new_bfd}, then call @code{bfd_find_target} with the -target string supplied to @code{bfd_openr} and the new BFD pointer. - -@item -If a null target string was provided to @code{bfd_find_target}, -look up the environment variable @code{GNUTARGET} and use -that as the target string. - -@item -If the target string is still @code{NULL}, or the target string is -@code{default}, then use the first item in the target vector -as the target type, and set @code{target_defaulted} in the BFD to -cause @code{bfd_check_format} to loop through all the targets. -@xref{bfd_target}. @xref{Formats}. - -@item -Otherwise, inspect the elements in the target vector -one by one, until a match on target name is found. When found, -use it. - -@item -Otherwise return the error @code{bfd_error_invalid_target} to -@code{bfd_openr}. - -@item -@code{bfd_openr} attempts to open the file using -@code{bfd_open_file}, and returns the BFD. -@end itemize -Once the BFD has been opened and the target selected, the file -format may be determined. This is done by calling -@code{bfd_check_format} on the BFD with a suggested format. -If @code{target_defaulted} has been set, each possible target -type is tried to see if it recognizes the specified format. -@code{bfd_check_format} returns @code{TRUE} when the caller guesses right. -@menu -* bfd_target:: -@end menu - -@node bfd_target, , Targets, Targets - -@subsection bfd_target - - -@strong{Description}@* -This structure contains everything that BFD knows about a -target. It includes things like its byte order, name, and which -routines to call to do various operations. - -Every BFD points to a target structure with its @code{xvec} -member. - -The macros below are used to dispatch to functions through the -@code{bfd_target} vector. They are used in a number of macros further -down in @file{bfd.h}, and are also used when calling various -routines by hand inside the BFD implementation. The @var{arglist} -argument must be parenthesized; it contains all the arguments -to the called function. - -They make the documentation (more) unpleasant to read, so if -someone wants to fix this and not break the above, please do. -@example -#define BFD_SEND(bfd, message, arglist) \ - ((*((bfd)->xvec->message)) arglist) - -#ifdef DEBUG_BFD_SEND -#undef BFD_SEND -#define BFD_SEND(bfd, message, arglist) \ - (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \ - ((*((bfd)->xvec->message)) arglist) : \ - (bfd_assert (__FILE__,__LINE__), NULL)) -#endif -@end example -For operations which index on the BFD format: -@example -#define BFD_SEND_FMT(bfd, message, arglist) \ - (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) - -#ifdef DEBUG_BFD_SEND -#undef BFD_SEND_FMT -#define BFD_SEND_FMT(bfd, message, arglist) \ - (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \ - (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \ - (bfd_assert (__FILE__,__LINE__), NULL)) -#endif - -@end example -This is the structure which defines the type of BFD this is. The -@code{xvec} member of the struct @code{bfd} itself points here. Each -module that implements access to a different target under BFD, -defines one of these. - -FIXME, these names should be rationalised with the names of -the entry points which call them. Too bad we can't have one -macro to define them both! -@example -enum bfd_flavour -@{ - bfd_target_unknown_flavour, - bfd_target_aout_flavour, - bfd_target_coff_flavour, - bfd_target_ecoff_flavour, - bfd_target_xcoff_flavour, - bfd_target_elf_flavour, - bfd_target_ieee_flavour, - bfd_target_nlm_flavour, - bfd_target_oasys_flavour, - bfd_target_tekhex_flavour, - bfd_target_srec_flavour, - bfd_target_ihex_flavour, - bfd_target_som_flavour, - bfd_target_os9k_flavour, - bfd_target_versados_flavour, - bfd_target_msdos_flavour, - bfd_target_ovax_flavour, - bfd_target_evax_flavour, - bfd_target_mmo_flavour, - bfd_target_mach_o_flavour, - bfd_target_pef_flavour, - bfd_target_pef_xlib_flavour, - bfd_target_sym_flavour -@}; - -enum bfd_endian @{ BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN @}; - -/* Forward declaration. */ -typedef struct bfd_link_info _bfd_link_info; - -typedef struct bfd_target -@{ - /* Identifies the kind of target, e.g., SunOS4, Ultrix, etc. */ - char *name; - - /* The "flavour" of a back end is a general indication about - the contents of a file. */ - enum bfd_flavour flavour; - - /* The order of bytes within the data area of a file. */ - enum bfd_endian byteorder; - - /* The order of bytes within the header parts of a file. */ - enum bfd_endian header_byteorder; - - /* A mask of all the flags which an executable may have set - - from the set @code{BFD_NO_FLAGS}, @code{HAS_RELOC}, ...@code{D_PAGED}. */ - flagword object_flags; - - /* A mask of all the flags which a section may have set - from - the set @code{SEC_NO_FLAGS}, @code{SEC_ALLOC}, ...@code{SET_NEVER_LOAD}. */ - flagword section_flags; - - /* The character normally found at the front of a symbol. - (if any), perhaps `_'. */ - char symbol_leading_char; - - /* The pad character for file names within an archive header. */ - char ar_pad_char; - - /* The maximum number of characters in an archive header. */ - unsigned short ar_max_namelen; - - /* Entries for byte swapping for data. These are different from the - other entry points, since they don't take a BFD as the first argument. - Certain other handlers could do the same. */ - bfd_uint64_t (*bfd_getx64) (const void *); - bfd_int64_t (*bfd_getx_signed_64) (const void *); - void (*bfd_putx64) (bfd_uint64_t, void *); - bfd_vma (*bfd_getx32) (const void *); - bfd_signed_vma (*bfd_getx_signed_32) (const void *); - void (*bfd_putx32) (bfd_vma, void *); - bfd_vma (*bfd_getx16) (const void *); - bfd_signed_vma (*bfd_getx_signed_16) (const void *); - void (*bfd_putx16) (bfd_vma, void *); - - /* Byte swapping for the headers. */ - bfd_uint64_t (*bfd_h_getx64) (const void *); - bfd_int64_t (*bfd_h_getx_signed_64) (const void *); - void (*bfd_h_putx64) (bfd_uint64_t, void *); - bfd_vma (*bfd_h_getx32) (const void *); - bfd_signed_vma (*bfd_h_getx_signed_32) (const void *); - void (*bfd_h_putx32) (bfd_vma, void *); - bfd_vma (*bfd_h_getx16) (const void *); - bfd_signed_vma (*bfd_h_getx_signed_16) (const void *); - void (*bfd_h_putx16) (bfd_vma, void *); - - /* Format dependent routines: these are vectors of entry points - within the target vector structure, one for each format to check. */ - - /* Check the format of a file being read. Return a @code{bfd_target *} or zero. */ - const struct bfd_target *(*_bfd_check_format[bfd_type_end]) (bfd *); - - /* Set the format of a file being written. */ - bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *); - - /* Write cached information into a file being written, at @code{bfd_close}. */ - bfd_boolean (*_bfd_write_contents[bfd_type_end]) (bfd *); - -@end example -The general target vector. These vectors are initialized using the -BFD_JUMP_TABLE macros. -@example - - /* Generic entry points. */ -#define BFD_JUMP_TABLE_GENERIC(NAME) \ - NAME##_close_and_cleanup, \ - NAME##_bfd_free_cached_info, \ - NAME##_new_section_hook, \ - NAME##_get_section_contents, \ - NAME##_get_section_contents_in_window - - /* Called when the BFD is being closed to do any necessary cleanup. */ - bfd_boolean (*_close_and_cleanup) (bfd *); - /* Ask the BFD to free all cached information. */ - bfd_boolean (*_bfd_free_cached_info) (bfd *); - /* Called when a new section is created. */ - bfd_boolean (*_new_section_hook) (bfd *, sec_ptr); - /* Read the contents of a section. */ - bfd_boolean (*_bfd_get_section_contents) - (bfd *, sec_ptr, void *, file_ptr, bfd_size_type); - bfd_boolean (*_bfd_get_section_contents_in_window) - (bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type); - - /* Entry points to copy private data. */ -#define BFD_JUMP_TABLE_COPY(NAME) \ - NAME##_bfd_copy_private_bfd_data, \ - NAME##_bfd_merge_private_bfd_data, \ - _bfd_generic_init_private_section_data, \ - NAME##_bfd_copy_private_section_data, \ - NAME##_bfd_copy_private_symbol_data, \ - NAME##_bfd_copy_private_header_data, \ - NAME##_bfd_set_private_flags, \ - NAME##_bfd_print_private_bfd_data - - /* Called to copy BFD general private data from one object file - to another. */ - bfd_boolean (*_bfd_copy_private_bfd_data) (bfd *, bfd *); - /* Called to merge BFD general private data from one object file - to a common output file when linking. */ - bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *); - /* Called to initialize BFD private section data from one object file - to another. */ -#define bfd_init_private_section_data(ibfd, isec, obfd, osec, link_info) \ - BFD_SEND (obfd, _bfd_init_private_section_data, (ibfd, isec, obfd, osec, link_info)) - bfd_boolean (*_bfd_init_private_section_data) - (bfd *, sec_ptr, bfd *, sec_ptr, struct bfd_link_info *); - /* Called to copy BFD private section data from one object file - to another. */ - bfd_boolean (*_bfd_copy_private_section_data) - (bfd *, sec_ptr, bfd *, sec_ptr); - /* Called to copy BFD private symbol data from one symbol - to another. */ - bfd_boolean (*_bfd_copy_private_symbol_data) - (bfd *, asymbol *, bfd *, asymbol *); - /* Called to copy BFD private header data from one object file - to another. */ - bfd_boolean (*_bfd_copy_private_header_data) - (bfd *, bfd *); - /* Called to set private backend flags. */ - bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword); - - /* Called to print private BFD data. */ - bfd_boolean (*_bfd_print_private_bfd_data) (bfd *, void *); - - /* Core file entry points. */ -#define BFD_JUMP_TABLE_CORE(NAME) \ - NAME##_core_file_failing_command, \ - NAME##_core_file_failing_signal, \ - NAME##_core_file_matches_executable_p - - char * (*_core_file_failing_command) (bfd *); - int (*_core_file_failing_signal) (bfd *); - bfd_boolean (*_core_file_matches_executable_p) (bfd *, bfd *); - - /* Archive entry points. */ -#define BFD_JUMP_TABLE_ARCHIVE(NAME) \ - NAME##_slurp_armap, \ - NAME##_slurp_extended_name_table, \ - NAME##_construct_extended_name_table, \ - NAME##_truncate_arname, \ - NAME##_write_armap, \ - NAME##_read_ar_hdr, \ - NAME##_openr_next_archived_file, \ - NAME##_get_elt_at_index, \ - NAME##_generic_stat_arch_elt, \ - NAME##_update_armap_timestamp - - bfd_boolean (*_bfd_slurp_armap) (bfd *); - bfd_boolean (*_bfd_slurp_extended_name_table) (bfd *); - bfd_boolean (*_bfd_construct_extended_name_table) - (bfd *, char **, bfd_size_type *, const char **); - void (*_bfd_truncate_arname) (bfd *, const char *, char *); - bfd_boolean (*write_armap) - (bfd *, unsigned int, struct orl *, unsigned int, int); - void * (*_bfd_read_ar_hdr_fn) (bfd *); - bfd * (*openr_next_archived_file) (bfd *, bfd *); -#define bfd_get_elt_at_index(b,i) BFD_SEND (b, _bfd_get_elt_at_index, (b,i)) - bfd * (*_bfd_get_elt_at_index) (bfd *, symindex); - int (*_bfd_stat_arch_elt) (bfd *, struct stat *); - bfd_boolean (*_bfd_update_armap_timestamp) (bfd *); - - /* Entry points used for symbols. */ -#define BFD_JUMP_TABLE_SYMBOLS(NAME) \ - NAME##_get_symtab_upper_bound, \ - NAME##_canonicalize_symtab, \ - NAME##_make_empty_symbol, \ - NAME##_print_symbol, \ - NAME##_get_symbol_info, \ - NAME##_bfd_is_local_label_name, \ - NAME##_bfd_is_target_special_symbol, \ - NAME##_get_lineno, \ - NAME##_find_nearest_line, \ - _bfd_generic_find_line, \ - NAME##_find_inliner_info, \ - NAME##_bfd_make_debug_symbol, \ - NAME##_read_minisymbols, \ - NAME##_minisymbol_to_symbol - - long (*_bfd_get_symtab_upper_bound) (bfd *); - long (*_bfd_canonicalize_symtab) - (bfd *, struct bfd_symbol **); - struct bfd_symbol * - (*_bfd_make_empty_symbol) (bfd *); - void (*_bfd_print_symbol) - (bfd *, void *, struct bfd_symbol *, bfd_print_symbol_type); -#define bfd_print_symbol(b,p,s,e) BFD_SEND (b, _bfd_print_symbol, (b,p,s,e)) - void (*_bfd_get_symbol_info) - (bfd *, struct bfd_symbol *, symbol_info *); -#define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e)) - bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *); - bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *); - alent * (*_get_lineno) (bfd *, struct bfd_symbol *); - bfd_boolean (*_bfd_find_nearest_line) - (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma, - const char **, const char **, unsigned int *); - bfd_boolean (*_bfd_find_line) - (bfd *, struct bfd_symbol **, struct bfd_symbol *, - const char **, unsigned int *); - bfd_boolean (*_bfd_find_inliner_info) - (bfd *, const char **, const char **, unsigned int *); - /* Back-door to allow format-aware applications to create debug symbols - while using BFD for everything else. Currently used by the assembler - when creating COFF files. */ - asymbol * (*_bfd_make_debug_symbol) - (bfd *, void *, unsigned long size); -#define bfd_read_minisymbols(b, d, m, s) \ - BFD_SEND (b, _read_minisymbols, (b, d, m, s)) - long (*_read_minisymbols) - (bfd *, bfd_boolean, void **, unsigned int *); -#define bfd_minisymbol_to_symbol(b, d, m, f) \ - BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f)) - asymbol * (*_minisymbol_to_symbol) - (bfd *, bfd_boolean, const void *, asymbol *); - - /* Routines for relocs. */ -#define BFD_JUMP_TABLE_RELOCS(NAME) \ - NAME##_get_reloc_upper_bound, \ - NAME##_canonicalize_reloc, \ - NAME##_bfd_reloc_type_lookup - - long (*_get_reloc_upper_bound) (bfd *, sec_ptr); - long (*_bfd_canonicalize_reloc) - (bfd *, sec_ptr, arelent **, struct bfd_symbol **); - /* See documentation on reloc types. */ - reloc_howto_type * - (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); - - /* Routines used when writing an object file. */ -#define BFD_JUMP_TABLE_WRITE(NAME) \ - NAME##_set_arch_mach, \ - NAME##_set_section_contents - - bfd_boolean (*_bfd_set_arch_mach) - (bfd *, enum bfd_architecture, unsigned long); - bfd_boolean (*_bfd_set_section_contents) - (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type); - - /* Routines used by the linker. */ -#define BFD_JUMP_TABLE_LINK(NAME) \ - NAME##_sizeof_headers, \ - NAME##_bfd_get_relocated_section_contents, \ - NAME##_bfd_relax_section, \ - NAME##_bfd_link_hash_table_create, \ - NAME##_bfd_link_hash_table_free, \ - NAME##_bfd_link_add_symbols, \ - NAME##_bfd_link_just_syms, \ - NAME##_bfd_final_link, \ - NAME##_bfd_link_split_section, \ - NAME##_bfd_gc_sections, \ - NAME##_bfd_merge_sections, \ - NAME##_bfd_is_group_section, \ - NAME##_bfd_discard_group, \ - NAME##_section_already_linked \ - - int (*_bfd_sizeof_headers) (bfd *, bfd_boolean); - bfd_byte * (*_bfd_get_relocated_section_contents) - (bfd *, struct bfd_link_info *, struct bfd_link_order *, - bfd_byte *, bfd_boolean, struct bfd_symbol **); - - bfd_boolean (*_bfd_relax_section) - (bfd *, struct bfd_section *, struct bfd_link_info *, bfd_boolean *); - - /* Create a hash table for the linker. Different backends store - different information in this table. */ - struct bfd_link_hash_table * - (*_bfd_link_hash_table_create) (bfd *); - - /* Release the memory associated with the linker hash table. */ - void (*_bfd_link_hash_table_free) (struct bfd_link_hash_table *); - - /* Add symbols from this object file into the hash table. */ - bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *); - - /* Indicate that we are only retrieving symbol values from this section. */ - void (*_bfd_link_just_syms) (asection *, struct bfd_link_info *); - - /* Do a link based on the link_order structures attached to each - section of the BFD. */ - bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *); - - /* Should this section be split up into smaller pieces during linking. */ - bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *); - - /* Remove sections that are not referenced from the output. */ - bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *); - - /* Attempt to merge SEC_MERGE sections. */ - bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *); - - /* Is this section a member of a group? */ - bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *); - - /* Discard members of a group. */ - bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *); - - /* Check if SEC has been already linked during a reloceatable or - final link. */ - void (*_section_already_linked) (bfd *, struct bfd_section *); - - /* Routines to handle dynamic symbols and relocs. */ -#define BFD_JUMP_TABLE_DYNAMIC(NAME) \ - NAME##_get_dynamic_symtab_upper_bound, \ - NAME##_canonicalize_dynamic_symtab, \ - NAME##_get_synthetic_symtab, \ - NAME##_get_dynamic_reloc_upper_bound, \ - NAME##_canonicalize_dynamic_reloc - - /* Get the amount of memory required to hold the dynamic symbols. */ - long (*_bfd_get_dynamic_symtab_upper_bound) (bfd *); - /* Read in the dynamic symbols. */ - long (*_bfd_canonicalize_dynamic_symtab) - (bfd *, struct bfd_symbol **); - /* Create synthetized symbols. */ - long (*_bfd_get_synthetic_symtab) - (bfd *, long, struct bfd_symbol **, long, struct bfd_symbol **, - struct bfd_symbol **); - /* Get the amount of memory required to hold the dynamic relocs. */ - long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *); - /* Read in the dynamic relocs. */ - long (*_bfd_canonicalize_dynamic_reloc) - (bfd *, arelent **, struct bfd_symbol **); - -@end example -A pointer to an alternative bfd_target in case the current one is not -satisfactory. This can happen when the target cpu supports both big -and little endian code, and target chosen by the linker has the wrong -endianness. The function open_output() in ld/ldlang.c uses this field -to find an alternative output format that is suitable. -@example - /* Opposite endian version of this target. */ - const struct bfd_target * alternative_target; - - /* Data for use by back-end routines, which isn't - generic enough to belong in this structure. */ - const void *backend_data; - -@} bfd_target; - -@end example - -@findex bfd_set_default_target -@subsubsection @code{bfd_set_default_target} -@strong{Synopsis} -@example -bfd_boolean bfd_set_default_target (const char *name); -@end example -@strong{Description}@* -Set the default target vector to use when recognizing a BFD. -This takes the name of the target, which may be a BFD target -name or a configuration triplet. - -@findex bfd_find_target -@subsubsection @code{bfd_find_target} -@strong{Synopsis} -@example -const bfd_target *bfd_find_target (const char *target_name, bfd *abfd); -@end example -@strong{Description}@* -Return a pointer to the transfer vector for the object target -named @var{target_name}. If @var{target_name} is @code{NULL}, choose the -one in the environment variable @code{GNUTARGET}; if that is null or not -defined, then choose the first entry in the target list. -Passing in the string "default" or setting the environment -variable to "default" will cause the first entry in the target -list to be returned, and "target_defaulted" will be set in the -BFD. This causes @code{bfd_check_format} to loop over all the -targets to find the one that matches the file being read. - -@findex bfd_target_list -@subsubsection @code{bfd_target_list} -@strong{Synopsis} -@example -const char ** bfd_target_list (void); -@end example -@strong{Description}@* -Return a freshly malloced NULL-terminated -vector of the names of all the valid BFD targets. Do not -modify the names. - -@findex bfd_seach_for_target -@subsubsection @code{bfd_seach_for_target} -@strong{Synopsis} -@example -const bfd_target *bfd_search_for_target - (int (*search_func) (const bfd_target *, void *), - void *); -@end example -@strong{Description}@* -Return a pointer to the first transfer vector in the list of -transfer vectors maintained by BFD that produces a non-zero -result when passed to the function @var{search_func}. The -parameter @var{data} is passed, unexamined, to the search -function. - diff --git a/contrib/binutils/bfd/dwarf1.c b/contrib/binutils/bfd/dwarf1.c index 5d6c1e359e51..d722df37152e 100644 --- a/contrib/binutils/bfd/dwarf1.c +++ b/contrib/binutils/bfd/dwarf1.c @@ -1,5 +1,5 @@ /* DWARF 1 find nearest line (_bfd_dwarf1_find_nearest_line). - Copyright 1998, 1999, 2000, 2001, 2002, 2004, 2005 + Copyright 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2007 Free Software Foundation, Inc. Written by Gavin Romig-Koch of Cygnus Solutions (gavin@cygnus.com). @@ -20,8 +20,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libiberty.h" #include "libbfd.h" #include "elf-bfd.h" diff --git a/contrib/binutils/bfd/dwarf2.c b/contrib/binutils/bfd/dwarf2.c index ae68d1886818..411a7154b5eb 100644 --- a/contrib/binutils/bfd/dwarf2.c +++ b/contrib/binutils/bfd/dwarf2.c @@ -1,6 +1,6 @@ /* DWARF 2 support. Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, - 2004, 2005, 2006 Free Software Foundation, Inc. + 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Adapted from gdb/dwarf2read.c by Gavin Koch of Cygnus Solutions (gavin@cygnus.com). @@ -29,8 +29,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libiberty.h" #include "libbfd.h" #include "elf-bfd.h" @@ -93,8 +93,10 @@ struct dwarf2_debug /* Pointer to the end of the .debug_info section memory buffer. */ bfd_byte *info_ptr_end; - /* Pointer to the section and address of the beginning of the - section. */ + /* Pointer to the bfd, section and address of the beginning of the + section. The bfd might be different than expected because of + gnu_debuglink sections. */ + bfd * bfd; asection *sec; bfd_byte *sec_info_ptr; @@ -874,24 +876,45 @@ concat_filename (struct line_info_table *table, unsigned int file) filename = table->files[file - 1].name; - if (! IS_ABSOLUTE_PATH (filename)) + if (!IS_ABSOLUTE_PATH (filename)) { - char *dirname = (table->files[file - 1].dir - ? table->dirs[table->files[file - 1].dir - 1] - : table->comp_dir); + char *dirname = NULL; + char *subdirname = NULL; + char *name; + size_t len; + + if (table->files[file - 1].dir) + subdirname = table->dirs[table->files[file - 1].dir - 1]; + + if (!subdirname || !IS_ABSOLUTE_PATH (subdirname)) + dirname = table->comp_dir; - /* Not all tools set DW_AT_comp_dir, so dirname may be unknown. - The best we can do is return the filename part. */ - if (dirname != NULL) + if (!dirname) { - unsigned int len = strlen (dirname) + strlen (filename) + 2; - char * name; + dirname = subdirname; + subdirname = NULL; + } + + if (!dirname) + return strdup (filename); + len = strlen (dirname) + strlen (filename) + 2; + + if (subdirname) + { + len += strlen (subdirname) + 1; + name = bfd_malloc (len); + if (name) + sprintf (name, "%s/%s/%s", dirname, subdirname, filename); + } + else + { name = bfd_malloc (len); if (name) sprintf (name, "%s/%s", dirname, filename); - return name; } + + return name; } return strdup (filename); @@ -1117,7 +1140,6 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) unsigned int line = 1; unsigned int column = 0; int is_stmt = lh.default_is_stmt; - int basic_block = 0; int end_sequence = 0; /* eraxxon@alumni.rice.edu: Against the DWARF2 specs, some compilers generate address sequences that are wildly out of @@ -1142,7 +1164,6 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) line += lh.line_base + (adj_opcode % lh.line_range); /* Append row to matrix using current values. */ add_line_info (table, address, filename, line, column, 0); - basic_block = 1; if (address < low_pc) low_pc = address; if (address > high_pc) @@ -1214,7 +1235,6 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) break; case DW_LNS_copy: add_line_info (table, address, filename, line, column, 0); - basic_block = 0; if (address < low_pc) low_pc = address; if (address > high_pc) @@ -1250,7 +1270,6 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) is_stmt = (!is_stmt); break; case DW_LNS_set_basic_block: - basic_block = 1; break; case DW_LNS_const_add_pc: address += lh.minimum_instruction_length @@ -1625,7 +1644,7 @@ read_rangelist (struct comp_unit *unit, struct arange *arange, bfd_uint64_t offs if (low_pc == -1UL && high_pc != -1UL) base_address = high_pc; else - arange_add (unit->abfd, arange, base_address + low_pc, base_address + high_pc); + arange_add (unit->abfd, arange, base_address + low_pc, base_address + high_pc); } } @@ -1871,8 +1890,7 @@ scan_unit_for_symbols (struct comp_unit *unit) to get to the line number information for the compilation unit. */ static struct comp_unit * -parse_comp_unit (bfd *abfd, - struct dwarf2_debug *stash, +parse_comp_unit (struct dwarf2_debug *stash, bfd_vma unit_length, bfd_byte *info_ptr_unit, unsigned int offset_size) @@ -1890,6 +1908,7 @@ parse_comp_unit (bfd *abfd, bfd_size_type amt; bfd_vma low_pc = 0; bfd_vma high_pc = 0; + bfd *abfd = stash->bfd; version = read_2_bytes (abfd, info_ptr); info_ptr += 2; @@ -2175,17 +2194,14 @@ find_debug_info (bfd *abfd, asection *after_sec) { asection * msec; - if (after_sec) - msec = after_sec->next; - else - msec = abfd->sections; + msec = after_sec != NULL ? after_sec->next : abfd->sections; while (msec) { if (strcmp (msec->name, DWARF2_DEBUG_INFO) == 0) return msec; - if (strncmp (msec->name, GNU_LINKONCE_INFO, strlen (GNU_LINKONCE_INFO)) == 0) + if (CONST_STRNEQ (msec->name, GNU_LINKONCE_INFO)) return msec; msec = msec->next; @@ -2285,22 +2301,28 @@ place_sections (bfd *abfd, struct dwarf2_debug *stash) return TRUE; } -/* The DWARF2 version of find_nearest_line. Return TRUE if the line - is found without error. ADDR_SIZE is the number of bytes in the - initial .debug_info length field and in the abbreviation offset. - You may use zero to indicate that the default value should be - used. */ +/* Find the source code location of SYMBOL. If SYMBOL is NULL + then find the nearest source code location corresponding to + the address SECTION + OFFSET. + Returns TRUE if the line is found without error and fills in + FILENAME_PTR and LINENUMBER_PTR. In the case where SYMBOL was + NULL the FUNCTIONNAME_PTR is also filled in. + SYMBOLS contains the symbol table for ABFD. + ADDR_SIZE is the number of bytes in the initial .debug_info length + field and in the abbreviation offset, or zero to indicate that the + default value should be used. */ -bfd_boolean -_bfd_dwarf2_find_nearest_line (bfd *abfd, - asection *section, - asymbol **symbols, - bfd_vma offset, - const char **filename_ptr, - const char **functionname_ptr, - unsigned int *linenumber_ptr, - unsigned int addr_size, - void **pinfo) +static bfd_boolean +find_line (bfd *abfd, + asection *section, + bfd_vma offset, + asymbol *symbol, + asymbol **symbols, + const char **filename_ptr, + const char **functionname_ptr, + unsigned int *linenumber_ptr, + unsigned int addr_size, + void **pinfo) { /* Read each compilation unit from the section .debug_info, and check to see if it contains the address we are searching for. If yes, @@ -2311,13 +2333,11 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, a pointer to the next un-read compilation unit. Check the previously read units before reading more. */ struct dwarf2_debug *stash; - /* What address are we looking for? */ bfd_vma addr; - struct comp_unit* each; - bfd_vma found = FALSE; + bfd_boolean do_line; stash = *pinfo; @@ -2338,7 +2358,22 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, return FALSE; } - addr = offset; + do_line = (section == NULL + && offset == 0 + && functionname_ptr == NULL + && symbol != NULL); + if (do_line) + { + addr = symbol->value; + section = bfd_get_section (symbol); + } + else if (section != NULL + && functionname_ptr != NULL + && symbol == NULL) + addr = offset; + else + abort (); + if (section->output_section) addr += section->output_section->vma + section->output_offset; else @@ -2347,260 +2382,57 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, *functionname_ptr = NULL; *linenumber_ptr = 0; - /* The DWARF2 spec says that the initial length field, and the - offset of the abbreviation table, should both be 4-byte values. - However, some compilers do things differently. */ - if (addr_size == 0) - addr_size = 4; - BFD_ASSERT (addr_size == 4 || addr_size == 8); - if (! *pinfo) { + bfd *debug_bfd; bfd_size_type total_size; asection *msec; *pinfo = stash; msec = find_debug_info (abfd, NULL); - if (! msec) - /* No dwarf2 info. Note that at this point the stash - has been allocated, but contains zeros, this lets - future calls to this function fail quicker. */ - goto done; - - /* There can be more than one DWARF2 info section in a BFD these days. - Read them all in and produce one large stash. We do this in two - passes - in the first pass we just accumulate the section sizes. - In the second pass we read in the section's contents. The allows - us to avoid reallocing the data as we add sections to the stash. */ - for (total_size = 0; msec; msec = find_debug_info (abfd, msec)) - total_size += msec->size; - - stash->info_ptr = bfd_alloc (abfd, total_size); - if (stash->info_ptr == NULL) - goto done; - - stash->info_ptr_end = stash->info_ptr; - - for (msec = find_debug_info (abfd, NULL); - msec; - msec = find_debug_info (abfd, msec)) - { - bfd_size_type size; - bfd_size_type start; - - size = msec->size; - if (size == 0) - continue; - - start = stash->info_ptr_end - stash->info_ptr; - - if ((bfd_simple_get_relocated_section_contents - (abfd, msec, stash->info_ptr + start, symbols)) == NULL) - continue; - - stash->info_ptr_end = stash->info_ptr + start + size; - } - - BFD_ASSERT (stash->info_ptr_end == stash->info_ptr + total_size); - - stash->sec = find_debug_info (abfd, NULL); - stash->sec_info_ptr = stash->info_ptr; - stash->syms = symbols; - } - - /* A null info_ptr indicates that there is no dwarf2 info - (or that an error occured while setting up the stash). */ - if (! stash->info_ptr) - goto done; - - stash->inliner_chain = NULL; - - /* Check the previously read comp. units first. */ - for (each = stash->all_comp_units; each; each = each->next_unit) - if (comp_unit_contains_address (each, addr) - && comp_unit_find_nearest_line (each, addr, filename_ptr, - functionname_ptr, - linenumber_ptr, stash)) - { - found = TRUE; - goto done; - } - - /* Read each remaining comp. units checking each as they are read. */ - while (stash->info_ptr < stash->info_ptr_end) - { - bfd_vma length; - unsigned int offset_size = addr_size; - bfd_byte *info_ptr_unit = stash->info_ptr; - - length = read_4_bytes (abfd, stash->info_ptr); - /* A 0xffffff length is the DWARF3 way of indicating we use - 64-bit offsets, instead of 32-bit offsets. */ - if (length == 0xffffffff) - { - offset_size = 8; - length = read_8_bytes (abfd, stash->info_ptr + 4); - stash->info_ptr += 12; - } - /* A zero length is the IRIX way of indicating 64-bit offsets, - mostly because the 64-bit length will generally fit in 32 - bits, and the endianness helps. */ - else if (length == 0) + if (msec == NULL) { - offset_size = 8; - length = read_4_bytes (abfd, stash->info_ptr + 4); - stash->info_ptr += 8; - } - /* In the absence of the hints above, we assume addr_size-sized - offsets, for backward-compatibility with pre-DWARF3 64-bit - platforms. */ - else if (addr_size == 8) - { - length = read_8_bytes (abfd, stash->info_ptr); - stash->info_ptr += 8; - } - else - stash->info_ptr += 4; - - if (length > 0) - { - each = parse_comp_unit (abfd, stash, length, info_ptr_unit, - offset_size); - stash->info_ptr += length; - - if ((bfd_vma) (stash->info_ptr - stash->sec_info_ptr) - == stash->sec->size) + char * debug_filename = bfd_follow_gnu_debuglink (abfd, DEBUGDIR); + + if (debug_filename == NULL) + /* No dwarf2 info, and no gnu_debuglink to follow. + Note that at this point the stash has been allocated, but + contains zeros. This lets future calls to this function + fail more quickly. */ + goto done; + + if ((debug_bfd = bfd_openr (debug_filename, NULL)) == NULL + || ! bfd_check_format (debug_bfd, bfd_object) + || (msec = find_debug_info (debug_bfd, NULL)) == NULL) { - stash->sec = find_debug_info (abfd, stash->sec); - stash->sec_info_ptr = stash->info_ptr; - } - - if (each) - { - each->next_unit = stash->all_comp_units; - stash->all_comp_units = each; - - /* DW_AT_low_pc and DW_AT_high_pc are optional for - compilation units. If we don't have them (i.e., - unit->high == 0), we need to consult the line info - table to see if a compilation unit contains the given - address. */ - if ((each->arange.high == 0 - || comp_unit_contains_address (each, addr)) - && comp_unit_find_nearest_line (each, addr, - filename_ptr, - functionname_ptr, - linenumber_ptr, - stash)) - { - found = TRUE; - goto done; - } + if (debug_bfd) + bfd_close (debug_bfd); + /* FIXME: Should we report our failure to follow the debuglink ? */ + free (debug_filename); + goto done; } } - } - -done: - if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0) - unset_sections (stash); - - return found; -} - -/* The DWARF2 version of find_line. Return TRUE if the line is found - without error. */ - -bfd_boolean -_bfd_dwarf2_find_line (bfd *abfd, - asymbol **symbols, - asymbol *symbol, - const char **filename_ptr, - unsigned int *linenumber_ptr, - unsigned int addr_size, - void **pinfo) -{ - /* Read each compilation unit from the section .debug_info, and check - to see if it contains the address we are searching for. If yes, - lookup the address, and return the line number info. If no, go - on to the next compilation unit. - - We keep a list of all the previously read compilation units, and - a pointer to the next un-read compilation unit. Check the - previously read units before reading more. */ - struct dwarf2_debug *stash; - - /* What address are we looking for? */ - bfd_vma addr; - - struct comp_unit* each; - - asection *section; - - bfd_boolean found = FALSE; - - section = bfd_get_section (symbol); - - stash = *pinfo; - - if (! stash) - { - bfd_size_type amt = sizeof (struct dwarf2_debug); - - stash = bfd_zalloc (abfd, amt); - if (! stash) - return FALSE; - } - - /* In a relocatable file, 2 functions may have the same address. - We change the section vma so that they won't overlap. */ - if (!stash && (abfd->flags & (EXEC_P | DYNAMIC)) == 0) - { - if (! place_sections (abfd, stash)) - return FALSE; - } - - addr = symbol->value; - if (section->output_section) - addr += section->output_section->vma + section->output_offset; - else - addr += section->vma; - - *filename_ptr = NULL; - *filename_ptr = NULL; - *linenumber_ptr = 0; - - if (! *pinfo) - { - bfd_size_type total_size; - asection *msec; - - *pinfo = stash; - - msec = find_debug_info (abfd, NULL); - if (! msec) - /* No dwarf2 info. Note that at this point the stash - has been allocated, but contains zeros, this lets - future calls to this function fail quicker. */ - goto done; + else + debug_bfd = abfd; /* There can be more than one DWARF2 info section in a BFD these days. Read them all in and produce one large stash. We do this in two passes - in the first pass we just accumulate the section sizes. In the second pass we read in the section's contents. The allows us to avoid reallocing the data as we add sections to the stash. */ - for (total_size = 0; msec; msec = find_debug_info (abfd, msec)) + for (total_size = 0; msec; msec = find_debug_info (debug_bfd, msec)) total_size += msec->size; - stash->info_ptr = bfd_alloc (abfd, total_size); + stash->info_ptr = bfd_alloc (debug_bfd, total_size); if (stash->info_ptr == NULL) goto done; stash->info_ptr_end = stash->info_ptr; - for (msec = find_debug_info (abfd, NULL); + for (msec = find_debug_info (debug_bfd, NULL); msec; - msec = find_debug_info (abfd, msec)) + msec = find_debug_info (debug_bfd, msec)) { bfd_size_type size; bfd_size_type start; @@ -2612,7 +2444,7 @@ _bfd_dwarf2_find_line (bfd *abfd, start = stash->info_ptr_end - stash->info_ptr; if ((bfd_simple_get_relocated_section_contents - (abfd, msec, stash->info_ptr + start, symbols)) == NULL) + (debug_bfd, msec, stash->info_ptr + start, symbols)) == NULL) continue; stash->info_ptr_end = stash->info_ptr + start + size; @@ -2620,9 +2452,10 @@ _bfd_dwarf2_find_line (bfd *abfd, BFD_ASSERT (stash->info_ptr_end == stash->info_ptr + total_size); - stash->sec = find_debug_info (abfd, NULL); + stash->sec = find_debug_info (debug_bfd, NULL); stash->sec_info_ptr = stash->info_ptr; stash->syms = symbols; + stash->bfd = debug_bfd; } /* A null info_ptr indicates that there is no dwarf2 info @@ -2634,14 +2467,23 @@ _bfd_dwarf2_find_line (bfd *abfd, /* Check the previously read comp. units first. */ for (each = stash->all_comp_units; each; each = each->next_unit) - if ((symbol->flags & BSF_FUNCTION) == 0 - || comp_unit_contains_address (each, addr)) - { - found = comp_unit_find_line (each, symbol, addr, filename_ptr, - linenumber_ptr, stash); - if (found) - goto done; - } + { + if (do_line) + found = (((symbol->flags & BSF_FUNCTION) == 0 + || comp_unit_contains_address (each, addr)) + && comp_unit_find_line (each, symbol, addr, + filename_ptr, linenumber_ptr, + stash)); + else + found = (comp_unit_contains_address (each, addr) + && comp_unit_find_nearest_line (each, addr, + filename_ptr, + functionname_ptr, + linenumber_ptr, + stash)); + if (found) + goto done; + } /* The DWARF2 spec says that the initial length field, and the offset of the abbreviation table, should both be 4-byte values. @@ -2657,13 +2499,13 @@ _bfd_dwarf2_find_line (bfd *abfd, unsigned int offset_size = addr_size; bfd_byte *info_ptr_unit = stash->info_ptr; - length = read_4_bytes (abfd, stash->info_ptr); - /* A 0xffffff length is the DWARF3 way of indicating we use - 64-bit offsets, instead of 32-bit offsets. */ + length = read_4_bytes (stash->bfd, stash->info_ptr); + /* A 0xffffff length is the DWARF3 way of indicating + we use 64-bit offsets, instead of 32-bit offsets. */ if (length == 0xffffffff) { offset_size = 8; - length = read_8_bytes (abfd, stash->info_ptr + 4); + length = read_8_bytes (stash->bfd, stash->info_ptr + 4); stash->info_ptr += 12; } /* A zero length is the IRIX way of indicating 64-bit offsets, @@ -2672,30 +2514,36 @@ _bfd_dwarf2_find_line (bfd *abfd, else if (length == 0) { offset_size = 8; - length = read_4_bytes (abfd, stash->info_ptr + 4); + length = read_4_bytes (stash->bfd, stash->info_ptr + 4); stash->info_ptr += 8; } - /* In the absence of the hints above, we assume addr_size-sized - offsets, for backward-compatibility with pre-DWARF3 64-bit - platforms. */ + /* In the absence of the hints above, we assume 32-bit DWARF2 + offsets even for targets with 64-bit addresses, because: + a) most of the time these targets will not have generated + more than 2Gb of debug info and so will not need 64-bit + offsets, + and + b) if they do use 64-bit offsets but they are not using + the size hints that are tested for above then they are + not conforming to the DWARF3 standard anyway. */ else if (addr_size == 8) { - length = read_8_bytes (abfd, stash->info_ptr); - stash->info_ptr += 8; + offset_size = 4; + stash->info_ptr += 4; } else stash->info_ptr += 4; if (length > 0) { - each = parse_comp_unit (abfd, stash, length, info_ptr_unit, + each = parse_comp_unit (stash, length, info_ptr_unit, offset_size); stash->info_ptr += length; if ((bfd_vma) (stash->info_ptr - stash->sec_info_ptr) == stash->sec->size) { - stash->sec = find_debug_info (abfd, stash->sec); + stash->sec = find_debug_info (stash->bfd, stash->sec); stash->sec_info_ptr = stash->info_ptr; } @@ -2709,13 +2557,22 @@ _bfd_dwarf2_find_line (bfd *abfd, unit->high == 0), we need to consult the line info table to see if a compilation unit contains the given address. */ - found = (((symbol->flags & BSF_FUNCTION) == 0 - || each->arange.high <= 0 - || comp_unit_contains_address (each, addr)) - && comp_unit_find_line (each, symbol, addr, - filename_ptr, - linenumber_ptr, - stash)); + if (do_line) + found = (((symbol->flags & BSF_FUNCTION) == 0 + || each->arange.high == 0 + || comp_unit_contains_address (each, addr)) + && comp_unit_find_line (each, symbol, addr, + filename_ptr, + linenumber_ptr, + stash)); + else + found = ((each->arange.high == 0 + || comp_unit_contains_address (each, addr)) + && comp_unit_find_nearest_line (each, addr, + filename_ptr, + functionname_ptr, + linenumber_ptr, + stash)); if (found) goto done; } @@ -2729,6 +2586,42 @@ done: return found; } +/* The DWARF2 version of find_nearest_line. + Return TRUE if the line is found without error. */ + +bfd_boolean +_bfd_dwarf2_find_nearest_line (bfd *abfd, + asection *section, + asymbol **symbols, + bfd_vma offset, + const char **filename_ptr, + const char **functionname_ptr, + unsigned int *linenumber_ptr, + unsigned int addr_size, + void **pinfo) +{ + return find_line (abfd, section, offset, NULL, symbols, filename_ptr, + functionname_ptr, linenumber_ptr, addr_size, + pinfo); +} + +/* The DWARF2 version of find_line. + Return TRUE if the line is found without error. */ + +bfd_boolean +_bfd_dwarf2_find_line (bfd *abfd, + asymbol **symbols, + asymbol *symbol, + const char **filename_ptr, + unsigned int *linenumber_ptr, + unsigned int addr_size, + void **pinfo) +{ + return find_line (abfd, NULL, 0, symbol, symbols, filename_ptr, + NULL, linenumber_ptr, addr_size, + pinfo); +} + bfd_boolean _bfd_dwarf2_find_inliner_info (bfd *abfd ATTRIBUTE_UNUSED, const char **filename_ptr, @@ -2742,17 +2635,18 @@ _bfd_dwarf2_find_inliner_info (bfd *abfd ATTRIBUTE_UNUSED, if (stash) { struct funcinfo *func = stash->inliner_chain; + if (func && func->caller_func) { *filename_ptr = func->caller_file; *functionname_ptr = func->caller_func->name; *linenumber_ptr = func->caller_line; stash->inliner_chain = func->caller_func; - return (TRUE); + return TRUE; } } - return (FALSE); + return FALSE; } void diff --git a/contrib/binutils/bfd/ecoff.c b/contrib/binutils/bfd/ecoff.c index 75e1cc2a398d..45cdb1ddb43f 100644 --- a/contrib/binutils/bfd/ecoff.c +++ b/contrib/binutils/bfd/ecoff.c @@ -1,6 +1,6 @@ /* Generic ECOFF (Extended-COFF) routines. Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, - 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Original version by Per Bothner. Full support added by Ian Lance Taylor, ian@cygnus.com. @@ -20,8 +20,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "bfdlink.h" #include "libbfd.h" #include "aout/ar.h" @@ -140,8 +140,7 @@ _bfd_ecoff_mkobject_hook (bfd *abfd, void * filehdr, void * aouthdr) /* Initialize a new section. */ bfd_boolean -_bfd_ecoff_new_section_hook (bfd *abfd ATTRIBUTE_UNUSED, - asection *section) +_bfd_ecoff_new_section_hook (bfd *abfd, asection *section) { unsigned int i; static struct @@ -181,7 +180,7 @@ _bfd_ecoff_new_section_hook (bfd *abfd ATTRIBUTE_UNUSED, uncertain about .init on some systems and I don't know how shared libraries work. */ - return TRUE; + return _bfd_generic_new_section_hook (abfd, section); } /* Determine the machine architecture and type. This is called from @@ -1863,7 +1862,8 @@ _bfd_ecoff_set_arch_mach (bfd *abfd, /* Get the size of the section headers. */ int -_bfd_ecoff_sizeof_headers (bfd *abfd, bfd_boolean reloc ATTRIBUTE_UNUSED) +_bfd_ecoff_sizeof_headers (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { asection *current; int c; @@ -1937,7 +1937,7 @@ ecoff_compute_section_file_positions (bfd *abfd) const bfd_vma round = ecoff_backend (abfd)->round; bfd_size_type amt; - sofar = _bfd_ecoff_sizeof_headers (abfd, FALSE); + sofar = _bfd_ecoff_sizeof_headers (abfd, NULL); file_sofar = sofar; /* Sort the sections by VMA. */ @@ -2358,7 +2358,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd) } if ((abfd->flags & D_PAGED) != 0) - text_size = _bfd_ecoff_sizeof_headers (abfd, FALSE); + text_size = _bfd_ecoff_sizeof_headers (abfd, NULL); else text_size = 0; text_start = 0; @@ -2861,7 +2861,7 @@ _bfd_ecoff_slurp_armap (bfd *abfd) bfd_slurp_armap, but that seems inappropriate since no other target uses this format. Instead, we check directly for a COFF armap. */ - if (strneq (nextname, "/ ", 16)) + if (CONST_STRNEQ (nextname, "/ ")) return bfd_slurp_armap (abfd); /* See if the first element is an armap. */ @@ -3087,7 +3087,7 @@ _bfd_ecoff_write_armap (bfd *abfd, last_elt = current; for (i = 0; i < orl_count; i++) { - unsigned int hash, rehash; + unsigned int hash, rehash = 0; /* Advance firstreal to the file position of this archive element. */ @@ -3097,7 +3097,7 @@ _bfd_ecoff_write_armap (bfd *abfd, { firstreal += arelt_size (current) + sizeof (struct ar_hdr); firstreal += firstreal % 2; - current = current->next; + current = current->archive_next; } while (current != map[i].u.abfd); } @@ -3757,7 +3757,7 @@ ecoff_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info) while (*pundef != NULL) { struct bfd_link_hash_entry *h; - unsigned int hash, rehash; + unsigned int hash, rehash = 0; unsigned int file_offset; const char *name; bfd *element; diff --git a/contrib/binutils/bfd/ecofflink.c b/contrib/binutils/bfd/ecofflink.c index 4246e94f3937..8ee68e066258 100644 --- a/contrib/binutils/bfd/ecofflink.c +++ b/contrib/binutils/bfd/ecofflink.c @@ -1,6 +1,6 @@ /* Routines to link ECOFF debugging information. Copyright 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, - 2004, 2005, 2006 Free Software Foundation, Inc. + 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>. This file is part of BFD, the Binary File Descriptor library. @@ -19,8 +19,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "bfdlink.h" #include "libbfd.h" #include "objalloc.h" @@ -782,7 +782,6 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap, fdr_ptr += fdr_add, i++) { FDR fdr; - bfd_vma fdr_adr; bfd_byte *sym_out; bfd_byte *lraw_src; bfd_byte *lraw_end; @@ -799,8 +798,6 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap, else (*input_swap->swap_fdr_in) (input_bfd, (PTR) fdr_ptr, &fdr); - fdr_adr = fdr.adr; - /* FIXME: It is conceivable that this FDR points to the .init or .fini section, in which case this will not do the right thing. */ diff --git a/contrib/binutils/bfd/efi-app-ia32.c b/contrib/binutils/bfd/efi-app-ia32.c index b186f907ce68..06ed80598709 100644 --- a/contrib/binutils/bfd/efi-app-ia32.c +++ b/contrib/binutils/bfd/efi-app-ia32.c @@ -1,5 +1,5 @@ /* BFD back-end for Intel IA-32 EFI application files. - Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2007 Free Software Foundation, Inc. Contributed by David Mosberger <davidm@hpl.hp.com> This file is part of BFD, the Binary File Descriptor library. @@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #define TARGET_SYM bfd_efi_app_ia32_vec #define TARGET_NAME "efi-app-ia32" diff --git a/contrib/binutils/bfd/efi-app-ia64.c b/contrib/binutils/bfd/efi-app-ia64.c index c2a77aca55b2..b60ca738eda6 100644 --- a/contrib/binutils/bfd/efi-app-ia64.c +++ b/contrib/binutils/bfd/efi-app-ia64.c @@ -1,5 +1,5 @@ /* BFD back-end for HP/Intel IA-64 EFI application files. - Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2007 Free Software Foundation, Inc. Contributed by David Mosberger <davidm@hpl.hp.com> This file is part of BFD, the Binary File Descriptor library. @@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #define TARGET_SYM bfd_efi_app_ia64_vec #define TARGET_NAME "efi-app-ia64" diff --git a/contrib/binutils/bfd/elf-attrs.c b/contrib/binutils/bfd/elf-attrs.c new file mode 100644 index 000000000000..d1a64f4bed93 --- /dev/null +++ b/contrib/binutils/bfd/elf-attrs.c @@ -0,0 +1,628 @@ +/* ELF attributes support (based on ARM EABI attributes). + Copyright 2005, 2006, 2007 + Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "sysdep.h" +#include "bfd.h" +#include "libiberty.h" +#include "libbfd.h" +#include "elf-bfd.h" + +/* Return the number of bytes needed by I in uleb128 format. */ +static int +uleb128_size (unsigned int i) +{ + int size; + size = 1; + while (i >= 0x80) + { + i >>= 7; + size++; + } + return size; +} + +/* Return TRUE if the attribute has the default value (0/""). */ +static bfd_boolean +is_default_attr (obj_attribute *attr) +{ + if ((attr->type & 1) && attr->i != 0) + return FALSE; + if ((attr->type & 2) && attr->s && *attr->s) + return FALSE; + + return TRUE; +} + +/* Return the size of a single attribute. */ +static bfd_vma +obj_attr_size (int tag, obj_attribute *attr) +{ + bfd_vma size; + + if (is_default_attr (attr)) + return 0; + + size = uleb128_size (tag); + if (attr->type & 1) + size += uleb128_size (attr->i); + if (attr->type & 2) + size += strlen ((char *)attr->s) + 1; + return size; +} + +/* Return the vendor name for a given object attributes section. */ +static const char * +vendor_obj_attr_name (bfd *abfd, int vendor) +{ + return (vendor == OBJ_ATTR_PROC + ? get_elf_backend_data (abfd)->obj_attrs_vendor + : "gnu"); +} + +/* Return the size of the object attributes section for VENDOR + (OBJ_ATTR_PROC or OBJ_ATTR_GNU), or 0 if there are no attributes + for that vendor to record and the vendor is OBJ_ATTR_GNU. */ +static bfd_vma +vendor_obj_attr_size (bfd *abfd, int vendor) +{ + bfd_vma size; + obj_attribute *attr; + obj_attribute_list *list; + int i; + const char *vendor_name = vendor_obj_attr_name (abfd, vendor); + + if (!vendor_name) + return 0; + + attr = elf_known_obj_attributes (abfd)[vendor]; + size = 0; + for (i = 4; i < NUM_KNOWN_OBJ_ATTRIBUTES; i++) + size += obj_attr_size (i, &attr[i]); + + for (list = elf_other_obj_attributes (abfd)[vendor]; + list; + list = list->next) + size += obj_attr_size (list->tag, &list->attr); + + /* <size> <vendor_name> NUL 0x1 <size> */ + return ((size || vendor == OBJ_ATTR_PROC) + ? size + 10 + strlen (vendor_name) + : 0); +} + +/* Return the size of the object attributes section. */ +bfd_vma +bfd_elf_obj_attr_size (bfd *abfd) +{ + bfd_vma size; + + size = vendor_obj_attr_size (abfd, OBJ_ATTR_PROC); + size += vendor_obj_attr_size (abfd, OBJ_ATTR_GNU); + + /* 'A' <sections for each vendor> */ + return (size ? size + 1 : 0); +} + +/* Write VAL in uleb128 format to P, returning a pointer to the + following byte. */ +static bfd_byte * +write_uleb128 (bfd_byte *p, unsigned int val) +{ + bfd_byte c; + do + { + c = val & 0x7f; + val >>= 7; + if (val) + c |= 0x80; + *(p++) = c; + } + while (val); + return p; +} + +/* Write attribute ATTR to butter P, and return a pointer to the following + byte. */ +static bfd_byte * +write_obj_attribute (bfd_byte *p, int tag, obj_attribute *attr) +{ + /* Suppress default entries. */ + if (is_default_attr (attr)) + return p; + + p = write_uleb128 (p, tag); + if (attr->type & 1) + p = write_uleb128 (p, attr->i); + if (attr->type & 2) + { + int len; + + len = strlen (attr->s) + 1; + memcpy (p, attr->s, len); + p += len; + } + + return p; +} + +/* Write the contents of the object attributes section (length SIZE) + for VENDOR to CONTENTS. */ +static void +vendor_set_obj_attr_contents (bfd *abfd, bfd_byte *contents, bfd_vma size, + int vendor) +{ + bfd_byte *p; + obj_attribute *attr; + obj_attribute_list *list; + int i; + const char *vendor_name = vendor_obj_attr_name (abfd, vendor); + size_t vendor_length = strlen (vendor_name) + 1; + + p = contents; + bfd_put_32 (abfd, size, p); + p += 4; + memcpy (p, vendor_name, vendor_length); + p += vendor_length; + *(p++) = Tag_File; + bfd_put_32 (abfd, size - 4 - vendor_length, p); + p += 4; + + attr = elf_known_obj_attributes (abfd)[vendor]; + for (i = 4; i < NUM_KNOWN_OBJ_ATTRIBUTES; i++) + p = write_obj_attribute (p, i, &attr[i]); + + for (list = elf_other_obj_attributes (abfd)[vendor]; + list; + list = list->next) + p = write_obj_attribute (p, list->tag, &list->attr); +} + +/* Write the contents of the object attributes section to CONTENTS. */ +void +bfd_elf_set_obj_attr_contents (bfd *abfd, bfd_byte *contents, bfd_vma size) +{ + bfd_byte *p; + int vendor; + bfd_vma my_size; + + p = contents; + *(p++) = 'A'; + my_size = 1; + for (vendor = OBJ_ATTR_FIRST; vendor <= OBJ_ATTR_LAST; vendor++) + { + bfd_vma vendor_size = vendor_obj_attr_size (abfd, vendor); + if (vendor_size) + vendor_set_obj_attr_contents (abfd, p, vendor_size, vendor); + p += vendor_size; + my_size += vendor_size; + } + + if (size != my_size) + abort (); +} + +/* Allocate/find an object attribute. */ +static obj_attribute * +elf_new_obj_attr (bfd *abfd, int vendor, int tag) +{ + obj_attribute *attr; + obj_attribute_list *list; + obj_attribute_list *p; + obj_attribute_list **lastp; + + + if (tag < NUM_KNOWN_OBJ_ATTRIBUTES) + { + /* Knwon tags are preallocated. */ + attr = &elf_known_obj_attributes (abfd)[vendor][tag]; + } + else + { + /* Create a new tag. */ + list = (obj_attribute_list *) + bfd_alloc (abfd, sizeof (obj_attribute_list)); + memset (list, 0, sizeof (obj_attribute_list)); + list->tag = tag; + /* Keep the tag list in order. */ + lastp = &elf_other_obj_attributes (abfd)[vendor]; + for (p = *lastp; p; p = p->next) + { + if (tag < p->tag) + break; + lastp = &p->next; + } + list->next = *lastp; + *lastp = list; + attr = &list->attr; + } + + return attr; +} + +/* Return the value of an integer object attribute. */ +int +bfd_elf_get_obj_attr_int (bfd *abfd, int vendor, int tag) +{ + obj_attribute_list *p; + + if (tag < NUM_KNOWN_OBJ_ATTRIBUTES) + { + /* Knwon tags are preallocated. */ + return elf_known_obj_attributes (abfd)[vendor][tag].i; + } + else + { + for (p = elf_other_obj_attributes (abfd)[vendor]; + p; + p = p->next) + { + if (tag == p->tag) + return p->attr.i; + if (tag < p->tag) + break; + } + return 0; + } +} + +/* Add an integer object attribute. */ +void +bfd_elf_add_obj_attr_int (bfd *abfd, int vendor, int tag, unsigned int i) +{ + obj_attribute *attr; + + attr = elf_new_obj_attr (abfd, vendor, tag); + attr->type = 1; + attr->i = i; +} + +/* Duplicate an object attribute string value. */ +char * +_bfd_elf_attr_strdup (bfd *abfd, const char * s) +{ + char * p; + int len; + + len = strlen (s) + 1; + p = (char *) bfd_alloc (abfd, len); + return memcpy (p, s, len); +} + +/* Add a string object attribute. */ +void +bfd_elf_add_obj_attr_string (bfd *abfd, int vendor, int tag, const char *s) +{ + obj_attribute *attr; + + attr = elf_new_obj_attr (abfd, vendor, tag); + attr->type = 2; + attr->s = _bfd_elf_attr_strdup (abfd, s); +} + +/* Add a Tag_compatibility object attribute. */ +void +bfd_elf_add_obj_attr_compat (bfd *abfd, int vendor, unsigned int i, + const char *s) +{ + obj_attribute_list *list; + obj_attribute_list *p; + obj_attribute_list **lastp; + + list = (obj_attribute_list *) + bfd_alloc (abfd, sizeof (obj_attribute_list)); + memset (list, 0, sizeof (obj_attribute_list)); + list->tag = Tag_compatibility; + list->attr.type = 3; + list->attr.i = i; + list->attr.s = _bfd_elf_attr_strdup (abfd, s); + + lastp = &elf_other_obj_attributes (abfd)[vendor]; + for (p = *lastp; p; p = p->next) + { + int cmp; + if (p->tag != Tag_compatibility) + break; + cmp = strcmp(s, p->attr.s); + if (cmp < 0 || (cmp == 0 && i < p->attr.i)) + break; + lastp = &p->next; + } + list->next = *lastp; + *lastp = list; +} + +/* Copy the object attributes from IBFD to OBFD. */ +void +_bfd_elf_copy_obj_attributes (bfd *ibfd, bfd *obfd) +{ + obj_attribute *in_attr; + obj_attribute *out_attr; + obj_attribute_list *list; + int i; + int vendor; + + for (vendor = OBJ_ATTR_FIRST; vendor <= OBJ_ATTR_LAST; vendor++) + { + in_attr = &elf_known_obj_attributes (ibfd)[vendor][4]; + out_attr = &elf_known_obj_attributes (obfd)[vendor][4]; + for (i = 4; i < NUM_KNOWN_OBJ_ATTRIBUTES; i++) + { + out_attr->type = in_attr->type; + out_attr->i = in_attr->i; + if (in_attr->s && *in_attr->s) + out_attr->s = _bfd_elf_attr_strdup (obfd, in_attr->s); + in_attr++; + out_attr++; + } + + for (list = elf_other_obj_attributes (ibfd)[vendor]; + list; + list = list->next) + { + in_attr = &list->attr; + switch (in_attr->type) + { + case 1: + bfd_elf_add_obj_attr_int (obfd, vendor, list->tag, in_attr->i); + break; + case 2: + bfd_elf_add_obj_attr_string (obfd, vendor, list->tag, + in_attr->s); + break; + case 3: + bfd_elf_add_obj_attr_compat (obfd, vendor, in_attr->i, + in_attr->s); + break; + default: + abort (); + } + } + } +} + +/* Determine whether a GNU object attribute tag takes an integer, a + string or both. */ +static int +gnu_obj_attrs_arg_type (int tag) +{ + /* Except for Tag_compatibility, for GNU attributes we follow the + same rule ARM ones > 32 follow: odd-numbered tags take strings + and even-numbered tags take integers. In addition, tag & 2 is + nonzero for architecture-independent tags and zero for + architecture-dependent ones. */ + if (tag == Tag_compatibility) + return 3; + else + return (tag & 1) != 0 ? 2 : 1; +} + +/* Determine what arguments an attribute tag takes. */ +int +_bfd_elf_obj_attrs_arg_type (bfd *abfd, int vendor, int tag) +{ + switch (vendor) + { + case OBJ_ATTR_PROC: + return get_elf_backend_data (abfd)->obj_attrs_arg_type (tag); + break; + case OBJ_ATTR_GNU: + return gnu_obj_attrs_arg_type (tag); + break; + default: + abort (); + } +} + +/* Parse an object attributes section. */ +void +_bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr) +{ + bfd_byte *contents; + bfd_byte *p; + bfd_vma len; + const char *std_section; + + contents = bfd_malloc (hdr->sh_size); + if (!contents) + return; + if (!bfd_get_section_contents (abfd, hdr->bfd_section, contents, 0, + hdr->sh_size)) + { + free (contents); + return; + } + p = contents; + std_section = get_elf_backend_data (abfd)->obj_attrs_vendor; + if (*(p++) == 'A') + { + len = hdr->sh_size - 1; + while (len > 0) + { + int namelen; + bfd_vma section_len; + int vendor; + + section_len = bfd_get_32 (abfd, p); + p += 4; + if (section_len > len) + section_len = len; + len -= section_len; + namelen = strlen ((char *)p) + 1; + section_len -= namelen + 4; + if (std_section && strcmp ((char *)p, std_section) == 0) + vendor = OBJ_ATTR_PROC; + else if (strcmp ((char *)p, "gnu") == 0) + vendor = OBJ_ATTR_GNU; + else + { + /* Other vendor section. Ignore it. */ + p += namelen + section_len; + continue; + } + + p += namelen; + while (section_len > 0) + { + int tag; + unsigned int n; + unsigned int val; + bfd_vma subsection_len; + bfd_byte *end; + + tag = read_unsigned_leb128 (abfd, p, &n); + p += n; + subsection_len = bfd_get_32 (abfd, p); + p += 4; + if (subsection_len > section_len) + subsection_len = section_len; + section_len -= subsection_len; + subsection_len -= n + 4; + end = p + subsection_len; + switch (tag) + { + case Tag_File: + while (p < end) + { + int type; + + tag = read_unsigned_leb128 (abfd, p, &n); + p += n; + type = _bfd_elf_obj_attrs_arg_type (abfd, vendor, tag); + switch (type) + { + case 3: + val = read_unsigned_leb128 (abfd, p, &n); + p += n; + bfd_elf_add_obj_attr_compat (abfd, vendor, val, + (char *)p); + p += strlen ((char *)p) + 1; + break; + case 2: + bfd_elf_add_obj_attr_string (abfd, vendor, tag, + (char *)p); + p += strlen ((char *)p) + 1; + break; + case 1: + val = read_unsigned_leb128 (abfd, p, &n); + p += n; + bfd_elf_add_obj_attr_int (abfd, vendor, tag, val); + break; + default: + abort (); + } + } + break; + case Tag_Section: + case Tag_Symbol: + /* Don't have anywhere convenient to attach these. + Fall through for now. */ + default: + /* Ignore things we don't kow about. */ + p += subsection_len; + subsection_len = 0; + break; + } + } + } + } + free (contents); +} + +/* Merge common object attributes from IBFD into OBFD. Raise an error + if there are conflicting attributes. Any processor-specific + attributes have already been merged. This must be called from the + bfd_elfNN_bfd_merge_private_bfd_data hook for each individual + target, along with any target-specific merging. Because there are + no common attributes other than Tag_compatibility at present, and + non-"gnu" Tag_compatibility is not expected in "gnu" sections, this + is not presently called for targets without their own + attributes. */ + +bfd_boolean +_bfd_elf_merge_object_attributes (bfd *ibfd, bfd *obfd) +{ + obj_attribute *in_attr; + obj_attribute *out_attr; + obj_attribute_list *in_list; + obj_attribute_list *out_list; + int vendor; + + /* The only common attribute is currently Tag_compatibility, + accepted in both processor and "gnu" sections. */ + for (vendor = OBJ_ATTR_FIRST; vendor <= OBJ_ATTR_LAST; vendor++) + { + in_list = elf_other_obj_attributes (ibfd)[vendor]; + out_list = elf_other_obj_attributes (ibfd)[vendor]; + while (in_list && in_list->tag == Tag_compatibility) + { + in_attr = &in_list->attr; + if (in_attr->i == 0) + continue; + if (in_attr->i == 1 && strcmp (in_attr->s, "gnu") != 0) + { + _bfd_error_handler + (_("ERROR: %B: Must be processed by '%s' toolchain"), + ibfd, in_attr->s); + return FALSE; + } + if (!out_list || out_list->tag != Tag_compatibility + || strcmp (in_attr->s, out_list->attr.s) != 0) + { + /* Add this compatibility tag to the output. */ + bfd_elf_add_proc_attr_compat (obfd, in_attr->i, in_attr->s); + continue; + } + out_attr = &out_list->attr; + /* Check all the input tags with the same identifier. */ + for (;;) + { + if (out_list->tag != Tag_compatibility + || in_attr->i != out_attr->i + || strcmp (in_attr->s, out_attr->s) != 0) + { + _bfd_error_handler + (_("ERROR: %B: Incompatible object tag '%s':%d"), + ibfd, in_attr->s, in_attr->i); + return FALSE; + } + in_list = in_list->next; + if (in_list->tag != Tag_compatibility + || strcmp (in_attr->s, in_list->attr.s) != 0) + break; + in_attr = &in_list->attr; + out_list = out_list->next; + if (out_list) + out_attr = &out_list->attr; + } + + /* Check the output doesn't have extra tags with this identifier. */ + if (out_list && out_list->tag == Tag_compatibility + && strcmp (in_attr->s, out_list->attr.s) == 0) + { + _bfd_error_handler + (_("ERROR: %B: Incompatible object tag '%s':%d"), + ibfd, in_attr->s, out_list->attr.i); + return FALSE; + } + } + } + + return TRUE; +} diff --git a/contrib/binutils/bfd/elf-bfd.h b/contrib/binutils/bfd/elf-bfd.h index 3fba1c228f0a..f4c3a0a3203b 100644 --- a/contrib/binutils/bfd/elf-bfd.h +++ b/contrib/binutils/bfd/elf-bfd.h @@ -1,6 +1,6 @@ /* BFD back-end data structures for ELF files. Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -155,6 +155,8 @@ struct elf_link_hash_entry unsigned int hidden : 1; /* Symbol was forced to local scope due to a version script file. */ unsigned int forced_local : 1; + /* Symbol was forced to be dynamic due to a version script file. */ + unsigned int dynamic : 1; /* Symbol was marked during garbage collection. */ unsigned int mark : 1; /* Symbol is referenced by a non-GOT/non-PLT relocation. This is @@ -259,31 +261,6 @@ struct elf_link_loaded_list }; /* Structures used by the eh_frame optimization code. */ -struct cie_header -{ - unsigned int length; - unsigned int id; -}; - -struct cie -{ - struct cie_header hdr; - unsigned char version; - char augmentation[20]; - bfd_vma code_align; - bfd_signed_vma data_align; - bfd_vma ra_column; - bfd_vma augmentation_size; - struct elf_link_hash_entry *personality; - unsigned char per_encoding; - unsigned char lsda_encoding; - unsigned char fde_encoding; - unsigned char initial_insn_length; - unsigned char make_relative; - unsigned char make_lsda_relative; - unsigned char initial_instructions[50]; -}; - struct eh_cie_fde { /* For FDEs, this points to the CIE used. */ @@ -302,12 +279,12 @@ struct eh_cie_fde unsigned int make_lsda_relative : 1; unsigned int need_lsda_relative : 1; unsigned int per_encoding_relative : 1; + unsigned int *set_loc; }; struct eh_frame_sec_info { unsigned int count; - unsigned int alloced; struct eh_cie_fde entry[1]; }; @@ -317,11 +294,11 @@ struct eh_frame_array_ent bfd_vma fde; }; +struct htab; + struct eh_frame_hdr_info { - struct cie last_cie; - asection *last_cie_sec; - struct eh_cie_fde *last_cie_inf; + struct htab *cies; asection *hdr_sec; unsigned int fde_count, array_count; struct eh_frame_array_ent *array; @@ -342,6 +319,10 @@ struct elf_link_hash_table when linking against or generating a shared object. */ bfd_boolean dynamic_sections_created; + /* True if this target has relocatable executables, so needs dynamic + section symbols. */ + bfd_boolean is_relocatable_executable; + /* The BFD used to hold special sections created by the linker. This will be the first BFD found which requires these sections to be created. */ @@ -375,6 +356,12 @@ struct elf_link_hash_table included in the link. */ struct bfd_link_needed_list *needed; + /* Sections in the output bfd that provides a section symbol + to be used by relocations emitted against local symbols. + Most targets will not use data_index_section. */ + asection *text_index_section; + asection *data_index_section; + /* The _GLOBAL_OFFSET_TABLE_ symbol. */ struct elf_link_hash_entry *hgot; @@ -403,10 +390,6 @@ struct elf_link_hash_table /* A linked list of BFD's loaded in the link. */ struct elf_link_loaded_list *loaded; - - /* True if this target has relocatable executables, so needs dynamic - section symbols. */ - bfd_boolean is_relocatable_executable; }; /* Look up an entry in an ELF linker hash table. */ @@ -466,7 +449,7 @@ struct elf_size_info { (*write_shdrs_and_ehdr) (bfd *); void (*write_relocs) (bfd *, asection *, void *); - void (*swap_symbol_in) + bfd_boolean (*swap_symbol_in) (bfd *, const void *, const void *, Elf_Internal_Sym *); void (*swap_symbol_out) (bfd *, const Elf_Internal_Sym *, void *, void *); @@ -555,6 +538,10 @@ enum action_discarded PRETEND = 2 }; +typedef asection * (*elf_gc_mark_hook_fn) + (asection *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *); + struct elf_backend_data { /* The architecture for this backend. */ @@ -563,6 +550,9 @@ struct elf_backend_data /* The ELF machine code (EM_xxxx) for this backend. */ int elf_machine_code; + /* EI_OSABI. */ + int elf_osabi; + /* The maximum page size for this backend. */ bfd_vma maxpagesize; @@ -571,6 +561,9 @@ struct elf_backend_data pages at least this large. May be smaller than maxpagesize. */ bfd_vma minpagesize; + /* The common page size for this backend. */ + bfd_vma commonpagesize; + /* The BFD flags applied to sections created for dynamic linking. */ flagword dynamic_sec_flags; @@ -725,6 +718,13 @@ struct elf_backend_data bfd_boolean (*check_directives) (bfd *abfd, struct bfd_link_info *info); + /* The AS_NEEDED_CLEANUP function is called once per --as-needed + input file that was not needed by the add_symbols phase of the + ELF backend linker. The function must undo any target specific + changes in the symbol hash table. */ + bfd_boolean (*as_needed_cleanup) + (bfd *abfd, struct bfd_link_info *info); + /* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend linker for every symbol which is defined by a dynamic object and referenced by a regular object. This is called after all the @@ -760,6 +760,11 @@ struct elf_backend_data bfd_boolean (*elf_backend_size_dynamic_sections) (bfd *output_bfd, struct bfd_link_info *info); + /* Set TEXT_INDEX_SECTION and DATA_INDEX_SECTION, the output sections + we keep to use as a base for relocs and symbols. */ + void (*elf_backend_init_index_section) + (bfd *output_bfd, struct bfd_link_info *info); + /* The RELOCATE_SECTION function is called by the ELF backend linker to handle the relocations for a section. @@ -787,8 +792,11 @@ struct elf_backend_data STB_LOCAL/STT_SECTION symbols specially. The output symbol is going to be the section symbol corresponding to the output section, which means that the addend must be adjusted - accordingly. */ - bfd_boolean (*elf_backend_relocate_section) + accordingly. + + Returns FALSE on error, TRUE on success, 2 if successful and + relocations should be written for this section. */ + int (*elf_backend_relocate_section) (bfd *output_bfd, struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms, asection **local_sections); @@ -826,13 +834,18 @@ struct elf_backend_data return the number of additional program segments which this BFD will need. It should return -1 on error. */ int (*elf_backend_additional_program_headers) - (bfd *); + (bfd *, struct bfd_link_info *); /* This function is called to modify an existing segment map in a backend specific fashion. */ bfd_boolean (*elf_backend_modify_segment_map) (bfd *, struct bfd_link_info *); + /* This function is called to modify program headers just before + they are written. */ + bfd_boolean (*elf_backend_modify_program_headers) + (bfd *, struct bfd_link_info *); + /* This function is called during section garbage collection to mark sections that define global symbols. */ bfd_boolean (*gc_mark_dynamic_ref) @@ -840,9 +853,12 @@ struct elf_backend_data /* This function is called during section gc to discover the section a particular relocation refers to. */ - asection * (*gc_mark_hook) - (asection *sec, struct bfd_link_info *, Elf_Internal_Rela *, - struct elf_link_hash_entry *h, Elf_Internal_Sym *); + elf_gc_mark_hook_fn gc_mark_hook; + + /* This function, if defined, is called after the first gc marking pass + to allow the backend to mark additional sections. */ + bfd_boolean (*gc_mark_extra_sections) + (struct bfd_link_info *info, elf_gc_mark_hook_fn gc_mark_hook); /* This function, if defined, is called during the sweep phase of gc in order that a backend might update any data structures it might @@ -865,8 +881,16 @@ struct elf_backend_data /* This function, if defined, is called after all local symbols and global symbols converted to locals are emitted into the symtab - section. It allows the backend to emit special global symbols + section. It allows the backend to emit special local symbols not handled in the hash table. */ + bfd_boolean (*elf_backend_output_arch_local_syms) + (bfd *, struct bfd_link_info *, void *, + bfd_boolean (*) (void *, const char *, Elf_Internal_Sym *, asection *, + struct elf_link_hash_entry *)); + + /* This function, if defined, is called after all symbols are emitted + into the symtab section. It allows the backend to emit special + global symbols not handled in the hash table. */ bfd_boolean (*elf_backend_output_arch_syms) (bfd *, struct bfd_link_info *, void *, bfd_boolean (*) (void *, const char *, Elf_Internal_Sym *, asection *, @@ -913,15 +937,19 @@ struct elf_backend_data (asection *, Elf_Internal_Rela *); /* This function, if defined, is called when an NT_PRSTATUS note is found - in a core file. */ + in a core file. */ bfd_boolean (*elf_backend_grok_prstatus) (bfd *, Elf_Internal_Note *); /* This function, if defined, is called when an NT_PSINFO or NT_PRPSINFO - note is found in a core file. */ + note is found in a core file. */ bfd_boolean (*elf_backend_grok_psinfo) (bfd *, Elf_Internal_Note *); + /* This function, if defined, is called to write a note to a corefile. */ + char *(*elf_backend_write_core_note) + (bfd *abfd, char *buf, int *bufsiz, int note_type, ...); + /* Functions to print VMAs. Special code to handle 64 bit ELF files. */ void (* elf_backend_sprintf_vma) (bfd *, char *, bfd_vma); @@ -974,7 +1002,7 @@ struct elf_backend_data /* This function, if defined, may write out the given section. Returns TRUE if it did so and FALSE if the caller should. */ bfd_boolean (*elf_backend_write_section) - (bfd *, asection *, bfd_byte *); + (bfd *, struct bfd_link_info *, asection *, bfd_byte *); /* The level of IRIX compatibility we're striving for. MIPS ELF specific function. */ @@ -1022,6 +1050,12 @@ struct elf_backend_data bfd_boolean *, bfd_boolean *, bfd *, asection **); + /* Return TRUE if symbol should be hashed in the `.gnu.hash' section. */ + bfd_boolean (*elf_hash_symbol) (struct elf_link_hash_entry *); + + /* Return TRUE if type is a function symbol type. */ + bfd_boolean (*is_function_type) (unsigned int type); + /* Used to handle bad SHF_LINK_ORDER input. */ bfd_error_handler_type link_order_error_handler; @@ -1041,6 +1075,19 @@ struct elf_backend_data so-called reserved entries on some systems. */ bfd_vma got_header_size; + /* The vendor name to use for a processor-standard attributes section. */ + const char *obj_attrs_vendor; + + /* The section name to use for a processor-standard attributes section. */ + const char *obj_attrs_section; + + /* Return 1, 2 or 3 to indicate what type of arguments a + processor-specific tag takes. */ + int (*obj_attrs_arg_type) (int); + + /* The section type to use for an attributes section. */ + unsigned int obj_attrs_section_type; + /* This is TRUE if the linker should act like collect and gather global constructors and destructors by name. This is TRUE for MIPS ELF because the Irix 5 tools can not handle the .init @@ -1088,10 +1135,17 @@ struct elf_backend_data unsigned can_refcount : 1; unsigned want_got_sym : 1; unsigned want_dynbss : 1; - /* Targets which do not support physical addressing often require - that the p_paddr field in the section header to be set to zero. - This field indicates whether this behavior is required. */ + + /* Targets which do not support physical addressing often require + that the p_paddr field in the section header to be set to zero. + This field indicates whether this behavior is required. */ unsigned want_p_paddr_set_to_zero : 1; + + /* True if an object file lacking a .note.GNU-stack section + should be assumed to be requesting exec stack. At least one + other file in the link needs to have a .note.GNU-stack section + for a PT_GNU_STACK segment to be created. */ + unsigned default_execstack : 1; }; /* Information stored for each BFD section in an ELF file. This @@ -1160,12 +1214,12 @@ struct bfd_elf_section_data struct bfd_symbol *id; } group; - /* Optional information about section group; NULL if it doesn't - belongs to any section group. */ + /* For a member of a group, points to the SHT_GROUP section. + NULL for the SHT_GROUP section itself and non-group sections. */ asection *sec_group; - /* A linked list of sections in the group. Circular when used by - the linker. */ + /* A linked list of member sections in the group. Circular when used by + the linker. For the SHT_GROUP section, points at first member. */ asection *next_in_group; /* A pointer used for various section optimizations. */ @@ -1181,15 +1235,11 @@ struct bfd_elf_section_data #define elf_next_in_group(sec) (elf_section_data(sec)->next_in_group) #define elf_sec_group(sec) (elf_section_data(sec)->sec_group) -/* Return TRUE if section has been discarded. */ -#define elf_discarded_section(sec) \ - (!bfd_is_abs_section (sec) \ - && bfd_is_abs_section ((sec)->output_section) \ - && (sec)->sec_info_type != ELF_INFO_TYPE_MERGE \ - && (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS) +#define xvec_get_elf_backend_data(xvec) \ + ((struct elf_backend_data *) (xvec)->backend_data) #define get_elf_backend_data(abfd) \ - ((const struct elf_backend_data *) (abfd)->xvec->backend_data) + xvec_get_elf_backend_data ((abfd)->xvec) /* This struct is used to pass information to routines called via elf_link_hash_traverse which must return failure. */ @@ -1231,6 +1281,46 @@ struct elf_find_verdep_info bfd_boolean failed; }; +/* The maximum number of known object attributes for any target. */ +#define NUM_KNOWN_OBJ_ATTRIBUTES 32 + +/* The value of an object attribute. type & 1 indicates whether there + is an integer value; type & 2 indicates whether there is a string + value. */ + +typedef struct obj_attribute +{ + int type; + unsigned int i; + char *s; +} obj_attribute; + +typedef struct obj_attribute_list +{ + struct obj_attribute_list *next; + int tag; + obj_attribute attr; +} obj_attribute_list; + +/* Object attributes may either be defined by the processor ABI, index + OBJ_ATTR_PROC in the *_obj_attributes arrays, or be GNU-specific + (and possibly also processor-specific), index OBJ_ATTR_GNU. */ +#define OBJ_ATTR_PROC 0 +#define OBJ_ATTR_GNU 1 +#define OBJ_ATTR_FIRST OBJ_ATTR_PROC +#define OBJ_ATTR_LAST OBJ_ATTR_GNU + +/* The following object attribute tags are taken as generic, for all + targets and for "gnu" where there is no target standard. */ +enum +{ + Tag_NULL = 0, + Tag_File = 1, + Tag_Section = 2, + Tag_Symbol = 3, + Tag_compatibility = 32 +}; + /* Some private data is stashed away for future use using the tdata pointer in the bfd structure. */ @@ -1317,6 +1407,7 @@ struct elf_obj_tdata MIPS ELF linker. FIXME: We should figure out some way to only include this field for a MIPS ELF target. */ asection **local_stubs; + asection **local_call_stubs; /* Used to determine if PT_GNU_EH_FRAME segment header should be created. */ @@ -1368,6 +1459,12 @@ struct elf_obj_tdata /* Used to determine if the e_flags field has been initialized */ bfd_boolean flags_init; + + /* Symbol buffer. */ + void *symbuf; + + obj_attribute known_obj_attributes[2][NUM_KNOWN_OBJ_ATTRIBUTES]; + obj_attribute_list *other_obj_attributes[2]; }; #define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data) @@ -1397,6 +1494,12 @@ struct elf_obj_tdata #define elf_dyn_lib_class(bfd) (elf_tdata(bfd) -> dyn_lib_class) #define elf_bad_symtab(bfd) (elf_tdata(bfd) -> bad_symtab) #define elf_flags_init(bfd) (elf_tdata(bfd) -> flags_init) +#define elf_known_obj_attributes(bfd) (elf_tdata (bfd) -> known_obj_attributes) +#define elf_other_obj_attributes(bfd) (elf_tdata (bfd) -> other_obj_attributes) +#define elf_known_obj_attributes_proc(bfd) \ + (elf_known_obj_attributes (bfd) [OBJ_ATTR_PROC]) +#define elf_other_obj_attributes_proc(bfd) \ + (elf_other_obj_attributes (bfd) [OBJ_ATTR_PROC]) extern void _bfd_elf_swap_verdef_in (bfd *, const Elf_External_Verdef *, Elf_Internal_Verdef *); @@ -1462,6 +1565,8 @@ extern bfd_vma _bfd_elf_section_offset extern unsigned long bfd_elf_hash (const char *); +extern unsigned long bfd_elf_gnu_hash + (const char *); extern bfd_reloc_status_type bfd_elf_generic_reloc (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); @@ -1500,11 +1605,11 @@ extern bfd_boolean _bfd_elf_match_sections_by_type extern bfd_boolean bfd_elf_is_group_section (bfd *, const struct bfd_section *); extern void _bfd_elf_section_already_linked - (bfd *, struct bfd_section *); + (bfd *, struct bfd_section *, struct bfd_link_info *); extern void bfd_elf_set_group_contents (bfd *, asection *, void *); extern asection *_bfd_elf_check_kept_section - (asection *); + (asection *, struct bfd_link_info *); extern void _bfd_elf_link_just_syms (asection *, struct bfd_link_info *); extern bfd_boolean _bfd_elf_copy_private_header_data @@ -1562,7 +1667,7 @@ extern bfd_boolean _bfd_elf_find_inliner_info #define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols #define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol extern int _bfd_elf_sizeof_headers - (bfd *, bfd_boolean); + (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_elf_new_section_hook (bfd *, asection *); extern bfd_boolean _bfd_elf_init_reloc_shdr @@ -1632,6 +1737,8 @@ extern bfd_boolean _bfd_elf_merge_symbol struct elf_link_hash_entry **, bfd_boolean *, bfd_boolean *, bfd_boolean *, bfd_boolean *); +extern bfd_boolean _bfd_elf_hash_symbol (struct elf_link_hash_entry *); + extern bfd_boolean _bfd_elf_add_default_symbol (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, const char *, Elf_Internal_Sym *, asection **, bfd_vma *, @@ -1668,6 +1775,10 @@ extern bfd_boolean _bfd_elf_create_got_section (bfd *, struct bfd_link_info *); extern struct elf_link_hash_entry *_bfd_elf_define_linkage_sym (bfd *, struct bfd_link_info *, asection *, const char *); +extern void _bfd_elf_init_1_index_section + (bfd *, struct bfd_link_info *); +extern void _bfd_elf_init_2_index_sections + (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_elfcore_make_pseudosection (bfd *, char *, size_t, ufile_ptr); @@ -1690,6 +1801,9 @@ extern bfd_boolean _bfd_elf_fix_symbol_flags extern bfd_boolean _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *, void *); +extern bfd_boolean _bfd_elf_adjust_dynamic_copy + (struct elf_link_hash_entry *, asection *); + extern bfd_boolean _bfd_elf_link_sec_merge_syms (struct elf_link_hash_entry *, void *); @@ -1700,11 +1814,23 @@ extern bfd_boolean _bfd_elf_symbol_refs_local_p (struct elf_link_hash_entry *, struct bfd_link_info *, bfd_boolean); extern bfd_boolean bfd_elf_match_symbols_in_sections - (asection *sec1, asection *sec2); + (asection *, asection *, struct bfd_link_info *); + +extern void bfd_elf_perform_complex_relocation + (bfd * output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info * info, + bfd * input_bfd, + asection * input_section, + bfd_byte * contents, + Elf_Internal_Rela * rel, + Elf_Internal_Sym * local_syms, + asection ** local_sections); extern bfd_boolean _bfd_elf_setup_sections (bfd *); +extern void _bfd_elf_set_osabi (bfd * , struct bfd_link_info *); + extern const bfd_target *bfd_elf32_object_p (bfd *); extern const bfd_target *bfd_elf32_core_file_p @@ -1716,7 +1842,7 @@ extern int bfd_elf32_core_file_failing_signal extern bfd_boolean bfd_elf32_core_file_matches_executable_p (bfd *, bfd *); -extern void bfd_elf32_swap_symbol_in +extern bfd_boolean bfd_elf32_swap_symbol_in (bfd *, const void *, const void *, Elf_Internal_Sym *); extern void bfd_elf32_swap_symbol_out (bfd *, const Elf_Internal_Sym *, void *, void *); @@ -1758,7 +1884,7 @@ extern int bfd_elf64_core_file_failing_signal extern bfd_boolean bfd_elf64_core_file_matches_executable_p (bfd *, bfd *); -extern void bfd_elf64_swap_symbol_in +extern bfd_boolean bfd_elf64_swap_symbol_in (bfd *, const void *, const void *, Elf_Internal_Sym *); extern void bfd_elf64_swap_symbol_out (bfd *, const Elf_Internal_Sym *, void *, void *); @@ -1802,6 +1928,10 @@ extern bfd_boolean bfd_elf_link_record_dynamic_symbol extern int bfd_elf_link_record_local_dynamic_symbol (struct bfd_link_info *, bfd *, long); +extern void bfd_elf_link_mark_dynamic_symbol + (struct bfd_link_info *, struct elf_link_hash_entry *, + Elf_Internal_Sym *); + extern bfd_boolean _bfd_elf_close_and_cleanup (bfd *); @@ -1836,6 +1966,10 @@ extern bfd_boolean bfd_elf_gc_record_vtinherit extern bfd_boolean bfd_elf_gc_record_vtentry (bfd *, asection *, struct elf_link_hash_entry *, bfd_vma); +extern asection *_bfd_elf_gc_mark_hook + (asection *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *); + extern bfd_boolean _bfd_elf_gc_mark (struct bfd_link_info *, asection *, asection * (*) (asection *, struct bfd_link_info *, Elf_Internal_Rela *, @@ -1850,10 +1984,14 @@ extern bfd_boolean bfd_elf_gc_common_final_link extern bfd_boolean bfd_elf_reloc_symbol_deleted_p (bfd_vma, void *); -extern struct elf_segment_map * -_bfd_elf_make_dynamic_segment +extern struct elf_segment_map * _bfd_elf_make_dynamic_segment (bfd *, asection *); +extern bfd_boolean _bfd_elf_map_sections_to_segments + (bfd *, struct bfd_link_info *); + +extern bfd_boolean _bfd_elf_is_function_type (unsigned int); + /* Exported interface for writing elf corefile notes. */ extern char *elfcore_write_note (bfd *, char *, int *, const char *, int, const void *, int); @@ -1877,6 +2015,26 @@ extern bfd *_bfd_elf64_bfd_from_remote_memory (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, int (*target_read_memory) (bfd_vma, bfd_byte *, int)); +extern bfd_vma bfd_elf_obj_attr_size (bfd *); +extern void bfd_elf_set_obj_attr_contents (bfd *, bfd_byte *, bfd_vma); +extern int bfd_elf_get_obj_attr_int (bfd *, int, int); +extern void bfd_elf_add_obj_attr_int (bfd *, int, int, unsigned int); +#define bfd_elf_add_proc_attr_int(BFD, TAG, VALUE) \ + bfd_elf_add_obj_attr_int ((BFD), OBJ_ATTR_PROC, (TAG), (VALUE)) +extern void bfd_elf_add_obj_attr_string (bfd *, int, int, const char *); +#define bfd_elf_add_proc_attr_string(BFD, TAG, VALUE) \ + bfd_elf_add_obj_attr_string ((BFD), OBJ_ATTR_PROC, (TAG), (VALUE)) +extern void bfd_elf_add_obj_attr_compat (bfd *, int, unsigned int, + const char *); +#define bfd_elf_add_proc_attr_compat(BFD, INTVAL, STRVAL) \ + bfd_elf_add_obj_attr_compat ((BFD), OBJ_ATTR_PROC, (INTVAL), (STRVAL)) + +extern char *_bfd_elf_attr_strdup (bfd *, const char *); +extern void _bfd_elf_copy_obj_attributes (bfd *, bfd *); +extern int _bfd_elf_obj_attrs_arg_type (bfd *, int, int); +extern void _bfd_elf_parse_attributes (bfd *, Elf_Internal_Shdr *); +extern bfd_boolean _bfd_elf_merge_object_attributes (bfd *, bfd *); + /* Large common section. */ extern asection _bfd_elf_large_com_section; @@ -1936,7 +2094,7 @@ extern bfd_boolean _sh_elf_set_mach_from_flags else if (info->unresolved_syms_in_objects == RM_IGNORE \ && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) \ ; \ - else \ + else if (!info->relocatable) \ { \ bfd_boolean err; \ err = (info->unresolved_syms_in_objects == RM_GENERATE_ERROR \ @@ -1952,4 +2110,9 @@ extern bfd_boolean _sh_elf_set_mach_from_flags } \ while (0) +/* Will a symbol be bound to the the definition within the shared + library, if any. */ +#define SYMBOLIC_BIND(INFO, H) \ + ((INFO)->symbolic || ((INFO)->dynamic && !(H)->dynamic)) + #endif /* _LIBELF_H_ */ diff --git a/contrib/binutils/bfd/elf-eh-frame.c b/contrib/binutils/bfd/elf-eh-frame.c index 5100e72938d9..092c2c57ec34 100644 --- a/contrib/binutils/bfd/elf-eh-frame.c +++ b/contrib/binutils/bfd/elf-eh-frame.c @@ -1,5 +1,6 @@ /* .eh_frame section optimization. - Copyright 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007 + Free Software Foundation, Inc. Written by Jakub Jelinek <jakub@redhat.com>. This file is part of BFD, the Binary File Descriptor library. @@ -18,14 +19,42 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "elf-bfd.h" #include "elf/dwarf2.h" #define EH_FRAME_HDR_SIZE 8 +struct cie +{ + unsigned int length; + unsigned int hash; + unsigned char version; + unsigned char local_personality; + char augmentation[20]; + bfd_vma code_align; + bfd_signed_vma data_align; + bfd_vma ra_column; + bfd_vma augmentation_size; + union { + struct elf_link_hash_entry *h; + bfd_vma val; + } personality; + asection *output_sec; + struct eh_cie_fde *cie_inf; + unsigned char per_encoding; + unsigned char lsda_encoding; + unsigned char fde_encoding; + unsigned char initial_insn_length; + unsigned char make_relative; + unsigned char make_lsda_relative; + unsigned char initial_instructions[50]; +}; + + + /* If *ITER hasn't reached END yet, read the next byte into *RESULT and move onto the next byte. Return true on success. */ @@ -180,20 +209,27 @@ write_value (bfd *abfd, bfd_byte *buf, bfd_vma value, int width) } } -/* Return zero if C1 and C2 CIEs can be merged. */ +/* Return one if C1 and C2 CIEs can be merged. */ -static -int cie_compare (struct cie *c1, struct cie *c2) +static int +cie_eq (const void *e1, const void *e2) { - if (c1->hdr.length == c2->hdr.length + const struct cie *c1 = e1; + const struct cie *c2 = e2; + + if (c1->hash == c2->hash + && c1->length == c2->length && c1->version == c2->version + && c1->local_personality == c2->local_personality && strcmp (c1->augmentation, c2->augmentation) == 0 && strcmp (c1->augmentation, "eh") != 0 && c1->code_align == c2->code_align && c1->data_align == c2->data_align && c1->ra_column == c2->ra_column && c1->augmentation_size == c2->augmentation_size - && c1->personality == c2->personality + && memcmp (&c1->personality, &c2->personality, + sizeof (c1->personality)) == 0 + && c1->output_sec == c2->output_sec && c1->per_encoding == c2->per_encoding && c1->lsda_encoding == c2->lsda_encoding && c1->fde_encoding == c2->fde_encoding @@ -201,9 +237,38 @@ int cie_compare (struct cie *c1, struct cie *c2) && memcmp (c1->initial_instructions, c2->initial_instructions, c1->initial_insn_length) == 0) - return 0; + return 1; + + return 0; +} + +static hashval_t +cie_hash (const void *e) +{ + const struct cie *c = e; + return c->hash; +} - return 1; +static hashval_t +cie_compute_hash (struct cie *c) +{ + hashval_t h = 0; + h = iterative_hash_object (c->length, h); + h = iterative_hash_object (c->version, h); + h = iterative_hash (c->augmentation, strlen (c->augmentation) + 1, h); + h = iterative_hash_object (c->code_align, h); + h = iterative_hash_object (c->data_align, h); + h = iterative_hash_object (c->ra_column, h); + h = iterative_hash_object (c->augmentation_size, h); + h = iterative_hash_object (c->personality, h); + h = iterative_hash_object (c->output_sec, h); + h = iterative_hash_object (c->per_encoding, h); + h = iterative_hash_object (c->lsda_encoding, h); + h = iterative_hash_object (c->fde_encoding, h); + h = iterative_hash_object (c->initial_insn_length, h); + h = iterative_hash (c->initial_instructions, c->initial_insn_length, h); + c->hash = h; + return h; } /* Return the number of extra bytes that we'll be inserting into @@ -273,11 +338,14 @@ skip_cfa_op (bfd_byte **iter, bfd_byte *end, unsigned int encoded_ptr_width) if (!read_byte (iter, end, &op)) return FALSE; - switch (op & 0x80 ? op & 0xc0 : op) + switch (op & 0xc0 ? op & 0xc0 : op) { case DW_CFA_nop: case DW_CFA_advance_loc: case DW_CFA_restore: + case DW_CFA_remember_state: + case DW_CFA_restore_state: + case DW_CFA_GNU_window_save: /* No arguments. */ return TRUE; @@ -292,6 +360,8 @@ skip_cfa_op (bfd_byte **iter, bfd_byte *end, unsigned int encoded_ptr_width) /* One leb128 argument. */ return skip_leb128 (iter, end); + case DW_CFA_val_offset: + case DW_CFA_val_offset_sf: case DW_CFA_offset_extended: case DW_CFA_register: case DW_CFA_def_cfa: @@ -308,6 +378,7 @@ skip_cfa_op (bfd_byte **iter, bfd_byte *end, unsigned int encoded_ptr_width) && skip_bytes (iter, end, length)); case DW_CFA_expression: + case DW_CFA_val_expression: /* A leb128 followed by a variable-length argument. */ return (skip_leb128 (iter, end) && read_uleb128 (iter, end, &length) @@ -339,7 +410,8 @@ skip_cfa_op (bfd_byte **iter, bfd_byte *end, unsigned int encoded_ptr_width) ENCODED_PTR_WIDTH is as for skip_cfa_op. */ static bfd_byte * -skip_non_nops (bfd_byte *buf, bfd_byte *end, unsigned int encoded_ptr_width) +skip_non_nops (bfd_byte *buf, bfd_byte *end, unsigned int encoded_ptr_width, + unsigned int *set_loc_count) { bfd_byte *last; @@ -349,6 +421,8 @@ skip_non_nops (bfd_byte *buf, bfd_byte *end, unsigned int encoded_ptr_width) buf++; else { + if (*buf == DW_CFA_set_loc) + ++*set_loc_count; if (!skip_cfa_op (&buf, end, encoded_ptr_width)) return 0; last = buf; @@ -374,15 +448,24 @@ _bfd_elf_discard_section_eh_frame while (0) bfd_byte *ehbuf = NULL, *buf; - bfd_byte *last_cie, *last_fde; - struct eh_cie_fde *ent, *last_cie_inf, *this_inf; - struct cie_header hdr; - struct cie cie; + bfd_byte *last_fde; + struct eh_cie_fde *ent, *this_inf; + unsigned int hdr_length, hdr_id; + struct extended_cie + { + struct cie cie; + unsigned int offset; + unsigned int usage_count; + unsigned int entry; + } *ecies = NULL, *ecie; + unsigned int ecie_count = 0, ecie_alloced = 0; + struct cie *cie; struct elf_link_hash_table *htab; struct eh_frame_hdr_info *hdr_info; struct eh_frame_sec_info *sec_info = NULL; - unsigned int cie_usage_count, offset; + unsigned int offset; unsigned int ptr_size; + unsigned int entry_alloced; if (sec->size == 0) { @@ -390,8 +473,7 @@ _bfd_elf_discard_section_eh_frame return FALSE; } - if ((sec->output_section != NULL - && bfd_is_abs_section (sec->output_section))) + if (bfd_is_abs_section (sec->output_section)) { /* At least one of the sections is being discarded from the link, so we should just ignore them. */ @@ -401,6 +483,9 @@ _bfd_elf_discard_section_eh_frame htab = elf_hash_table (info); hdr_info = &htab->eh_info; + if (hdr_info->cies == NULL && !info->relocatable) + hdr_info->cies = htab_try_create (1, cie_hash, cie_eq, free); + /* Read the frame unwind information from abfd. */ REQUIRE (bfd_malloc_and_get_section (abfd, sec, &ehbuf)); @@ -423,15 +508,11 @@ _bfd_elf_discard_section_eh_frame REQUIRE (ptr_size != 0); buf = ehbuf; - last_cie = NULL; - last_cie_inf = NULL; - memset (&cie, 0, sizeof (cie)); - cie_usage_count = 0; sec_info = bfd_zmalloc (sizeof (struct eh_frame_sec_info) + 99 * sizeof (struct eh_cie_fde)); REQUIRE (sec_info); - sec_info->alloced = 100; + entry_alloced = 100; #define ENSURE_NO_RELOCS(buf) \ REQUIRE (!(cookie->rel < cookie->relend \ @@ -454,118 +535,84 @@ _bfd_elf_discard_section_eh_frame for (;;) { char *aug; - bfd_byte *start, *end, *insns; + bfd_byte *start, *end, *insns, *insns_end; bfd_size_type length; + unsigned int set_loc_count; - if (sec_info->count == sec_info->alloced) + if (sec_info->count == entry_alloced) { - struct eh_cie_fde *old_entry = sec_info->entry; sec_info = bfd_realloc (sec_info, sizeof (struct eh_frame_sec_info) - + ((sec_info->alloced + 99) + + ((entry_alloced + 99) * sizeof (struct eh_cie_fde))); REQUIRE (sec_info); - memset (&sec_info->entry[sec_info->alloced], 0, + memset (&sec_info->entry[entry_alloced], 0, 100 * sizeof (struct eh_cie_fde)); - sec_info->alloced += 100; - - /* Now fix any pointers into the array. */ - if (last_cie_inf >= old_entry - && last_cie_inf < old_entry + sec_info->count) - last_cie_inf = sec_info->entry + (last_cie_inf - old_entry); + entry_alloced += 100; } this_inf = sec_info->entry + sec_info->count; last_fde = buf; - /* If we are at the end of the section, we still need to decide - on whether to output or discard last encountered CIE (if any). */ + if ((bfd_size_type) (buf - ehbuf) == sec->size) - { - hdr.length = 0; - hdr.id = (unsigned int) -1; - end = buf; - } - else - { - /* Read the length of the entry. */ - REQUIRE (skip_bytes (&buf, ehbuf + sec->size, 4)); - hdr.length = bfd_get_32 (abfd, buf - 4); + break; - /* 64-bit .eh_frame is not supported. */ - REQUIRE (hdr.length != 0xffffffff); + /* Read the length of the entry. */ + REQUIRE (skip_bytes (&buf, ehbuf + sec->size, 4)); + hdr_length = bfd_get_32 (abfd, buf - 4); - /* The CIE/FDE must be fully contained in this input section. */ - REQUIRE ((bfd_size_type) (buf - ehbuf) + hdr.length <= sec->size); - end = buf + hdr.length; + /* 64-bit .eh_frame is not supported. */ + REQUIRE (hdr_length != 0xffffffff); - this_inf->offset = last_fde - ehbuf; - this_inf->size = 4 + hdr.length; + /* The CIE/FDE must be fully contained in this input section. */ + REQUIRE ((bfd_size_type) (buf - ehbuf) + hdr_length <= sec->size); + end = buf + hdr_length; - if (hdr.length == 0) - { - /* A zero-length CIE should only be found at the end of - the section. */ - REQUIRE ((bfd_size_type) (buf - ehbuf) == sec->size); - ENSURE_NO_RELOCS (buf); - sec_info->count++; - /* Now just finish last encountered CIE processing and break - the loop. */ - hdr.id = (unsigned int) -1; - } - else - { - REQUIRE (skip_bytes (&buf, end, 4)); - hdr.id = bfd_get_32 (abfd, buf - 4); - REQUIRE (hdr.id != (unsigned int) -1); - } + this_inf->offset = last_fde - ehbuf; + this_inf->size = 4 + hdr_length; + + if (hdr_length == 0) + { + /* A zero-length CIE should only be found at the end of + the section. */ + REQUIRE ((bfd_size_type) (buf - ehbuf) == sec->size); + ENSURE_NO_RELOCS (buf); + sec_info->count++; + break; } - if (hdr.id == 0 || hdr.id == (unsigned int) -1) + REQUIRE (skip_bytes (&buf, end, 4)); + hdr_id = bfd_get_32 (abfd, buf - 4); + + if (hdr_id == 0) { unsigned int initial_insn_length; /* CIE */ - if (last_cie != NULL) + this_inf->cie = 1; + + if (ecie_count == ecie_alloced) { - /* Now check if this CIE is identical to the last CIE, - in which case we can remove it provided we adjust - all FDEs. Also, it can be removed if we have removed - all FDEs using it. */ - if ((!info->relocatable - && hdr_info->last_cie_sec - && (sec->output_section - == hdr_info->last_cie_sec->output_section) - && cie_compare (&cie, &hdr_info->last_cie) == 0) - || cie_usage_count == 0) - last_cie_inf->removed = 1; - else - { - hdr_info->last_cie = cie; - hdr_info->last_cie_sec = sec; - last_cie_inf->make_relative = cie.make_relative; - last_cie_inf->make_lsda_relative = cie.make_lsda_relative; - last_cie_inf->per_encoding_relative - = (cie.per_encoding & 0x70) == DW_EH_PE_pcrel; - } + ecies = bfd_realloc (ecies, + (ecie_alloced + 20) * sizeof (*ecies)); + REQUIRE (ecies); + memset (&ecies[ecie_alloced], 0, 20 * sizeof (*ecies)); + ecie_alloced += 20; } - if (hdr.id == (unsigned int) -1) - break; - - last_cie_inf = this_inf; - this_inf->cie = 1; - - cie_usage_count = 0; - memset (&cie, 0, sizeof (cie)); - cie.hdr = hdr; - REQUIRE (read_byte (&buf, end, &cie.version)); + cie = &ecies[ecie_count].cie; + ecies[ecie_count].offset = this_inf->offset; + ecies[ecie_count++].entry = sec_info->count; + cie->length = hdr_length; + start = buf; + REQUIRE (read_byte (&buf, end, &cie->version)); /* Cannot handle unknown versions. */ - REQUIRE (cie.version == 1 || cie.version == 3); - REQUIRE (strlen ((char *) buf) < sizeof (cie.augmentation)); + REQUIRE (cie->version == 1 || cie->version == 3); + REQUIRE (strlen ((char *) buf) < sizeof (cie->augmentation)); - strcpy (cie.augmentation, (char *) buf); + strcpy (cie->augmentation, (char *) buf); buf = (bfd_byte *) strchr ((char *) buf, '\0') + 1; ENSURE_NO_RELOCS (buf); if (buf[0] == 'e' && buf[1] == 'h') @@ -577,26 +624,26 @@ _bfd_elf_discard_section_eh_frame REQUIRE (skip_bytes (&buf, end, ptr_size)); SKIP_RELOCS (buf); } - REQUIRE (read_uleb128 (&buf, end, &cie.code_align)); - REQUIRE (read_sleb128 (&buf, end, &cie.data_align)); - if (cie.version == 1) + REQUIRE (read_uleb128 (&buf, end, &cie->code_align)); + REQUIRE (read_sleb128 (&buf, end, &cie->data_align)); + if (cie->version == 1) { REQUIRE (buf < end); - cie.ra_column = *buf++; + cie->ra_column = *buf++; } else - REQUIRE (read_uleb128 (&buf, end, &cie.ra_column)); + REQUIRE (read_uleb128 (&buf, end, &cie->ra_column)); ENSURE_NO_RELOCS (buf); - cie.lsda_encoding = DW_EH_PE_omit; - cie.fde_encoding = DW_EH_PE_omit; - cie.per_encoding = DW_EH_PE_omit; - aug = cie.augmentation; + cie->lsda_encoding = DW_EH_PE_omit; + cie->fde_encoding = DW_EH_PE_omit; + cie->per_encoding = DW_EH_PE_omit; + aug = cie->augmentation; if (aug[0] != 'e' || aug[1] != 'h') { if (*aug == 'z') { aug++; - REQUIRE (read_uleb128 (&buf, end, &cie.augmentation_size)); + REQUIRE (read_uleb128 (&buf, end, &cie->augmentation_size)); ENSURE_NO_RELOCS (buf); } @@ -604,14 +651,14 @@ _bfd_elf_discard_section_eh_frame switch (*aug++) { case 'L': - REQUIRE (read_byte (&buf, end, &cie.lsda_encoding)); + REQUIRE (read_byte (&buf, end, &cie->lsda_encoding)); ENSURE_NO_RELOCS (buf); - REQUIRE (get_DW_EH_PE_width (cie.lsda_encoding, ptr_size)); + REQUIRE (get_DW_EH_PE_width (cie->lsda_encoding, ptr_size)); break; case 'R': - REQUIRE (read_byte (&buf, end, &cie.fde_encoding)); + REQUIRE (read_byte (&buf, end, &cie->fde_encoding)); ENSURE_NO_RELOCS (buf); - REQUIRE (get_DW_EH_PE_width (cie.fde_encoding, ptr_size)); + REQUIRE (get_DW_EH_PE_width (cie->fde_encoding, ptr_size)); break; case 'S': break; @@ -619,18 +666,17 @@ _bfd_elf_discard_section_eh_frame { int per_width; - REQUIRE (read_byte (&buf, end, &cie.per_encoding)); - per_width = get_DW_EH_PE_width (cie.per_encoding, + REQUIRE (read_byte (&buf, end, &cie->per_encoding)); + per_width = get_DW_EH_PE_width (cie->per_encoding, ptr_size); REQUIRE (per_width); - if ((cie.per_encoding & 0xf0) == DW_EH_PE_aligned) + if ((cie->per_encoding & 0xf0) == DW_EH_PE_aligned) { length = -(buf - ehbuf) & (per_width - 1); REQUIRE (skip_bytes (&buf, end, length)); } ENSURE_NO_RELOCS (buf); - /* Ensure we have a reloc here, against - a global symbol. */ + /* Ensure we have a reloc here. */ if (GET_RELOC (buf) != NULL) { unsigned long r_symndx; @@ -641,7 +687,9 @@ _bfd_elf_discard_section_eh_frame else #endif r_symndx = ELF32_R_SYM (cookie->rel->r_info); - if (r_symndx >= cookie->locsymcount) + if (r_symndx >= cookie->locsymcount + || ELF_ST_BIND (cookie->locsyms[r_symndx] + .st_info) != STB_LOCAL) { struct elf_link_hash_entry *h; @@ -653,14 +701,39 @@ _bfd_elf_discard_section_eh_frame h = (struct elf_link_hash_entry *) h->root.u.i.link; - cie.personality = h; + cie->personality.h = h; } + else + { + Elf_Internal_Sym *sym; + asection *sym_sec; + bfd_vma val; + + sym = &cookie->locsyms[r_symndx]; + sym_sec = (bfd_section_from_elf_index + (abfd, sym->st_shndx)); + if (sym_sec != NULL) + { + if (sym_sec->kept_section != NULL) + sym_sec = sym_sec->kept_section; + if (sym_sec->output_section != NULL) + { + val = (sym->st_value + + sym_sec->output_offset + + sym_sec->output_section->vma); + cie->personality.val = val; + cie->local_personality = 1; + } + } + } + /* Cope with MIPS-style composite relocations. */ do cookie->rel++; while (GET_RELOC (buf) != NULL); } REQUIRE (skip_bytes (&buf, end, per_width)); + REQUIRE (cie->local_personality || cie->personality.h); } break; default: @@ -676,18 +749,18 @@ _bfd_elf_discard_section_eh_frame ->elf_backend_can_make_relative_eh_frame (abfd, info, sec))) { - if ((cie.fde_encoding & 0xf0) == DW_EH_PE_absptr) - cie.make_relative = 1; + if ((cie->fde_encoding & 0xf0) == DW_EH_PE_absptr) + cie->make_relative = 1; /* If the CIE doesn't already have an 'R' entry, it's fairly easy to add one, provided that there's no aligned data after the augmentation string. */ - else if (cie.fde_encoding == DW_EH_PE_omit - && (cie.per_encoding & 0xf0) != DW_EH_PE_aligned) + else if (cie->fde_encoding == DW_EH_PE_omit + && (cie->per_encoding & 0xf0) != DW_EH_PE_aligned) { - if (*cie.augmentation == 0) + if (*cie->augmentation == 0) this_inf->add_augmentation_size = 1; this_inf->add_fde_encoding = 1; - cie.make_relative = 1; + cie->make_relative = 1; } } @@ -695,30 +768,36 @@ _bfd_elf_discard_section_eh_frame && (get_elf_backend_data (abfd) ->elf_backend_can_make_lsda_relative_eh_frame (abfd, info, sec)) - && (cie.lsda_encoding & 0xf0) == DW_EH_PE_absptr) - cie.make_lsda_relative = 1; + && (cie->lsda_encoding & 0xf0) == DW_EH_PE_absptr) + cie->make_lsda_relative = 1; /* If FDE encoding was not specified, it defaults to DW_EH_absptr. */ - if (cie.fde_encoding == DW_EH_PE_omit) - cie.fde_encoding = DW_EH_PE_absptr; + if (cie->fde_encoding == DW_EH_PE_omit) + cie->fde_encoding = DW_EH_PE_absptr; initial_insn_length = end - buf; - if (initial_insn_length <= 50) + if (initial_insn_length <= sizeof (cie->initial_instructions)) { - cie.initial_insn_length = initial_insn_length; - memcpy (cie.initial_instructions, buf, initial_insn_length); + cie->initial_insn_length = initial_insn_length; + memcpy (cie->initial_instructions, buf, initial_insn_length); } insns = buf; buf += initial_insn_length; ENSURE_NO_RELOCS (buf); - last_cie = last_fde; } else { - /* Ensure this FDE uses the last CIE encountered. */ - REQUIRE (last_cie); - REQUIRE (hdr.id == (unsigned int) (buf - 4 - last_cie)); + /* Find the corresponding CIE. */ + unsigned int cie_offset = this_inf->offset + 4 - hdr_id; + for (ecie = ecies; ecie < ecies + ecie_count; ++ecie) + if (cie_offset == ecie->offset) + break; + + /* Ensure this FDE references one of the CIEs in this input + section. */ + REQUIRE (ecie != ecies + ecie_count); + cie = &ecie->cie; ENSURE_NO_RELOCS (buf); REQUIRE (GET_RELOC (buf)); @@ -730,26 +809,31 @@ _bfd_elf_discard_section_eh_frame else { if (info->shared - && (((cie.fde_encoding & 0xf0) == DW_EH_PE_absptr - && cie.make_relative == 0) - || (cie.fde_encoding & 0xf0) == DW_EH_PE_aligned)) + && (((cie->fde_encoding & 0xf0) == DW_EH_PE_absptr + && cie->make_relative == 0) + || (cie->fde_encoding & 0xf0) == DW_EH_PE_aligned)) { /* If a shared library uses absolute pointers which we cannot turn into PC relative, don't create the binary search table, since it is affected by runtime relocations. */ hdr_info->table = FALSE; + (*info->callbacks->einfo) + (_("%P: fde encoding in %B(%A) prevents .eh_frame_hdr" + " table being created.\n"), abfd, sec); } - cie_usage_count++; + ecie->usage_count++; hdr_info->fde_count++; + this_inf->cie_inf = (void *) (ecie - ecies); } + /* Skip the initial location and address range. */ start = buf; - length = get_DW_EH_PE_width (cie.fde_encoding, ptr_size); + length = get_DW_EH_PE_width (cie->fde_encoding, ptr_size); REQUIRE (skip_bytes (&buf, end, 2 * length)); /* Skip the augmentation size, if present. */ - if (cie.augmentation[0] == 'z') + if (cie->augmentation[0] == 'z') REQUIRE (read_uleb128 (&buf, end, &length)); else length = 0; @@ -757,12 +841,12 @@ _bfd_elf_discard_section_eh_frame /* Of the supported augmentation characters above, only 'L' adds augmentation data to the FDE. This code would need to be adjusted if any future augmentations do the same thing. */ - if (cie.lsda_encoding != DW_EH_PE_omit) + if (cie->lsda_encoding != DW_EH_PE_omit) { this_inf->lsda_offset = buf - start; /* If there's no 'z' augmentation, we don't know where the CFA insns begin. Assume no padding. */ - if (cie.augmentation[0] != 'z') + if (cie->augmentation[0] != 'z') length = end - buf; } @@ -770,57 +854,131 @@ _bfd_elf_discard_section_eh_frame REQUIRE (skip_bytes (&buf, end, length)); insns = buf; - buf = last_fde + 4 + hdr.length; + buf = last_fde + 4 + hdr_length; SKIP_RELOCS (buf); } /* Try to interpret the CFA instructions and find the first padding nop. Shrink this_inf's size so that it doesn't - including the padding. */ - length = get_DW_EH_PE_width (cie.fde_encoding, ptr_size); - insns = skip_non_nops (insns, end, length); - if (insns != 0) - this_inf->size -= end - insns; - - this_inf->fde_encoding = cie.fde_encoding; - this_inf->lsda_encoding = cie.lsda_encoding; + include the padding. */ + length = get_DW_EH_PE_width (cie->fde_encoding, ptr_size); + set_loc_count = 0; + insns_end = skip_non_nops (insns, end, length, &set_loc_count); + /* If we don't understand the CFA instructions, we can't know + what needs to be adjusted there. */ + if (insns_end == NULL + /* For the time being we don't support DW_CFA_set_loc in + CIE instructions. */ + || (set_loc_count && this_inf->cie)) + goto free_no_table; + this_inf->size -= end - insns_end; + if (insns_end != end && this_inf->cie) + { + cie->initial_insn_length -= end - insns_end; + cie->length -= end - insns_end; + } + if (set_loc_count + && ((cie->fde_encoding & 0xf0) == DW_EH_PE_pcrel + || cie->make_relative)) + { + unsigned int cnt; + bfd_byte *p; + + this_inf->set_loc = bfd_malloc ((set_loc_count + 1) + * sizeof (unsigned int)); + REQUIRE (this_inf->set_loc); + this_inf->set_loc[0] = set_loc_count; + p = insns; + cnt = 0; + while (p < end) + { + if (*p == DW_CFA_set_loc) + this_inf->set_loc[++cnt] = p + 1 - start; + REQUIRE (skip_cfa_op (&p, end, length)); + } + } + + this_inf->fde_encoding = cie->fde_encoding; + this_inf->lsda_encoding = cie->lsda_encoding; sec_info->count++; } elf_section_data (sec)->sec_info = sec_info; sec->sec_info_type = ELF_INFO_TYPE_EH_FRAME; + /* Look at all CIEs in this section and determine which can be + removed as unused, which can be merged with previous duplicate + CIEs and which need to be kept. */ + for (ecie = ecies; ecie < ecies + ecie_count; ++ecie) + { + if (ecie->usage_count == 0) + { + sec_info->entry[ecie->entry].removed = 1; + continue; + } + ecie->cie.output_sec = sec->output_section; + ecie->cie.cie_inf = sec_info->entry + ecie->entry; + cie_compute_hash (&ecie->cie); + if (hdr_info->cies != NULL) + { + void **loc = htab_find_slot_with_hash (hdr_info->cies, &ecie->cie, + ecie->cie.hash, INSERT); + if (loc != NULL) + { + if (*loc != HTAB_EMPTY_ENTRY) + { + sec_info->entry[ecie->entry].removed = 1; + ecie->cie.cie_inf = ((struct cie *) *loc)->cie_inf; + continue; + } + + *loc = malloc (sizeof (struct cie)); + if (*loc == NULL) + *loc = HTAB_DELETED_ENTRY; + else + memcpy (*loc, &ecie->cie, sizeof (struct cie)); + } + } + ecie->cie.cie_inf->make_relative = ecie->cie.make_relative; + ecie->cie.cie_inf->make_lsda_relative = ecie->cie.make_lsda_relative; + ecie->cie.cie_inf->per_encoding_relative + = (ecie->cie.per_encoding & 0x70) == DW_EH_PE_pcrel; + } + /* Ok, now we can assign new offsets. */ offset = 0; - last_cie_inf = hdr_info->last_cie_inf; for (ent = sec_info->entry; ent < sec_info->entry + sec_info->count; ++ent) if (!ent->removed) { - if (ent->cie) - last_cie_inf = ent; - else - ent->cie_inf = last_cie_inf; + if (!ent->cie) + { + ecie = ecies + (unsigned long) ent->cie_inf; + ent->cie_inf = ecie->cie.cie_inf; + } ent->new_offset = offset; offset += size_of_output_cie_fde (ent, ptr_size); } - hdr_info->last_cie_inf = last_cie_inf; /* Resize the sec as needed. */ sec->rawsize = sec->size; sec->size = offset; - if (sec->size == 0) - sec->flags |= SEC_EXCLUDE; free (ehbuf); + if (ecies) + free (ecies); return offset != sec->rawsize; free_no_table: + (*info->callbacks->einfo) + (_("%P: error in %B(%A); no .eh_frame_hdr table will be created.\n"), + abfd, sec); if (ehbuf) free (ehbuf); if (sec_info) free (sec_info); + if (ecies) + free (ecies); hdr_info->table = FALSE; - hdr_info->last_cie.hdr.length = 0; return FALSE; #undef REQUIRE @@ -839,6 +997,13 @@ _bfd_elf_discard_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info) htab = elf_hash_table (info); hdr_info = &htab->eh_info; + + if (hdr_info->cies != NULL) + { + htab_delete (hdr_info->cies); + hdr_info->cies = NULL; + } + sec = hdr_info->hdr_sec; if (sec == NULL) return FALSE; @@ -847,8 +1012,6 @@ _bfd_elf_discard_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info) if (hdr_info->table) sec->size += 4 + hdr_info->fde_count * 8; - /* Request program headers to be recalculated. */ - elf_tdata (abfd)->program_header_size = 0; elf_tdata (abfd)->eh_frame_hdr = sec; return TRUE; } @@ -968,6 +1131,23 @@ _bfd_elf_eh_frame_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, return (bfd_vma) -2; } + /* If converting to DW_EH_PE_pcrel, there will be no need for run-time + relocation against DW_CFA_set_loc's arguments. */ + if (sec_info->entry[mid].set_loc + && (sec_info->entry[mid].cie + ? sec_info->entry[mid].make_relative + : sec_info->entry[mid].cie_inf->make_relative) + && (offset >= sec_info->entry[mid].offset + 8 + + sec_info->entry[mid].set_loc[1])) + { + unsigned int cnt; + + for (cnt = 1; cnt <= sec_info->entry[mid].set_loc[0]; cnt++) + if (offset == sec_info->entry[mid].offset + 8 + + sec_info->entry[mid].set_loc[cnt]) + return (bfd_vma) -2; + } + if (hdr_info->offsets_adjusted) offset -= sec->output_offset; /* Any new augmentation bytes go before the first relocation. */ @@ -1192,6 +1372,7 @@ _bfd_elf_write_section_eh_frame (bfd *abfd, /* FDE */ bfd_vma value, address; unsigned int width; + bfd_byte *start; /* Skip length. */ buf += 4; @@ -1228,6 +1409,8 @@ _bfd_elf_write_section_eh_frame (bfd *abfd, write_value (abfd, buf, value, width); } + start = buf; + if (hdr_info) { hdr_info->array[hdr_info->array_count].initial_loc = address; @@ -1260,12 +1443,42 @@ _bfd_elf_write_section_eh_frame (bfd *abfd, memmove (buf + 1, buf, end - buf); *buf = 0; } + + if (ent->set_loc) + { + /* Adjust DW_CFA_set_loc. */ + unsigned int cnt, width; + bfd_vma new_offset; + + width = get_DW_EH_PE_width (ent->fde_encoding, ptr_size); + new_offset = ent->new_offset + 8 + + extra_augmentation_string_bytes (ent) + + extra_augmentation_data_bytes (ent); + + for (cnt = 1; cnt <= ent->set_loc[0]; cnt++) + { + bfd_vma value; + buf = start + ent->set_loc[cnt]; + + value = read_value (abfd, buf, width, + get_DW_EH_PE_signed (ent->fde_encoding)); + if (!value) + continue; + + if ((ent->fde_encoding & 0xf0) == DW_EH_PE_pcrel) + value += ent->offset + 8 - new_offset; + if (ent->cie_inf->make_relative) + value -= sec->output_section->vma + new_offset + + ent->set_loc[cnt]; + write_value (abfd, buf, value, width); + } + } } } /* We don't align the section to its section alignment since the runtime library only expects all CIE/FDE records aligned at - the pointer size. _bfd_elf_discard_section_eh_frame should + the pointer size. _bfd_elf_discard_section_eh_frame should have padded CIE/FDE records to multiple of pointer size with size_of_output_cie_fde. */ if ((sec->size % ptr_size) != 0) diff --git a/contrib/binutils/bfd/elf-strtab.c b/contrib/binutils/bfd/elf-strtab.c index a0ce1d79ea8e..f5d6db1c10c0 100644 --- a/contrib/binutils/bfd/elf-strtab.c +++ b/contrib/binutils/bfd/elf-strtab.c @@ -1,5 +1,6 @@ /* ELF strtab with GC and suffix merging support. - Copyright 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc. + Copyright 2001, 2002, 2003, 2005, 2006, 2007 + Free Software Foundation, Inc. Written by Jakub Jelinek <jakub@redhat.com>. This file is part of BFD, the Binary File Descriptor library. @@ -18,8 +19,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "elf-bfd.h" #include "hashtab.h" diff --git a/contrib/binutils/bfd/elf-vxworks.c b/contrib/binutils/bfd/elf-vxworks.c index 90e620a90559..7b0d59090973 100644 --- a/contrib/binutils/bfd/elf-vxworks.c +++ b/contrib/binutils/bfd/elf-vxworks.c @@ -1,5 +1,5 @@ /* VxWorks support for ELF - Copyright 2005 Free Software Foundation, Inc. + Copyright 2005, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -20,15 +20,34 @@ /* This file provides routines used by all VxWorks targets. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #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; @@ -156,7 +170,8 @@ elf_vxworks_emit_relocs (bfd *output_bfd, && *rel_hash && (*rel_hash)->def_dynamic && !(*rel_hash)->def_regular - && (*rel_hash)->root.type == bfd_link_hash_defined + && ((*rel_hash)->root.type == bfd_link_hash_defined + || (*rel_hash)->root.type == bfd_link_hash_defweak) && (*rel_hash)->root.u.def.section->output_section != NULL) { /* This is a relocation from an executable or shared library @@ -171,8 +186,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/contrib/binutils/bfd/elf.c b/contrib/binutils/bfd/elf.c index c2ee684fb15c..e8196099c5ce 100644 --- a/contrib/binutils/bfd/elf.c +++ b/contrib/binutils/bfd/elf.c @@ -1,7 +1,7 @@ /* ELF executable support for BFD. Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -37,8 +37,8 @@ SECTION /* For sparc64-cross-sparc32. */ #define _SYSCALL32 -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "bfdlink.h" #include "libbfd.h" #define ARCH_SIZE 0 @@ -210,16 +210,32 @@ bfd_elf_hash (const char *namearg) return h & 0xffffffff; } +/* DT_GNU_HASH hash function. Do not change this function; you will + cause invalid hash tables to be generated. */ + +unsigned long +bfd_elf_gnu_hash (const char *namearg) +{ + const unsigned char *name = (const unsigned char *) namearg; + unsigned long h = 5381; + unsigned char ch; + + while ((ch = *name++) != '\0') + h = (h << 5) + h + ch; + return h & 0xffffffff; +} + bfd_boolean bfd_elf_mkobject (bfd *abfd) { - /* This just does initialization. */ - /* coff_mkobject zalloc's space for tdata.coff_obj_data ... */ - elf_tdata (abfd) = bfd_zalloc (abfd, sizeof (struct elf_obj_tdata)); - if (elf_tdata (abfd) == 0) - return FALSE; - /* Since everything is done at close time, do we need any - initialization? */ + if (abfd->tdata.any == NULL) + { + abfd->tdata.any = bfd_zalloc (abfd, sizeof (struct elf_obj_tdata)); + if (abfd->tdata.any == NULL) + return FALSE; + } + + elf_tdata (abfd)->program_header_size = (bfd_size_type) -1; return TRUE; } @@ -240,7 +256,9 @@ bfd_elf_get_str_section (bfd *abfd, unsigned int shindex) bfd_size_type shstrtabsize; i_shdrp = elf_elfsections (abfd); - if (i_shdrp == 0 || i_shdrp[shindex] == 0) + if (i_shdrp == 0 + || shindex >= elf_numsections (abfd) + || i_shdrp[shindex] == 0) return NULL; shstrtab = i_shdrp[shindex]->contents; @@ -279,6 +297,9 @@ bfd_elf_string_from_elf_section (bfd *abfd, if (strindex == 0) return ""; + if (elf_elfsections (abfd) == NULL || shindex >= elf_numsections (abfd)) + return NULL; + hdr = elf_elfsections (abfd)[shindex]; if (hdr->contents == NULL @@ -388,7 +409,15 @@ bfd_elf_get_elf_syms (bfd *ibfd, for (esym = extsym_buf, isym = intsym_buf, shndx = extshndx_buf; isym < isymend; esym += extsym_size, isym++, shndx = shndx != NULL ? shndx + 1 : NULL) - (*bed->s->swap_symbol_in) (ibfd, esym, shndx, isym); + if (!(*bed->s->swap_symbol_in) (ibfd, esym, shndx, isym)) + { + symoffset += (esym - (bfd_byte *) extsym_buf) / extsym_size; + (*_bfd_error_handler) (_("%B symbol number %lu references " + "nonexistent SHT_SYMTAB_SHNDX section"), + ibfd, (unsigned long) symoffset); + intsym_buf = NULL; + goto out; + } out: if (alloc_ext != NULL) @@ -481,10 +510,18 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect) section with just a flag word (ie. sh_size is 4), ignore it. */ shnum = elf_numsections (abfd); num_group = 0; + +#define IS_VALID_GROUP_SECTION_HEADER(shdr) \ + ( (shdr)->sh_type == SHT_GROUP \ + && (shdr)->sh_size >= (2 * GRP_ENTRY_SIZE) \ + && (shdr)->sh_entsize == GRP_ENTRY_SIZE \ + && ((shdr)->sh_size % GRP_ENTRY_SIZE) == 0) + for (i = 0; i < shnum; i++) { Elf_Internal_Shdr *shdr = elf_elfsections (abfd)[i]; - if (shdr->sh_type == SHT_GROUP && shdr->sh_size >= 8) + + if (IS_VALID_GROUP_SECTION_HEADER (shdr)) num_group += 1; } @@ -509,7 +546,8 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect) for (i = 0; i < shnum; i++) { Elf_Internal_Shdr *shdr = elf_elfsections (abfd)[i]; - if (shdr->sh_type == SHT_GROUP && shdr->sh_size >= 8) + + if (IS_VALID_GROUP_SECTION_HEADER (shdr)) { unsigned char *src; Elf_Internal_Group *dest; @@ -523,8 +561,18 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect) amt = shdr->sh_size * sizeof (*dest) / 4; shdr->contents = bfd_alloc2 (abfd, shdr->sh_size, sizeof (*dest) / 4); - if (shdr->contents == NULL - || bfd_seek (abfd, shdr->sh_offset, SEEK_SET) != 0 + /* PR binutils/4110: Handle corrupt group headers. */ + if (shdr->contents == NULL) + { + _bfd_error_handler + (_("%B: Corrupt size field in group section header: 0x%lx"), abfd, shdr->sh_size); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + memset (shdr->contents, 0, amt); + + if (bfd_seek (abfd, shdr->sh_offset, SEEK_SET) != 0 || (bfd_bread (shdr->contents, shdr->sh_size, abfd) != shdr->sh_size)) return FALSE; @@ -804,24 +852,24 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, int len; } debug_sections [] = { - { "debug", 5 }, /* 'd' */ + { STRING_COMMA_LEN ("debug") }, /* 'd' */ { NULL, 0 }, /* 'e' */ { NULL, 0 }, /* 'f' */ - { "gnu.linkonce.wi.", 17 }, /* 'g' */ + { STRING_COMMA_LEN ("gnu.linkonce.wi.") }, /* 'g' */ { NULL, 0 }, /* 'h' */ { NULL, 0 }, /* 'i' */ { NULL, 0 }, /* 'j' */ { NULL, 0 }, /* 'k' */ - { "line", 4 }, /* 'l' */ + { STRING_COMMA_LEN ("line") }, /* 'l' */ { NULL, 0 }, /* 'm' */ { NULL, 0 }, /* 'n' */ { NULL, 0 }, /* 'o' */ { NULL, 0 }, /* 'p' */ { NULL, 0 }, /* 'q' */ { NULL, 0 }, /* 'r' */ - { "stab", 4 } /* 's' */ + { STRING_COMMA_LEN ("stab") } /* 's' */ }; - + if (name [0] == '.') { int i = name [1] - 'd'; @@ -840,7 +888,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, The symbols will be defined as weak, so that multiple definitions are permitted. The GNU linker extension is to actually discard all but one of the sections. */ - if (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0 + if (CONST_STRNEQ (name, ".gnu.linkonce") && elf_next_in_group (newsect) == NULL) flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD; @@ -858,8 +906,8 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, unsigned int i; /* Look through the phdrs to see if we need to adjust the lma. - If all the p_paddr fields are zero, we ignore them, since - some ELF linkers produce such output. */ + If all the p_paddr fields are zero, we ignore them, since + some ELF linkers produce such output. */ phdr = elf_tdata (abfd)->phdr; for (i = 0; i < elf_elfheader (abfd)->e_phnum; i++, phdr++) { @@ -880,9 +928,9 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, refuse to set the LMA if it was 0. This is wrong though, as a perfectly valid initialised segment can have a p_paddr of zero. Some architectures, eg ARM, - place special significance on the address 0 and - executables need to be able to have a segment which - covers this address. */ + place special significance on the address 0 and + executables need to be able to have a segment which + covers this address. */ if (phdr->p_type == PT_LOAD && (bfd_vma) hdr->sh_offset >= phdr->p_offset && (hdr->sh_offset + hdr->sh_size @@ -1069,6 +1117,10 @@ _bfd_elf_copy_private_bfd_data (bfd *ibfd, bfd *obfd) elf_gp (obfd) = elf_gp (ibfd); elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags; elf_flags_init (obfd) = TRUE; + + /* Copy object attributes. */ + _bfd_elf_copy_obj_attributes (ibfd, obfd); + return TRUE; } @@ -1243,6 +1295,7 @@ _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg) case DT_AUXILIARY: name = "AUXILIARY"; stringp = TRUE; break; case DT_USED: name = "USED"; break; case DT_FILTER: name = "FILTER"; stringp = TRUE; break; + case DT_GNU_HASH: name = "GNU_HASH"; break; } fprintf (f, " %-11s ", name); @@ -1476,9 +1529,9 @@ _bfd_elf_link_hash_newfunc (struct bfd_hash_entry *entry, memset (&ret->size, 0, (sizeof (struct elf_link_hash_entry) - offsetof (struct elf_link_hash_entry, size))); /* Assume that we have been called by a non-ELF symbol reader. - This flag is then reset by the code which reads an ELF input - file. This ensures that a symbol created by a non-ELF symbol - reader will have the flag set correctly. */ + This flag is then reset by the code which reads an ELF input + file. This ensures that a symbol created by a non-ELF symbol + reader will have the flag set correctly. */ ret->non_elf = 1; } @@ -1571,27 +1624,13 @@ _bfd_elf_link_hash_table_init bfd_boolean ret; int can_refcount = get_elf_backend_data (abfd)->can_refcount; - table->dynamic_sections_created = FALSE; - table->dynobj = NULL; + memset (table, 0, sizeof * table); table->init_got_refcount.refcount = can_refcount - 1; table->init_plt_refcount.refcount = can_refcount - 1; table->init_got_offset.offset = -(bfd_vma) 1; table->init_plt_offset.offset = -(bfd_vma) 1; /* The first dynamic symbol is a dummy. */ table->dynsymcount = 1; - table->dynstr = NULL; - table->bucketcount = 0; - table->needed = NULL; - table->hgot = NULL; - table->merge_info = NULL; - memset (&table->stab_info, 0, sizeof (table->stab_info)); - memset (&table->eh_info, 0, sizeof (table->eh_info)); - table->dynlocal = NULL; - table->runpath = NULL; - table->tls_sec = NULL; - table->tls_size = 0; - table->loaded = NULL; - table->is_relocatable_executable = FALSE; ret = _bfd_link_hash_table_init (&table->root, abfd, newfunc, entsize); table->root.type = bfd_link_elf_hash_table; @@ -1646,7 +1685,7 @@ bfd_elf_get_dyn_lib_class (bfd *abfd) } void -bfd_elf_set_dyn_lib_class (bfd *abfd, int lib_class) +bfd_elf_set_dyn_lib_class (bfd *abfd, enum dynamic_lib_link_class lib_class) { if (bfd_get_flavour (abfd) == bfd_target_elf_flavour && bfd_get_format (abfd) == bfd_object) @@ -1826,6 +1865,7 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) case SHT_FINI_ARRAY: /* .fini_array section. */ case SHT_PREINIT_ARRAY: /* .preinit_array section. */ case SHT_GNU_LIBLIST: /* .gnu.liblist section. */ + case SHT_GNU_HASH: /* .gnu.hash section. */ return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); case SHT_DYNAMIC: /* Dynamic linking information. */ @@ -1877,11 +1917,11 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) abfd->flags |= HAS_SYMS; /* Sometimes a shared object will map in the symbol table. If - SHF_ALLOC is set, and this is a shared object, then we also - treat this section as a BFD section. We can not base the - decision purely on SHF_ALLOC, because that flag is sometimes - set in a relocatable object file, which would confuse the - linker. */ + SHF_ALLOC is set, and this is a shared object, then we also + treat this section as a BFD section. We can not base the + decision purely on SHF_ALLOC, because that flag is sometimes + set in a relocatable object file, which would confuse the + linker. */ if ((hdr->sh_flags & SHF_ALLOC) != 0 && (abfd->flags & DYNAMIC) != 0 && ! _bfd_elf_make_section_from_shdr (abfd, hdr, name, @@ -2103,13 +2143,11 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) abfd->flags |= HAS_RELOC; return TRUE; } - break; case SHT_GNU_verdef: elf_dynverdef (abfd) = shindex; elf_tdata (abfd)->dynverdef_hdr = *hdr; return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); - break; case SHT_GNU_versym: if (hdr->sh_entsize != sizeof (Elf_External_Versym)) @@ -2117,13 +2155,11 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) elf_dynversym (abfd) = shindex; elf_tdata (abfd)->dynversym_hdr = *hdr; return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); - break; case SHT_GNU_verneed: elf_dynverref (abfd) = shindex; elf_tdata (abfd)->dynverref_hdr = *hdr; return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); - break; case SHT_SHLIB: return TRUE; @@ -2132,7 +2168,7 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) /* We need a BFD section for objcopy and relocatable linking, and it's handy to have the signature available as the section name. */ - if (hdr->sh_entsize != GRP_ENTRY_SIZE) + if (! IS_VALID_GROUP_SECTION_HEADER (hdr)) return FALSE; name = group_signature (abfd, hdr); if (name == NULL) @@ -2142,7 +2178,7 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) if (hdr->contents != NULL) { Elf_Internal_Group *idx = (Elf_Internal_Group *) hdr->contents; - unsigned int n_elt = hdr->sh_size / 4; + unsigned int n_elt = hdr->sh_size / GRP_ENTRY_SIZE; asection *s; if (idx->flags & GRP_COMDAT) @@ -2152,19 +2188,78 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) /* We try to keep the same section order as it comes in. */ idx += n_elt; while (--n_elt != 0) - if ((s = (--idx)->shdr->bfd_section) != NULL - && elf_next_in_group (s) != NULL) - { - elf_next_in_group (hdr->bfd_section) = s; - break; - } + { + --idx; + + if (idx->shdr != NULL + && (s = idx->shdr->bfd_section) != NULL + && elf_next_in_group (s) != NULL) + { + elf_next_in_group (hdr->bfd_section) = s; + break; + } + } } break; default: + /* Possibly an attributes section. */ + if (hdr->sh_type == SHT_GNU_ATTRIBUTES + || hdr->sh_type == bed->obj_attrs_section_type) + { + if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex)) + return FALSE; + _bfd_elf_parse_attributes (abfd, hdr); + return TRUE; + } + /* Check for any processor-specific section types. */ - return bed->elf_backend_section_from_shdr (abfd, hdr, name, - shindex); + if (bed->elf_backend_section_from_shdr (abfd, hdr, name, shindex)) + return TRUE; + + if (hdr->sh_type >= SHT_LOUSER && hdr->sh_type <= SHT_HIUSER) + { + if ((hdr->sh_flags & SHF_ALLOC) != 0) + /* FIXME: How to properly handle allocated section reserved + for applications? */ + (*_bfd_error_handler) + (_("%B: don't know how to handle allocated, application " + "specific section `%s' [0x%8x]"), + abfd, name, hdr->sh_type); + else + /* Allow sections reserved for applications. */ + return _bfd_elf_make_section_from_shdr (abfd, hdr, name, + shindex); + } + else if (hdr->sh_type >= SHT_LOPROC + && hdr->sh_type <= SHT_HIPROC) + /* FIXME: We should handle this section. */ + (*_bfd_error_handler) + (_("%B: don't know how to handle processor specific section " + "`%s' [0x%8x]"), + abfd, name, hdr->sh_type); + else if (hdr->sh_type >= SHT_LOOS && hdr->sh_type <= SHT_HIOS) + { + /* Unrecognised OS-specific sections. */ + if ((hdr->sh_flags & SHF_OS_NONCONFORMING) != 0) + /* SHF_OS_NONCONFORMING indicates that special knowledge is + required to correctly process the section and the file should + be rejected with an error message. */ + (*_bfd_error_handler) + (_("%B: don't know how to handle OS specific section " + "`%s' [0x%8x]"), + abfd, name, hdr->sh_type); + else + /* Otherwise it should be processed. */ + return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); + } + else + /* FIXME: We should handle this section. */ + (*_bfd_error_handler) + (_("%B: don't know how to handle section `%s' [0x%8x]"), + abfd, name, hdr->sh_type); + + return FALSE; } return TRUE; @@ -2224,108 +2319,111 @@ bfd_section_from_elf_index (bfd *abfd, unsigned int index) static const struct bfd_elf_special_section special_sections_b[] = { - { ".bss", 4, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, - { NULL, 0, 0, 0, 0 } + { STRING_COMMA_LEN (".bss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { NULL, 0, 0, 0, 0 } }; static const struct bfd_elf_special_section special_sections_c[] = { - { ".comment", 8, 0, SHT_PROGBITS, 0 }, - { NULL, 0, 0, 0, 0 } + { STRING_COMMA_LEN (".comment"), 0, SHT_PROGBITS, 0 }, + { NULL, 0, 0, 0, 0 } }; static const struct bfd_elf_special_section special_sections_d[] = { - { ".data", 5, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".data1", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".debug", 6, 0, SHT_PROGBITS, 0 }, - { ".debug_line", 11, 0, SHT_PROGBITS, 0 }, - { ".debug_info", 11, 0, SHT_PROGBITS, 0 }, - { ".debug_abbrev", 13, 0, SHT_PROGBITS, 0 }, - { ".debug_aranges", 14, 0, SHT_PROGBITS, 0 }, - { ".dynamic", 8, 0, SHT_DYNAMIC, SHF_ALLOC }, - { ".dynstr", 7, 0, SHT_STRTAB, SHF_ALLOC }, - { ".dynsym", 7, 0, SHT_DYNSYM, SHF_ALLOC }, - { NULL, 0, 0, 0, 0 } + { STRING_COMMA_LEN (".data"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { STRING_COMMA_LEN (".data1"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { STRING_COMMA_LEN (".debug"), 0, SHT_PROGBITS, 0 }, + { STRING_COMMA_LEN (".debug_line"), 0, SHT_PROGBITS, 0 }, + { STRING_COMMA_LEN (".debug_info"), 0, SHT_PROGBITS, 0 }, + { STRING_COMMA_LEN (".debug_abbrev"), 0, SHT_PROGBITS, 0 }, + { STRING_COMMA_LEN (".debug_aranges"), 0, SHT_PROGBITS, 0 }, + { STRING_COMMA_LEN (".dynamic"), 0, SHT_DYNAMIC, SHF_ALLOC }, + { STRING_COMMA_LEN (".dynstr"), 0, SHT_STRTAB, SHF_ALLOC }, + { STRING_COMMA_LEN (".dynsym"), 0, SHT_DYNSYM, SHF_ALLOC }, + { NULL, 0, 0, 0, 0 } }; static const struct bfd_elf_special_section special_sections_f[] = { - { ".fini", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, - { ".fini_array", 11, 0, SHT_FINI_ARRAY, SHF_ALLOC + SHF_WRITE }, - { NULL, 0, 0, 0, 0 } + { STRING_COMMA_LEN (".fini"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, + { STRING_COMMA_LEN (".fini_array"), 0, SHT_FINI_ARRAY, SHF_ALLOC + SHF_WRITE }, + { NULL, 0, 0, 0, 0 } }; static const struct bfd_elf_special_section special_sections_g[] = { - { ".gnu.linkonce.b",15, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, - { ".got", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".gnu.version", 12, 0, SHT_GNU_versym, 0 }, - { ".gnu.version_d", 14, 0, SHT_GNU_verdef, 0 }, - { ".gnu.version_r", 14, 0, SHT_GNU_verneed, 0 }, - { ".gnu.liblist", 12, 0, SHT_GNU_LIBLIST, SHF_ALLOC }, - { ".gnu.conflict", 13, 0, SHT_RELA, SHF_ALLOC }, - { NULL, 0, 0, 0, 0 } + { STRING_COMMA_LEN (".gnu.linkonce.b"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { STRING_COMMA_LEN (".got"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { STRING_COMMA_LEN (".gnu.version"), 0, SHT_GNU_versym, 0 }, + { STRING_COMMA_LEN (".gnu.version_d"), 0, SHT_GNU_verdef, 0 }, + { STRING_COMMA_LEN (".gnu.version_r"), 0, SHT_GNU_verneed, 0 }, + { STRING_COMMA_LEN (".gnu.liblist"), 0, SHT_GNU_LIBLIST, SHF_ALLOC }, + { STRING_COMMA_LEN (".gnu.conflict"), 0, SHT_RELA, SHF_ALLOC }, + { STRING_COMMA_LEN (".gnu.hash"), 0, SHT_GNU_HASH, SHF_ALLOC }, + { NULL, 0, 0, 0, 0 } }; static const struct bfd_elf_special_section special_sections_h[] = { - { ".hash", 5, 0, SHT_HASH, SHF_ALLOC }, - { NULL, 0, 0, 0, 0 } + { STRING_COMMA_LEN (".hash"), 0, SHT_HASH, SHF_ALLOC }, + { NULL, 0, 0, 0, 0 } }; static const struct bfd_elf_special_section special_sections_i[] = { - { ".init", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, - { ".init_array", 11, 0, SHT_INIT_ARRAY, SHF_ALLOC + SHF_WRITE }, - { ".interp", 7, 0, SHT_PROGBITS, 0 }, - { NULL, 0, 0, 0, 0 } + { STRING_COMMA_LEN (".init"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, + { STRING_COMMA_LEN (".init_array"), 0, SHT_INIT_ARRAY, SHF_ALLOC + SHF_WRITE }, + { STRING_COMMA_LEN (".interp"), 0, SHT_PROGBITS, 0 }, + { NULL, 0, 0, 0, 0 } }; static const struct bfd_elf_special_section special_sections_l[] = { - { ".line", 5, 0, SHT_PROGBITS, 0 }, - { NULL, 0, 0, 0, 0 } + { STRING_COMMA_LEN (".line"), 0, SHT_PROGBITS, 0 }, + { NULL, 0, 0, 0, 0 } }; static const struct bfd_elf_special_section special_sections_n[] = { - { ".note.GNU-stack",15, 0, SHT_PROGBITS, 0 }, - { ".note", 5, -1, SHT_NOTE, 0 }, - { NULL, 0, 0, 0, 0 } + { STRING_COMMA_LEN (".note.GNU-stack"), 0, SHT_PROGBITS, 0 }, + { STRING_COMMA_LEN (".note"), -1, SHT_NOTE, 0 }, + { NULL, 0, 0, 0, 0 } }; static const struct bfd_elf_special_section special_sections_p[] = { - { ".preinit_array", 14, 0, SHT_PREINIT_ARRAY, SHF_ALLOC + SHF_WRITE }, - { ".plt", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, - { NULL, 0, 0, 0, 0 } + { STRING_COMMA_LEN (".preinit_array"), 0, SHT_PREINIT_ARRAY, SHF_ALLOC + SHF_WRITE }, + { STRING_COMMA_LEN (".plt"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, + { NULL, 0, 0, 0, 0 } }; static const struct bfd_elf_special_section special_sections_r[] = { - { ".rodata", 7, -2, SHT_PROGBITS, SHF_ALLOC }, - { ".rodata1", 8, 0, SHT_PROGBITS, SHF_ALLOC }, - { ".rela", 5, -1, SHT_RELA, 0 }, - { ".rel", 4, -1, SHT_REL, 0 }, - { NULL, 0, 0, 0, 0 } + { STRING_COMMA_LEN (".rodata"), -2, SHT_PROGBITS, SHF_ALLOC }, + { STRING_COMMA_LEN (".rodata1"), 0, SHT_PROGBITS, SHF_ALLOC }, + { STRING_COMMA_LEN (".rela"), -1, SHT_RELA, 0 }, + { STRING_COMMA_LEN (".rel"), -1, SHT_REL, 0 }, + { NULL, 0, 0, 0, 0 } }; static const struct bfd_elf_special_section special_sections_s[] = { - { ".shstrtab", 9, 0, SHT_STRTAB, 0 }, - { ".strtab", 7, 0, SHT_STRTAB, 0 }, - { ".symtab", 7, 0, SHT_SYMTAB, 0 }, - { ".stabstr", 5, 3, SHT_STRTAB, 0 }, - { NULL, 0, 0, 0, 0 } + { STRING_COMMA_LEN (".shstrtab"), 0, SHT_STRTAB, 0 }, + { STRING_COMMA_LEN (".strtab"), 0, SHT_STRTAB, 0 }, + { STRING_COMMA_LEN (".symtab"), 0, SHT_SYMTAB, 0 }, + /* See struct bfd_elf_special_section declaration for the semantics of + this special case where .prefix_length != strlen (.prefix). */ + { ".stabstr", 5, 3, SHT_STRTAB, 0 }, + { NULL, 0, 0, 0, 0 } }; static const struct bfd_elf_special_section special_sections_t[] = { - { ".text", 5, -2, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, - { ".tbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS }, - { ".tdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS }, - { NULL, 0, 0, 0, 0 } + { STRING_COMMA_LEN (".text"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, + { STRING_COMMA_LEN (".tbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS }, + { STRING_COMMA_LEN (".tdata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS }, + { NULL, 0, 0, 0, 0 } }; static const struct bfd_elf_special_section *special_sections[] = @@ -2456,10 +2554,13 @@ _bfd_elf_new_section_hook (bfd *abfd, asection *sec) bed = get_elf_backend_data (abfd); sec->use_rela_p = bed->default_use_rela_p; - /* When we read a file, we don't need section type and flags unless - it is a linker created section. They will be overridden in - _bfd_elf_make_section_from_shdr anyway. */ - if (abfd->direction != read_direction + /* When we read a file, we don't need to set ELF section type and + flags. They will be overridden in _bfd_elf_make_section_from_shdr + anyway. We will set ELF section type and flags for all linker + created sections. If user specifies BFD section flags, we will + set ELF section type and flags based on BFD section flags in + elf_fake_sections. */ + if ((!sec->flags && abfd->direction != read_direction) || (sec->flags & SEC_LINKER_CREATED) != 0) { ssect = (*bed->get_sec_type_attr) (abfd, sec); @@ -2470,7 +2571,7 @@ _bfd_elf_new_section_hook (bfd *abfd, asection *sec) } } - return TRUE; + return _bfd_generic_new_section_hook (abfd, sec); } /* Create a new bfd section from an ELF program header. @@ -2661,11 +2762,12 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg) const struct elf_backend_data *bed = get_elf_backend_data (abfd); bfd_boolean *failedptr = failedptrarg; Elf_Internal_Shdr *this_hdr; + unsigned int sh_type; if (*failedptr) { /* We already failed; just get out of the bfd_map_over_sections - loop. */ + loop. */ return; } @@ -2704,8 +2806,8 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg) if ((asect->flags & SEC_GROUP) != 0) this_hdr->sh_type = SHT_GROUP; else if ((asect->flags & SEC_ALLOC) != 0 - && (((asect->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0) - || (asect->flags & SEC_NEVER_LOAD) != 0)) + && (((asect->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0) + || (asect->flags & SEC_NEVER_LOAD) != 0)) this_hdr->sh_type = SHT_NOBITS; else this_hdr->sh_type = SHT_PROGBITS; @@ -2754,8 +2856,8 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg) case SHT_GNU_verdef: this_hdr->sh_entsize = 0; /* objcopy or strip will copy over sh_info, but may not set - cverdefs. The linker will set cverdefs, but sh_info will be - zero. */ + cverdefs. The linker will set cverdefs, but sh_info will be + zero. */ if (this_hdr->sh_info == 0) this_hdr->sh_info = elf_tdata (abfd)->cverdefs; else @@ -2766,8 +2868,8 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg) case SHT_GNU_verneed: this_hdr->sh_entsize = 0; /* objcopy or strip will copy over sh_info, but may not set - cverrefs. The linker will set cverrefs, but sh_info will be - zero. */ + cverrefs. The linker will set cverrefs, but sh_info will be + zero. */ if (this_hdr->sh_info == 0) this_hdr->sh_info = elf_tdata (abfd)->cverrefs; else @@ -2776,7 +2878,11 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg) break; case SHT_GROUP: - this_hdr->sh_entsize = 4; + this_hdr->sh_entsize = GRP_ENTRY_SIZE; + break; + + case SHT_GNU_HASH: + this_hdr->sh_entsize = bed->s->arch_size == 64 ? 0 : 4; break; } @@ -2814,10 +2920,18 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg) } /* Check for processor-specific section types. */ + sh_type = this_hdr->sh_type; if (bed->elf_backend_fake_sections && !(*bed->elf_backend_fake_sections) (abfd, this_hdr, asect)) *failedptr = TRUE; + if (sh_type == SHT_NOBITS && asect->size != 0) + { + /* Don't change the header type from NOBITS if we are being + called for objcopy --only-keep-debug. */ + this_hdr->sh_type = sh_type; + } + /* If the section has relocs, set up a section header for the SHT_REL[A] section. If two relocation sections are required for this section, it is up to the processor-specific back-end to @@ -2939,14 +3053,14 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info) d = elf_section_data (sec); if (d->this_hdr.sh_type == SHT_GROUP) - { + { if (sec->flags & SEC_LINKER_CREATED) { /* Remove the linker created SHT_GROUP sections. */ bfd_section_list_remove (abfd, sec); abfd->section_count--; } - else + else { if (section_number == SHN_LORESERVE) section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE; @@ -3100,7 +3214,7 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info) s, s->owner); /* Point to the kept section if it has the same size as the discarded one. */ - kept = _bfd_elf_check_kept_section (s); + kept = _bfd_elf_check_kept_section (s, link_info); if (kept == NULL) { bfd_set_error (bfd_error_bad_value); @@ -3133,7 +3247,7 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info) The Intel C compiler generates SHT_IA_64_UNWIND with SHF_LINK_ORDER. But it doesn't set the sh_link or sh_info fields. Hence we could get the situation - where s is NULL. */ + where s is NULL. */ const struct elf_backend_data *bed = get_elf_backend_data (abfd); if (bed->link_order_error_handler) @@ -3173,7 +3287,7 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info) string section. We look for a section with the same name but without the trailing ``str'', and set its sh_link field to point to this section. */ - if (strncmp (sec->name, ".stab", sizeof ".stab" - 1) == 0 + if (CONST_STRNEQ (sec->name, ".stab") && strcmp (sec->name + strlen (sec->name) - 3, "str") == 0) { size_t len; @@ -3213,9 +3327,8 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info) case SHT_GNU_LIBLIST: /* sh_link is the section header index of the prelink library - list - used for the dynamic entries, or the symbol table, or the - version strings. */ + list used for the dynamic entries, or the symbol table, or + the version strings. */ s = bfd_get_section_by_name (abfd, (sec->flags & SEC_ALLOC) ? ".dynstr" : ".gnu.libstr"); if (s != NULL) @@ -3223,6 +3336,7 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info) break; case SHT_HASH: + case SHT_GNU_HASH: case SHT_GNU_versym: /* sh_link is the section header index of the symbol table this hash table or version table is for. */ @@ -3248,7 +3362,7 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info) /* Map symbol from it's internal number to the external number, moving all local symbols to be at the head of the list. */ -static int +static bfd_boolean sym_is_global (bfd *abfd, asymbol *sym) { /* If the backend has a special mapping, use it. */ @@ -3261,6 +3375,20 @@ sym_is_global (bfd *abfd, asymbol *sym) || bfd_is_com_section (bfd_get_section (sym))); } +/* Don't output section symbols for sections that are not going to be + output. Also, don't output section symbols for reloc and other + special sections. */ + +static bfd_boolean +ignore_section_sym (bfd *abfd, asymbol *sym) +{ + return ((sym->flags & BSF_SECTION_SYM) != 0 + && (sym->value != 0 + || (sym->section->owner != abfd + && (sym->section->output_section->owner != abfd + || sym->section->output_offset != 0)))); +} + static bfd_boolean elf_map_symbols (bfd *abfd) { @@ -3301,51 +3429,29 @@ elf_map_symbols (bfd *abfd) asymbol *sym = syms[idx]; if ((sym->flags & BSF_SECTION_SYM) != 0 - && sym->value == 0) + && !ignore_section_sym (abfd, sym)) { - asection *sec; + asection *sec = sym->section; - sec = sym->section; + if (sec->owner != abfd) + sec = sec->output_section; - if (sec->owner != NULL) - { - if (sec->owner != abfd) - { - if (sec->output_offset != 0) - continue; - - sec = sec->output_section; - - /* Empty sections in the input files may have had a - section symbol created for them. (See the comment - near the end of _bfd_generic_link_output_symbols in - linker.c). If the linker script discards such - sections then we will reach this point. Since we know - that we cannot avoid this case, we detect it and skip - the abort and the assignment to the sect_syms array. - To reproduce this particular case try running the - linker testsuite test ld-scripts/weak.exp for an ELF - port that uses the generic linker. */ - if (sec->owner == NULL) - continue; - - BFD_ASSERT (sec->owner == abfd); - } - sect_syms[sec->index] = syms[idx]; - } + sect_syms[sec->index] = syms[idx]; } } /* Classify all of the symbols. */ for (idx = 0; idx < symcount; idx++) { + if (ignore_section_sym (abfd, syms[idx])) + continue; if (!sym_is_global (abfd, syms[idx])) num_locals++; else num_globals++; } - /* We will be adding a section symbol for each BFD section. Most normal + /* We will be adding a section symbol for each normal BFD section. Most sections will already have a section symbol in outsymbols, but eg. SHT_GROUP sections will not, and we need the section symbol mapped at least in that case. */ @@ -3371,6 +3477,8 @@ elf_map_symbols (bfd *abfd) asymbol *sym = syms[idx]; unsigned int i; + if (ignore_section_sym (abfd, sym)) + continue; if (!sym_is_global (abfd, sym)) i = num_locals2++; else @@ -3522,7 +3630,7 @@ _bfd_elf_compute_section_file_positions (bfd *abfd, elf_tdata (abfd)->next_file_pos = off; /* Now that we know where the .strtab section goes, write it - out. */ + out. */ if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0 || ! _bfd_stringtab_emit (abfd, strtab)) return FALSE; @@ -3534,6 +3642,90 @@ _bfd_elf_compute_section_file_positions (bfd *abfd, return TRUE; } +/* Make an initial estimate of the size of the program header. If we + get the number wrong here, we'll redo section placement. */ + +static bfd_size_type +get_program_header_size (bfd *abfd, struct bfd_link_info *info) +{ + size_t segs; + asection *s; + const struct elf_backend_data *bed; + + /* Assume we will need exactly two PT_LOAD segments: one for text + and one for data. */ + segs = 2; + + s = bfd_get_section_by_name (abfd, ".interp"); + if (s != NULL && (s->flags & SEC_LOAD) != 0) + { + /* If we have a loadable interpreter section, we need a + PT_INTERP segment. In this case, assume we also need a + PT_PHDR segment, although that may not be true for all + targets. */ + segs += 2; + } + + if (bfd_get_section_by_name (abfd, ".dynamic") != NULL) + { + /* We need a PT_DYNAMIC segment. */ + ++segs; + + if (elf_tdata (abfd)->relro) + { + /* We need a PT_GNU_RELRO segment only when there is a + PT_DYNAMIC segment. */ + ++segs; + } + } + + if (elf_tdata (abfd)->eh_frame_hdr) + { + /* We need a PT_GNU_EH_FRAME segment. */ + ++segs; + } + + if (elf_tdata (abfd)->stack_flags) + { + /* We need a PT_GNU_STACK segment. */ + ++segs; + } + + for (s = abfd->sections; s != NULL; s = s->next) + { + if ((s->flags & SEC_LOAD) != 0 + && CONST_STRNEQ (s->name, ".note")) + { + /* We need a PT_NOTE segment. */ + ++segs; + } + } + + for (s = abfd->sections; s != NULL; s = s->next) + { + if (s->flags & SEC_THREAD_LOCAL) + { + /* We need a PT_TLS segment. */ + ++segs; + break; + } + } + + /* Let the backend count up any program headers it might need. */ + bed = get_elf_backend_data (abfd); + if (bed->elf_backend_additional_program_headers) + { + int a; + + a = (*bed->elf_backend_additional_program_headers) (abfd, info); + if (a == -1) + abort (); + segs += a; + } + + return segs * bed->s->sizeof_phdr; +} + /* Create a mapping from a set of sections to a program segment. */ static struct elf_segment_map * @@ -3584,363 +3776,421 @@ _bfd_elf_make_dynamic_segment (bfd *abfd, asection *dynsec) m->p_type = PT_DYNAMIC; m->count = 1; m->sections[0] = dynsec; - + return m; } -/* Set up a mapping from BFD sections to program segments. */ +/* Possibly add or remove segments from the segment map. */ static bfd_boolean -map_sections_to_segments (bfd *abfd) +elf_modify_segment_map (bfd *abfd, struct bfd_link_info *info) { - asection **sections = NULL; - asection *s; - unsigned int i; - unsigned int count; - struct elf_segment_map *mfirst; - struct elf_segment_map **pm; - struct elf_segment_map *m; - asection *last_hdr; - bfd_vma last_size; - unsigned int phdr_index; - bfd_vma maxpagesize; - asection **hdrpp; - bfd_boolean phdr_in_segment = TRUE; - bfd_boolean writable; - int tls_count = 0; - asection *first_tls = NULL; - asection *dynsec, *eh_frame_hdr; - bfd_size_type amt; - - if (elf_tdata (abfd)->segment_map != NULL) - return TRUE; + struct elf_segment_map **m; + const struct elf_backend_data *bed; - if (bfd_count_sections (abfd) == 0) - return TRUE; + /* The placement algorithm assumes that non allocated sections are + not in PT_LOAD segments. We ensure this here by removing such + sections from the segment map. We also remove excluded + sections. Finally, any PT_LOAD segment without sections is + removed. */ + m = &elf_tdata (abfd)->segment_map; + while (*m) + { + unsigned int i, new_count; - /* Select the allocated sections, and sort them. */ + for (new_count = 0, i = 0; i < (*m)->count; i++) + { + if (((*m)->sections[i]->flags & SEC_EXCLUDE) == 0 + && (((*m)->sections[i]->flags & SEC_ALLOC) != 0 + || (*m)->p_type != PT_LOAD)) + { + (*m)->sections[new_count] = (*m)->sections[i]; + new_count++; + } + } + (*m)->count = new_count; - sections = bfd_malloc2 (bfd_count_sections (abfd), sizeof (asection *)); - if (sections == NULL) - goto error_return; + if ((*m)->p_type == PT_LOAD && (*m)->count == 0) + *m = (*m)->next; + else + m = &(*m)->next; + } - i = 0; - for (s = abfd->sections; s != NULL; s = s->next) + bed = get_elf_backend_data (abfd); + if (bed->elf_backend_modify_segment_map != NULL) { - if ((s->flags & SEC_ALLOC) != 0) - { - sections[i] = s; - ++i; - } + if (!(*bed->elf_backend_modify_segment_map) (abfd, info)) + return FALSE; } - BFD_ASSERT (i <= bfd_count_sections (abfd)); - count = i; - qsort (sections, (size_t) count, sizeof (asection *), elf_sort_sections); + return TRUE; +} - /* Build the mapping. */ +/* Set up a mapping from BFD sections to program segments. */ - mfirst = NULL; - pm = &mfirst; +bfd_boolean +_bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info) +{ + unsigned int count; + struct elf_segment_map *m; + asection **sections = NULL; + const struct elf_backend_data *bed = get_elf_backend_data (abfd); - /* If we have a .interp section, then create a PT_PHDR segment for - the program headers and a PT_INTERP segment for the .interp - section. */ - s = bfd_get_section_by_name (abfd, ".interp"); - if (s != NULL && (s->flags & SEC_LOAD) != 0) + if (elf_tdata (abfd)->segment_map == NULL + && bfd_count_sections (abfd) != 0) { - amt = sizeof (struct elf_segment_map); - m = bfd_zalloc (abfd, amt); - if (m == NULL) - goto error_return; - m->next = NULL; - m->p_type = PT_PHDR; - /* FIXME: UnixWare and Solaris set PF_X, Irix 5 does not. */ - m->p_flags = PF_R | PF_X; - m->p_flags_valid = 1; - m->includes_phdrs = 1; + asection *s; + unsigned int i; + struct elf_segment_map *mfirst; + struct elf_segment_map **pm; + asection *last_hdr; + bfd_vma last_size; + unsigned int phdr_index; + bfd_vma maxpagesize; + asection **hdrpp; + bfd_boolean phdr_in_segment = TRUE; + bfd_boolean writable; + int tls_count = 0; + asection *first_tls = NULL; + asection *dynsec, *eh_frame_hdr; + bfd_size_type amt; - *pm = m; - pm = &m->next; + /* Select the allocated sections, and sort them. */ - amt = sizeof (struct elf_segment_map); - m = bfd_zalloc (abfd, amt); - if (m == NULL) + sections = bfd_malloc2 (bfd_count_sections (abfd), sizeof (asection *)); + if (sections == NULL) goto error_return; - m->next = NULL; - m->p_type = PT_INTERP; - m->count = 1; - m->sections[0] = s; - - *pm = m; - pm = &m->next; - } - - /* Look through the sections. We put sections in the same program - segment when the start of the second section can be placed within - a few bytes of the end of the first section. */ - last_hdr = NULL; - last_size = 0; - phdr_index = 0; - maxpagesize = get_elf_backend_data (abfd)->maxpagesize; - writable = FALSE; - dynsec = bfd_get_section_by_name (abfd, ".dynamic"); - if (dynsec != NULL - && (dynsec->flags & SEC_LOAD) == 0) - dynsec = NULL; - - /* Deal with -Ttext or something similar such that the first section - is not adjacent to the program headers. This is an - approximation, since at this point we don't know exactly how many - program headers we will need. */ - if (count > 0) - { - bfd_size_type phdr_size; - - phdr_size = elf_tdata (abfd)->program_header_size; - if (phdr_size == 0) - phdr_size = get_elf_backend_data (abfd)->s->sizeof_phdr; - if ((abfd->flags & D_PAGED) == 0 - || sections[0]->lma < phdr_size - || sections[0]->lma % maxpagesize < phdr_size % maxpagesize) - phdr_in_segment = FALSE; - } - - for (i = 0, hdrpp = sections; i < count; i++, hdrpp++) - { - asection *hdr; - bfd_boolean new_segment; - - hdr = *hdrpp; - - /* See if this section and the last one will fit in the same - segment. */ - if (last_hdr == NULL) - { - /* If we don't have a segment yet, then we don't need a new - one (we build the last one after this loop). */ - new_segment = FALSE; - } - else if (last_hdr->lma - last_hdr->vma != hdr->lma - hdr->vma) - { - /* If this section has a different relation between the - virtual address and the load address, then we need a new - segment. */ - new_segment = TRUE; - } - else if (BFD_ALIGN (last_hdr->lma + last_size, maxpagesize) - < BFD_ALIGN (hdr->lma, maxpagesize)) - { - /* If putting this section in this segment would force us to - skip a page in the segment, then we need a new segment. */ - new_segment = TRUE; - } - else if ((last_hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) == 0 - && (hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != 0) + i = 0; + for (s = abfd->sections; s != NULL; s = s->next) { - /* We don't want to put a loadable section after a - nonloadable section in the same segment. - Consider .tbss sections as loadable for this purpose. */ - new_segment = TRUE; - } - else if ((abfd->flags & D_PAGED) == 0) - { - /* If the file is not demand paged, which means that we - don't require the sections to be correctly aligned in the - file, then there is no other reason for a new segment. */ - new_segment = FALSE; + if ((s->flags & SEC_ALLOC) != 0) + { + sections[i] = s; + ++i; + } } - else if (! writable - && (hdr->flags & SEC_READONLY) == 0 - && (((last_hdr->lma + last_size - 1) - & ~(maxpagesize - 1)) - != (hdr->lma & ~(maxpagesize - 1)))) + BFD_ASSERT (i <= bfd_count_sections (abfd)); + count = i; + + qsort (sections, (size_t) count, sizeof (asection *), elf_sort_sections); + + /* Build the mapping. */ + + mfirst = NULL; + pm = &mfirst; + + /* If we have a .interp section, then create a PT_PHDR segment for + the program headers and a PT_INTERP segment for the .interp + section. */ + s = bfd_get_section_by_name (abfd, ".interp"); + if (s != NULL && (s->flags & SEC_LOAD) != 0) { - /* We don't want to put a writable section in a read only - segment, unless they are on the same page in memory - anyhow. We already know that the last section does not - bring us past the current section on the page, so the - only case in which the new section is not on the same - page as the previous section is when the previous section - ends precisely on a page boundary. */ - new_segment = TRUE; + amt = sizeof (struct elf_segment_map); + m = bfd_zalloc (abfd, amt); + if (m == NULL) + goto error_return; + m->next = NULL; + m->p_type = PT_PHDR; + /* FIXME: UnixWare and Solaris set PF_X, Irix 5 does not. */ + m->p_flags = PF_R | PF_X; + m->p_flags_valid = 1; + m->includes_phdrs = 1; + + *pm = m; + pm = &m->next; + + amt = sizeof (struct elf_segment_map); + m = bfd_zalloc (abfd, amt); + if (m == NULL) + goto error_return; + m->next = NULL; + m->p_type = PT_INTERP; + m->count = 1; + m->sections[0] = s; + + *pm = m; + pm = &m->next; } - else + + /* Look through the sections. We put sections in the same program + segment when the start of the second section can be placed within + a few bytes of the end of the first section. */ + last_hdr = NULL; + last_size = 0; + phdr_index = 0; + maxpagesize = bed->maxpagesize; + writable = FALSE; + dynsec = bfd_get_section_by_name (abfd, ".dynamic"); + if (dynsec != NULL + && (dynsec->flags & SEC_LOAD) == 0) + dynsec = NULL; + + /* Deal with -Ttext or something similar such that the first section + is not adjacent to the program headers. This is an + approximation, since at this point we don't know exactly how many + program headers we will need. */ + if (count > 0) { - /* Otherwise, we can use the same segment. */ - new_segment = FALSE; + bfd_size_type phdr_size = elf_tdata (abfd)->program_header_size; + + if (phdr_size == (bfd_size_type) -1) + phdr_size = get_program_header_size (abfd, info); + if ((abfd->flags & D_PAGED) == 0 + || sections[0]->lma < phdr_size + || sections[0]->lma % maxpagesize < phdr_size % maxpagesize) + phdr_in_segment = FALSE; } - if (! new_segment) + for (i = 0, hdrpp = sections; i < count; i++, hdrpp++) { + asection *hdr; + bfd_boolean new_segment; + + hdr = *hdrpp; + + /* See if this section and the last one will fit in the same + segment. */ + + if (last_hdr == NULL) + { + /* If we don't have a segment yet, then we don't need a new + one (we build the last one after this loop). */ + new_segment = FALSE; + } + else if (last_hdr->lma - last_hdr->vma != hdr->lma - hdr->vma) + { + /* If this section has a different relation between the + virtual address and the load address, then we need a new + segment. */ + new_segment = TRUE; + } + else if (BFD_ALIGN (last_hdr->lma + last_size, maxpagesize) + < BFD_ALIGN (hdr->lma, maxpagesize)) + { + /* If putting this section in this segment would force us to + skip a page in the segment, then we need a new segment. */ + new_segment = TRUE; + } + else if ((last_hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) == 0 + && (hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != 0) + { + /* We don't want to put a loadable section after a + nonloadable section in the same segment. + Consider .tbss sections as loadable for this purpose. */ + new_segment = TRUE; + } + else if ((abfd->flags & D_PAGED) == 0) + { + /* If the file is not demand paged, which means that we + don't require the sections to be correctly aligned in the + file, then there is no other reason for a new segment. */ + new_segment = FALSE; + } + else if (! writable + && (hdr->flags & SEC_READONLY) == 0 + && (((last_hdr->lma + last_size - 1) + & ~(maxpagesize - 1)) + != (hdr->lma & ~(maxpagesize - 1)))) + { + /* We don't want to put a writable section in a read only + segment, unless they are on the same page in memory + anyhow. We already know that the last section does not + bring us past the current section on the page, so the + only case in which the new section is not on the same + page as the previous section is when the previous section + ends precisely on a page boundary. */ + new_segment = TRUE; + } + else + { + /* Otherwise, we can use the same segment. */ + new_segment = FALSE; + } + + /* Allow interested parties a chance to override our decision. */ + if (last_hdr && info->callbacks->override_segment_assignment) + new_segment = info->callbacks->override_segment_assignment (info, abfd, hdr, last_hdr, new_segment); + + if (! new_segment) + { + if ((hdr->flags & SEC_READONLY) == 0) + writable = TRUE; + last_hdr = hdr; + /* .tbss sections effectively have zero size. */ + if ((hdr->flags & (SEC_THREAD_LOCAL | SEC_LOAD)) + != SEC_THREAD_LOCAL) + last_size = hdr->size; + else + last_size = 0; + continue; + } + + /* We need a new program segment. We must create a new program + header holding all the sections from phdr_index until hdr. */ + + m = make_mapping (abfd, sections, phdr_index, i, phdr_in_segment); + if (m == NULL) + goto error_return; + + *pm = m; + pm = &m->next; + if ((hdr->flags & SEC_READONLY) == 0) writable = TRUE; + else + writable = FALSE; + last_hdr = hdr; /* .tbss sections effectively have zero size. */ if ((hdr->flags & (SEC_THREAD_LOCAL | SEC_LOAD)) != SEC_THREAD_LOCAL) last_size = hdr->size; else last_size = 0; - continue; + phdr_index = i; + phdr_in_segment = FALSE; } - /* We need a new program segment. We must create a new program - header holding all the sections from phdr_index until hdr. */ + /* Create a final PT_LOAD program segment. */ + if (last_hdr != NULL) + { + m = make_mapping (abfd, sections, phdr_index, i, phdr_in_segment); + if (m == NULL) + goto error_return; - m = make_mapping (abfd, sections, phdr_index, i, phdr_in_segment); - if (m == NULL) - goto error_return; + *pm = m; + pm = &m->next; + } - *pm = m; - pm = &m->next; + /* If there is a .dynamic section, throw in a PT_DYNAMIC segment. */ + if (dynsec != NULL) + { + m = _bfd_elf_make_dynamic_segment (abfd, dynsec); + if (m == NULL) + goto error_return; + *pm = m; + pm = &m->next; + } - if ((hdr->flags & SEC_READONLY) == 0) - writable = TRUE; - else - writable = FALSE; + /* For each loadable .note section, add a PT_NOTE segment. We don't + use bfd_get_section_by_name, because if we link together + nonloadable .note sections and loadable .note sections, we will + generate two .note sections in the output file. FIXME: Using + names for section types is bogus anyhow. */ + for (s = abfd->sections; s != NULL; s = s->next) + { + if ((s->flags & SEC_LOAD) != 0 + && CONST_STRNEQ (s->name, ".note")) + { + amt = sizeof (struct elf_segment_map); + m = bfd_zalloc (abfd, amt); + if (m == NULL) + goto error_return; + m->next = NULL; + m->p_type = PT_NOTE; + m->count = 1; + m->sections[0] = s; - last_hdr = hdr; - /* .tbss sections effectively have zero size. */ - if ((hdr->flags & (SEC_THREAD_LOCAL | SEC_LOAD)) != SEC_THREAD_LOCAL) - last_size = hdr->size; - else - last_size = 0; - phdr_index = i; - phdr_in_segment = FALSE; - } + *pm = m; + pm = &m->next; + } + if (s->flags & SEC_THREAD_LOCAL) + { + if (! tls_count) + first_tls = s; + tls_count++; + } + } - /* Create a final PT_LOAD program segment. */ - if (last_hdr != NULL) - { - m = make_mapping (abfd, sections, phdr_index, i, phdr_in_segment); - if (m == NULL) - goto error_return; + /* If there are any SHF_TLS output sections, add PT_TLS segment. */ + if (tls_count > 0) + { + int i; - *pm = m; - pm = &m->next; - } + amt = sizeof (struct elf_segment_map); + amt += (tls_count - 1) * sizeof (asection *); + m = bfd_zalloc (abfd, amt); + if (m == NULL) + goto error_return; + m->next = NULL; + m->p_type = PT_TLS; + m->count = tls_count; + /* Mandated PF_R. */ + m->p_flags = PF_R; + m->p_flags_valid = 1; + for (i = 0; i < tls_count; ++i) + { + BFD_ASSERT (first_tls->flags & SEC_THREAD_LOCAL); + m->sections[i] = first_tls; + first_tls = first_tls->next; + } - /* If there is a .dynamic section, throw in a PT_DYNAMIC segment. */ - if (dynsec != NULL) - { - m = _bfd_elf_make_dynamic_segment (abfd, dynsec); - if (m == NULL) - goto error_return; - *pm = m; - pm = &m->next; - } + *pm = m; + pm = &m->next; + } - /* For each loadable .note section, add a PT_NOTE segment. We don't - use bfd_get_section_by_name, because if we link together - nonloadable .note sections and loadable .note sections, we will - generate two .note sections in the output file. FIXME: Using - names for section types is bogus anyhow. */ - for (s = abfd->sections; s != NULL; s = s->next) - { - if ((s->flags & SEC_LOAD) != 0 - && strncmp (s->name, ".note", 5) == 0) + /* If there is a .eh_frame_hdr section, throw in a PT_GNU_EH_FRAME + segment. */ + eh_frame_hdr = elf_tdata (abfd)->eh_frame_hdr; + if (eh_frame_hdr != NULL + && (eh_frame_hdr->output_section->flags & SEC_LOAD) != 0) { amt = sizeof (struct elf_segment_map); m = bfd_zalloc (abfd, amt); if (m == NULL) goto error_return; m->next = NULL; - m->p_type = PT_NOTE; + m->p_type = PT_GNU_EH_FRAME; m->count = 1; - m->sections[0] = s; + m->sections[0] = eh_frame_hdr->output_section; *pm = m; pm = &m->next; } - if (s->flags & SEC_THREAD_LOCAL) - { - if (! tls_count) - first_tls = s; - tls_count++; - } - } - /* If there are any SHF_TLS output sections, add PT_TLS segment. */ - if (tls_count > 0) - { - int i; - - amt = sizeof (struct elf_segment_map); - amt += (tls_count - 1) * sizeof (asection *); - m = bfd_zalloc (abfd, amt); - if (m == NULL) - goto error_return; - m->next = NULL; - m->p_type = PT_TLS; - m->count = tls_count; - /* Mandated PF_R. */ - m->p_flags = PF_R; - m->p_flags_valid = 1; - for (i = 0; i < tls_count; ++i) + if (elf_tdata (abfd)->stack_flags) { - BFD_ASSERT (first_tls->flags & SEC_THREAD_LOCAL); - m->sections[i] = first_tls; - first_tls = first_tls->next; - } - - *pm = m; - pm = &m->next; - } + amt = sizeof (struct elf_segment_map); + m = bfd_zalloc (abfd, amt); + if (m == NULL) + goto error_return; + m->next = NULL; + m->p_type = PT_GNU_STACK; + m->p_flags = elf_tdata (abfd)->stack_flags; + m->p_flags_valid = 1; - /* If there is a .eh_frame_hdr section, throw in a PT_GNU_EH_FRAME - segment. */ - eh_frame_hdr = elf_tdata (abfd)->eh_frame_hdr; - if (eh_frame_hdr != NULL - && (eh_frame_hdr->output_section->flags & SEC_LOAD) != 0) - { - amt = sizeof (struct elf_segment_map); - m = bfd_zalloc (abfd, amt); - if (m == NULL) - goto error_return; - m->next = NULL; - m->p_type = PT_GNU_EH_FRAME; - m->count = 1; - m->sections[0] = eh_frame_hdr->output_section; + *pm = m; + pm = &m->next; + } - *pm = m; - pm = &m->next; - } + if (dynsec != NULL && elf_tdata (abfd)->relro) + { + /* We make a PT_GNU_RELRO segment only when there is a + PT_DYNAMIC segment. */ + amt = sizeof (struct elf_segment_map); + m = bfd_zalloc (abfd, amt); + if (m == NULL) + goto error_return; + m->next = NULL; + m->p_type = PT_GNU_RELRO; + m->p_flags = PF_R; + m->p_flags_valid = 1; - if (elf_tdata (abfd)->stack_flags) - { - amt = sizeof (struct elf_segment_map); - m = bfd_zalloc (abfd, amt); - if (m == NULL) - goto error_return; - m->next = NULL; - m->p_type = PT_GNU_STACK; - m->p_flags = elf_tdata (abfd)->stack_flags; - m->p_flags_valid = 1; + *pm = m; + pm = &m->next; + } - *pm = m; - pm = &m->next; + free (sections); + elf_tdata (abfd)->segment_map = mfirst; } - if (elf_tdata (abfd)->relro) - { - amt = sizeof (struct elf_segment_map); - m = bfd_zalloc (abfd, amt); - if (m == NULL) - goto error_return; - m->next = NULL; - m->p_type = PT_GNU_RELRO; - m->p_flags = PF_R; - m->p_flags_valid = 1; - - *pm = m; - pm = &m->next; - } + if (!elf_modify_segment_map (abfd, info)) + return FALSE; - free (sections); - sections = NULL; + for (count = 0, m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next) + ++count; + elf_tdata (abfd)->program_header_size = count * bed->s->sizeof_phdr; - elf_tdata (abfd)->segment_map = mfirst; return TRUE; error_return: @@ -4027,7 +4277,7 @@ elf_sort_sections (const void *arg1, const void *arg2) adjustment = vma_offset + bed->maxpagesize - off_offset; else adjustment = vma_offset - off_offset; - + which can can be collapsed into the expression below. */ static file_ptr @@ -4036,154 +4286,69 @@ vma_page_aligned_bias (bfd_vma vma, ufile_ptr off, bfd_vma maxpagesize) return ((vma - off) % maxpagesize); } -static void -print_segment_map (bfd *abfd) -{ - struct elf_segment_map *m; - unsigned int i, j; - - fprintf (stderr, _(" Section to Segment mapping:\n")); - fprintf (stderr, _(" Segment Sections...\n")); - - for (i= 0, m = elf_tdata (abfd)->segment_map; - m != NULL; - i++, m = m->next) - { - const char *pt = get_segment_type (m->p_type); - char buf[32]; - - if (pt == NULL) - { - if (m->p_type >= PT_LOPROC && m->p_type <= PT_HIPROC) - sprintf (buf, "LOPROC+%7.7x", - (unsigned int) (m->p_type - PT_LOPROC)); - else if (m->p_type >= PT_LOOS && m->p_type <= PT_HIOS) - sprintf (buf, "LOOS+%7.7x", - (unsigned int) (m->p_type - PT_LOOS)); - else - snprintf (buf, sizeof (buf), "%8.8x", - (unsigned int) m->p_type); - pt = buf; - } - fprintf (stderr, " %2.2d: %14.14s: ", i, pt); - for (j = 0; j < m->count; j++) - fprintf (stderr, "%s ", m->sections [j]->name); - putc ('\n',stderr); - } -} - /* Assign file positions to the sections based on the mapping from sections to segments. This function also sets up some fields in - the file header, and writes out the program headers. */ + the file header. */ static bfd_boolean -assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) +assign_file_positions_for_load_sections (bfd *abfd, + struct bfd_link_info *link_info) { const struct elf_backend_data *bed = get_elf_backend_data (abfd); - unsigned int count; struct elf_segment_map *m; - unsigned int alloc; Elf_Internal_Phdr *phdrs; - file_ptr off, voff; - bfd_vma filehdr_vaddr, filehdr_paddr; - bfd_vma phdrs_vaddr, phdrs_paddr; Elf_Internal_Phdr *p; + file_ptr off; + bfd_size_type maxpagesize; + unsigned int alloc; + unsigned int i, j; - if (elf_tdata (abfd)->segment_map == NULL) - { - if (! map_sections_to_segments (abfd)) - return FALSE; - } - else - { - /* The placement algorithm assumes that non allocated sections are - not in PT_LOAD segments. We ensure this here by removing such - sections from the segment map. We also remove excluded - sections. */ - for (m = elf_tdata (abfd)->segment_map; - m != NULL; - m = m->next) - { - unsigned int new_count; - unsigned int i; - - new_count = 0; - for (i = 0; i < m->count; i ++) - { - if ((m->sections[i]->flags & SEC_EXCLUDE) == 0 - && ((m->sections[i]->flags & SEC_ALLOC) != 0 - || m->p_type != PT_LOAD)) - { - if (i != new_count) - m->sections[new_count] = m->sections[i]; - - new_count ++; - } - } - - if (new_count != m->count) - m->count = new_count; - } - } - - if (bed->elf_backend_modify_segment_map) - { - if (! (*bed->elf_backend_modify_segment_map) (abfd, link_info)) - return FALSE; - } + if (link_info == NULL + && !elf_modify_segment_map (abfd, link_info)) + return FALSE; - count = 0; + alloc = 0; for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next) - ++count; + ++alloc; elf_elfheader (abfd)->e_phoff = bed->s->sizeof_ehdr; elf_elfheader (abfd)->e_phentsize = bed->s->sizeof_phdr; - elf_elfheader (abfd)->e_phnum = count; + elf_elfheader (abfd)->e_phnum = alloc; + + if (elf_tdata (abfd)->program_header_size == (bfd_size_type) -1) + elf_tdata (abfd)->program_header_size = alloc * bed->s->sizeof_phdr; + else + BFD_ASSERT (elf_tdata (abfd)->program_header_size + >= alloc * bed->s->sizeof_phdr); - if (count == 0) + if (alloc == 0) { elf_tdata (abfd)->next_file_pos = bed->s->sizeof_ehdr; return TRUE; } - /* If we already counted the number of program segments, make sure - that we allocated enough space. This happens when SIZEOF_HEADERS - is used in a linker script. */ - alloc = elf_tdata (abfd)->program_header_size / bed->s->sizeof_phdr; - if (alloc != 0 && count > alloc) - { - ((*_bfd_error_handler) - (_("%B: Not enough room for program headers (allocated %u, need %u)"), - abfd, alloc, count)); - print_segment_map (abfd); - bfd_set_error (bfd_error_bad_value); - return FALSE; - } - - if (alloc == 0) - alloc = count; - phdrs = bfd_alloc2 (abfd, alloc, sizeof (Elf_Internal_Phdr)); + elf_tdata (abfd)->phdr = phdrs; if (phdrs == NULL) return FALSE; + maxpagesize = 1; + if ((abfd->flags & D_PAGED) != 0) + maxpagesize = bed->maxpagesize; + off = bed->s->sizeof_ehdr; off += alloc * bed->s->sizeof_phdr; - filehdr_vaddr = 0; - filehdr_paddr = 0; - phdrs_vaddr = 0; - phdrs_paddr = 0; - - for (m = elf_tdata (abfd)->segment_map, p = phdrs; + for (m = elf_tdata (abfd)->segment_map, p = phdrs, j = 0; m != NULL; - m = m->next, p++) + m = m->next, p++, j++) { - unsigned int i; asection **secpp; + bfd_vma off_adjust; + bfd_boolean no_contents; /* If elf_segment_map is not from map_sections_to_segments, the - sections may not be correctly ordered. NOTE: sorting should + sections may not be correctly ordered. NOTE: sorting should not be done to the PT_NOTE section of a corefile, which may contain several pseudo-sections artificially created by bfd. Sorting these pseudo-sections breaks things badly. */ @@ -4197,58 +4362,109 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) number of sections with contents contributing to both p_filesz and p_memsz, followed by a number of sections with no contents that just contribute to p_memsz. In this loop, OFF tracks next - available file offset for PT_LOAD and PT_NOTE segments. VOFF is - an adjustment we use for segments that have no file contents - but need zero filled memory allocation. */ - voff = 0; + available file offset for PT_LOAD and PT_NOTE segments. */ p->p_type = m->p_type; p->p_flags = m->p_flags; + if (m->count == 0) + p->p_vaddr = 0; + else + p->p_vaddr = m->sections[0]->vma - m->p_vaddr_offset; + + if (m->p_paddr_valid) + p->p_paddr = m->p_paddr; + else if (m->count == 0) + p->p_paddr = 0; + else + p->p_paddr = m->sections[0]->lma - m->p_vaddr_offset; + + if (p->p_type == PT_LOAD + && (abfd->flags & D_PAGED) != 0) + { + /* p_align in demand paged PT_LOAD segments effectively stores + the maximum page size. When copying an executable with + objcopy, we set m->p_align from the input file. Use this + value for maxpagesize rather than bed->maxpagesize, which + may be different. Note that we use maxpagesize for PT_TLS + segment alignment later in this function, so we are relying + on at least one PT_LOAD segment appearing before a PT_TLS + segment. */ + if (m->p_align_valid) + maxpagesize = m->p_align; + + p->p_align = maxpagesize; + } + else if (m->count == 0) + p->p_align = 1 << bed->s->log_file_align; + else if (m->p_align_valid) + p->p_align = m->p_align; + else + p->p_align = 0; + + no_contents = FALSE; + off_adjust = 0; if (p->p_type == PT_LOAD && m->count > 0) { bfd_size_type align; - bfd_vma adjust; unsigned int align_power = 0; - for (i = 0, secpp = m->sections; i < m->count; i++, secpp++) + if (m->p_align_valid) + align = p->p_align; + else { - unsigned int secalign; + for (i = 0, secpp = m->sections; i < m->count; i++, secpp++) + { + unsigned int secalign; - secalign = bfd_get_section_alignment (abfd, *secpp); - if (secalign > align_power) - align_power = secalign; + secalign = bfd_get_section_alignment (abfd, *secpp); + if (secalign > align_power) + align_power = secalign; + } + align = (bfd_size_type) 1 << align_power; + if (align < maxpagesize) + align = maxpagesize; } - align = (bfd_size_type) 1 << align_power; - - if ((abfd->flags & D_PAGED) != 0 && bed->maxpagesize > align) - align = bed->maxpagesize; - adjust = vma_page_aligned_bias (m->sections[0]->vma, off, align); - off += adjust; - if (adjust != 0 - && !m->includes_filehdr - && !m->includes_phdrs - && (ufile_ptr) off >= align) + for (i = 0; i < m->count; i++) + if ((m->sections[i]->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0) + /* If we aren't making room for this section, then + it must be SHT_NOBITS regardless of what we've + set via struct bfd_elf_special_section. */ + elf_section_type (m->sections[i]) = SHT_NOBITS; + + /* Find out whether this segment contains any loadable + sections. If the first section isn't loadable, the same + holds for any other sections. */ + i = 0; + while (elf_section_type (m->sections[i]) == SHT_NOBITS) { - /* If the first section isn't loadable, the same holds for - any other sections. Since the segment won't need file - space, we can make p_offset overlap some prior segment. - However, .tbss is special. If a segment starts with - .tbss, we need to look at the next section to decide - whether the segment has any loadable sections. */ - i = 0; - while ((m->sections[i]->flags & SEC_LOAD) == 0) + /* If a segment starts with .tbss, we need to look + at the next section to decide whether the segment + has any loadable sections. */ + if ((elf_section_flags (m->sections[i]) & SHF_TLS) == 0 + || ++i >= m->count) { - if ((m->sections[i]->flags & SEC_THREAD_LOCAL) == 0 - || ++i >= m->count) - { - off -= adjust; - voff = adjust - align; - break; - } + no_contents = TRUE; + break; } } + + off_adjust = vma_page_aligned_bias (m->sections[0]->vma, off, align); + off += off_adjust; + if (no_contents) + { + /* We shouldn't need to align the segment on disk since + the segment doesn't need file space, but the gABI + arguably requires the alignment and glibc ld.so + checks it. So to comply with the alignment + requirement but not waste file space, we adjust + p_offset for just this segment. (OFF_ADJUST is + subtracted from OFF later.) This may put p_offset + past the end of file, but that shouldn't matter. */ + } + else + off_adjust = 0; } /* Make sure the .dynamic section is the first section in the PT_DYNAMIC segment. */ @@ -4263,35 +4479,14 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) return FALSE; } - if (m->count == 0) - p->p_vaddr = 0; - else - p->p_vaddr = m->sections[0]->vma; - - if (m->p_paddr_valid) - p->p_paddr = m->p_paddr; - else if (m->count == 0) - p->p_paddr = 0; - else - p->p_paddr = m->sections[0]->lma; - - if (p->p_type == PT_LOAD - && (abfd->flags & D_PAGED) != 0) - p->p_align = bed->maxpagesize; - else if (m->count == 0) - p->p_align = 1 << bed->s->log_file_align; - else - p->p_align = 0; - p->p_offset = 0; p->p_filesz = 0; p->p_memsz = 0; if (m->includes_filehdr) { - if (! m->p_flags_valid) + if (!m->p_flags_valid) p->p_flags |= PF_R; - p->p_offset = 0; p->p_filesz = bed->s->sizeof_ehdr; p->p_memsz = bed->s->sizeof_ehdr; if (m->count > 0) @@ -4308,30 +4503,17 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) } p->p_vaddr -= off; - if (! m->p_paddr_valid) + if (!m->p_paddr_valid) p->p_paddr -= off; } - if (p->p_type == PT_LOAD) - { - filehdr_vaddr = p->p_vaddr; - filehdr_paddr = p->p_paddr; - } } if (m->includes_phdrs) { - if (! m->p_flags_valid) + if (!m->p_flags_valid) p->p_flags |= PF_R; - if (m->includes_filehdr) - { - if (p->p_type == PT_LOAD) - { - phdrs_vaddr = p->p_vaddr + bed->s->sizeof_ehdr; - phdrs_paddr = p->p_paddr + bed->s->sizeof_ehdr; - } - } - else + if (!m->includes_filehdr) { p->p_offset = bed->s->sizeof_ehdr; @@ -4339,17 +4521,9 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) { BFD_ASSERT (p->p_type == PT_LOAD); p->p_vaddr -= off - p->p_offset; - if (! m->p_paddr_valid) + if (!m->p_paddr_valid) p->p_paddr -= off - p->p_offset; } - - if (p->p_type == PT_LOAD) - { - phdrs_vaddr = p->p_vaddr; - phdrs_paddr = p->p_paddr; - } - else - phdrs_vaddr = bed->maxpagesize + bed->s->sizeof_ehdr; } p->p_filesz += alloc * bed->s->sizeof_phdr; @@ -4359,36 +4533,44 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) if (p->p_type == PT_LOAD || (p->p_type == PT_NOTE && bfd_get_format (abfd) == bfd_core)) { - if (! m->includes_filehdr && ! m->includes_phdrs) - p->p_offset = off + voff; + if (!m->includes_filehdr && !m->includes_phdrs) + p->p_offset = off; else { file_ptr adjust; adjust = off - (p->p_offset + p->p_filesz); - p->p_filesz += adjust; + if (!no_contents) + p->p_filesz += adjust; p->p_memsz += adjust; } } + /* Set up p_filesz, p_memsz, p_align and p_flags from the section + maps. Set filepos for sections in PT_LOAD segments, and in + core files, for sections in PT_NOTE segments. + assign_file_positions_for_non_load_sections will set filepos + for other sections and update p_filesz for other segments. */ for (i = 0, secpp = m->sections; i < m->count; i++, secpp++) { asection *sec; - flagword flags; bfd_size_type align; + Elf_Internal_Shdr *this_hdr; sec = *secpp; - flags = sec->flags; - align = 1 << bfd_get_section_alignment (abfd, sec); + this_hdr = &elf_section_data (sec)->this_hdr; + align = (bfd_size_type) 1 << bfd_get_section_alignment (abfd, sec); if (p->p_type == PT_LOAD || p->p_type == PT_TLS) { - bfd_signed_vma adjust; + bfd_signed_vma adjust = sec->lma - (p->p_paddr + p->p_memsz); - if ((flags & SEC_LOAD) != 0) + if (this_hdr->sh_type != SHT_NOBITS + || ((this_hdr->sh_flags & SHF_ALLOC) != 0 + && ((this_hdr->sh_flags & SHF_TLS) == 0 + || p->p_type == PT_TLS))) { - adjust = sec->lma - (p->p_paddr + p->p_filesz); if (adjust < 0) { (*_bfd_error_handler) @@ -4396,24 +4578,13 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) abfd, sec, (unsigned long) sec->lma); adjust = 0; } - off += adjust; - p->p_filesz += adjust; - p->p_memsz += adjust; - } - /* .tbss is special. It doesn't contribute to p_memsz of - normal segments. */ - else if ((flags & SEC_THREAD_LOCAL) == 0 - || p->p_type == PT_TLS) - { - /* The section VMA must equal the file position - modulo the page size. */ - bfd_size_type page = align; - if ((abfd->flags & D_PAGED) != 0 && bed->maxpagesize > page) - page = bed->maxpagesize; - adjust = vma_page_aligned_bias (sec->vma, - p->p_vaddr + p->p_memsz, - page); p->p_memsz += adjust; + + if (this_hdr->sh_type != SHT_NOBITS) + { + off += adjust; + p->p_filesz += adjust; + } } } @@ -4423,9 +4594,9 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) everything. */ if (i == 0) { - sec->filepos = off; - off += sec->size; - p->p_filesz = sec->size; + this_hdr->sh_offset = sec->filepos = off; + off += this_hdr->sh_size; + p->p_filesz = this_hdr->sh_size; p->p_memsz = 0; p->p_align = 1; } @@ -4442,96 +4613,200 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) { if (p->p_type == PT_LOAD) { - sec->filepos = off; - /* FIXME: The SEC_HAS_CONTENTS test here dates back to - 1997, and the exact reason for it isn't clear. One - plausible explanation is that it is to work around - a problem we have with linker scripts using data - statements in NOLOAD sections. I don't think it - makes a great deal of sense to have such a section - assigned to a PT_LOAD segment, but apparently - people do this. The data statement results in a - bfd_data_link_order being built, and these need - section contents to write into. Eventually, we get - to _bfd_elf_write_object_contents which writes any - section with contents to the output. Make room - here for the write, so that following segments are - not trashed. */ - if ((flags & SEC_LOAD) != 0 - || (flags & SEC_HAS_CONTENTS) != 0) - off += sec->size; + this_hdr->sh_offset = sec->filepos = off; + if (this_hdr->sh_type != SHT_NOBITS) + off += this_hdr->sh_size; } - if ((flags & SEC_LOAD) != 0) + if (this_hdr->sh_type != SHT_NOBITS) { - p->p_filesz += sec->size; - p->p_memsz += sec->size; + p->p_filesz += this_hdr->sh_size; + /* A load section without SHF_ALLOC is something like + a note section in a PT_NOTE segment. These take + file space but are not loaded into memory. */ + if ((this_hdr->sh_flags & SHF_ALLOC) != 0) + p->p_memsz += this_hdr->sh_size; } - /* PR ld/594: Sections in note segments which are not loaded - contribute to the file size but not the in-memory size. */ - else if (p->p_type == PT_NOTE - && (flags & SEC_HAS_CONTENTS) != 0) - p->p_filesz += sec->size; - - /* .tbss is special. It doesn't contribute to p_memsz of - normal segments. */ - else if ((flags & SEC_THREAD_LOCAL) == 0 - || p->p_type == PT_TLS) - p->p_memsz += sec->size; - - if (p->p_type == PT_TLS - && sec->size == 0 - && (sec->flags & SEC_HAS_CONTENTS) == 0) + else if ((this_hdr->sh_flags & SHF_ALLOC) != 0) { - struct bfd_link_order *o = sec->map_tail.link_order; - if (o != NULL) - p->p_memsz += o->offset + o->size; + if (p->p_type == PT_TLS) + p->p_memsz += this_hdr->sh_size; + + /* .tbss is special. It doesn't contribute to p_memsz of + normal segments. */ + else if ((this_hdr->sh_flags & SHF_TLS) == 0) + p->p_memsz += this_hdr->sh_size; } - if (align > p->p_align - && (p->p_type != PT_LOAD || (abfd->flags & D_PAGED) == 0)) + if (p->p_type == PT_GNU_RELRO) + p->p_align = 1; + else if (align > p->p_align + && !m->p_align_valid + && (p->p_type != PT_LOAD + || (abfd->flags & D_PAGED) == 0)) p->p_align = align; } - if (! m->p_flags_valid) + if (!m->p_flags_valid) { p->p_flags |= PF_R; - if ((flags & SEC_CODE) != 0) + if ((this_hdr->sh_flags & SHF_EXECINSTR) != 0) p->p_flags |= PF_X; - if ((flags & SEC_READONLY) == 0) + if ((this_hdr->sh_flags & SHF_WRITE) != 0) p->p_flags |= PF_W; } } + off -= off_adjust; + + /* Check that all sections are in a PT_LOAD segment. + Don't check funky gdb generated core files. */ + if (p->p_type == PT_LOAD && bfd_get_format (abfd) != bfd_core) + for (i = 0, secpp = m->sections; i < m->count; i++, secpp++) + { + Elf_Internal_Shdr *this_hdr; + asection *sec; + + sec = *secpp; + this_hdr = &(elf_section_data(sec)->this_hdr); + if (this_hdr->sh_size != 0 + && !ELF_IS_SECTION_IN_SEGMENT_FILE (this_hdr, p)) + { + (*_bfd_error_handler) + (_("%B: section `%A' can't be allocated in segment %d"), + abfd, sec, j); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + } + } + + elf_tdata (abfd)->next_file_pos = off; + return TRUE; +} + +/* Assign file positions for the other sections. */ + +static bfd_boolean +assign_file_positions_for_non_load_sections (bfd *abfd, + struct bfd_link_info *link_info) +{ + const struct elf_backend_data *bed = get_elf_backend_data (abfd); + Elf_Internal_Shdr **i_shdrpp; + Elf_Internal_Shdr **hdrpp; + Elf_Internal_Phdr *phdrs; + Elf_Internal_Phdr *p; + struct elf_segment_map *m; + bfd_vma filehdr_vaddr, filehdr_paddr; + bfd_vma phdrs_vaddr, phdrs_paddr; + file_ptr off; + unsigned int num_sec; + unsigned int i; + unsigned int count; + + i_shdrpp = elf_elfsections (abfd); + num_sec = elf_numsections (abfd); + off = elf_tdata (abfd)->next_file_pos; + for (i = 1, hdrpp = i_shdrpp + 1; i < num_sec; i++, hdrpp++) + { + struct elf_obj_tdata *tdata = elf_tdata (abfd); + Elf_Internal_Shdr *hdr; + + hdr = *hdrpp; + if (hdr->bfd_section != NULL + && (hdr->bfd_section->filepos != 0 + || (hdr->sh_type == SHT_NOBITS + && hdr->contents == NULL))) + BFD_ASSERT (hdr->sh_offset == hdr->bfd_section->filepos); + else if ((hdr->sh_flags & SHF_ALLOC) != 0) + { + if (hdr->sh_size != 0) + ((*_bfd_error_handler) + (_("%B: warning: allocated section `%s' not in segment"), + abfd, + (hdr->bfd_section == NULL + ? "*unknown*" + : hdr->bfd_section->name))); + /* We don't need to page align empty sections. */ + if ((abfd->flags & D_PAGED) != 0 && hdr->sh_size != 0) + off += vma_page_aligned_bias (hdr->sh_addr, off, + bed->maxpagesize); + else + off += vma_page_aligned_bias (hdr->sh_addr, off, + hdr->sh_addralign); + off = _bfd_elf_assign_file_position_for_section (hdr, off, + FALSE); + } + else if (((hdr->sh_type == SHT_REL || hdr->sh_type == SHT_RELA) + && hdr->bfd_section == NULL) + || hdr == i_shdrpp[tdata->symtab_section] + || hdr == i_shdrpp[tdata->symtab_shndx_section] + || hdr == i_shdrpp[tdata->strtab_section]) + hdr->sh_offset = -1; + else + off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE); + + if (i == SHN_LORESERVE - 1) + { + i += SHN_HIRESERVE + 1 - SHN_LORESERVE; + hdrpp += SHN_HIRESERVE + 1 - SHN_LORESERVE; + } } /* Now that we have set the section file positions, we can set up the file positions for the non PT_LOAD segments. */ + count = 0; + filehdr_vaddr = 0; + filehdr_paddr = 0; + phdrs_vaddr = bed->maxpagesize + bed->s->sizeof_ehdr; + phdrs_paddr = 0; + phdrs = elf_tdata (abfd)->phdr; for (m = elf_tdata (abfd)->segment_map, p = phdrs; m != NULL; m = m->next, p++) { - if (p->p_type != PT_LOAD && m->count > 0) + ++count; + if (p->p_type != PT_LOAD) + continue; + + if (m->includes_filehdr) { - BFD_ASSERT (! m->includes_filehdr && ! m->includes_phdrs); - /* If the section has not yet been assigned a file position, - do so now. The ARM BPABI requires that .dynamic section - not be marked SEC_ALLOC because it is not part of any - PT_LOAD segment, so it will not be processed above. */ - if (p->p_type == PT_DYNAMIC && m->sections[0]->filepos == 0) + filehdr_vaddr = p->p_vaddr; + filehdr_paddr = p->p_paddr; + } + if (m->includes_phdrs) + { + phdrs_vaddr = p->p_vaddr; + phdrs_paddr = p->p_paddr; + if (m->includes_filehdr) { - unsigned int i; - Elf_Internal_Shdr ** const i_shdrpp = elf_elfsections (abfd); - - i = 1; - while (i_shdrpp[i]->bfd_section != m->sections[0]) - ++i; - off = (_bfd_elf_assign_file_position_for_section - (i_shdrpp[i], off, TRUE)); - p->p_filesz = m->sections[0]->size; + phdrs_vaddr += bed->s->sizeof_ehdr; + phdrs_paddr += bed->s->sizeof_ehdr; } - p->p_offset = m->sections[0]->filepos; } - if (m->count == 0) + } + + for (m = elf_tdata (abfd)->segment_map, p = phdrs; + m != NULL; + m = m->next, p++) + { + if (m->count != 0) + { + if (p->p_type != PT_LOAD + && (p->p_type != PT_NOTE || bfd_get_format (abfd) != bfd_core)) + { + Elf_Internal_Shdr *hdr; + BFD_ASSERT (!m->includes_filehdr && !m->includes_phdrs); + + hdr = &elf_section_data (m->sections[m->count - 1])->this_hdr; + p->p_filesz = (m->sections[m->count - 1]->filepos + - m->sections[0]->filepos); + if (hdr->sh_type != SHT_NOBITS) + p->p_filesz += hdr->sh_size; + + p->p_offset = m->sections[0]->filepos; + } + } + else { if (m->includes_filehdr) { @@ -4554,8 +4829,8 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) if (lp->p_type == PT_LOAD && lp->p_vaddr <= link_info->relro_end && lp->p_vaddr >= link_info->relro_start - && lp->p_vaddr + lp->p_filesz - >= link_info->relro_end) + && (lp->p_vaddr + lp->p_filesz + >= link_info->relro_end)) break; } @@ -4579,131 +4854,11 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) } } - /* Clear out any program headers we allocated but did not use. */ - for (; count < alloc; count++, p++) - { - memset (p, 0, sizeof *p); - p->p_type = PT_NULL; - } - - elf_tdata (abfd)->phdr = phdrs; - elf_tdata (abfd)->next_file_pos = off; - /* Write out the program headers. */ - if (bfd_seek (abfd, (bfd_signed_vma) bed->s->sizeof_ehdr, SEEK_SET) != 0 - || bed->s->write_out_phdrs (abfd, phdrs, alloc) != 0) - return FALSE; - return TRUE; } -/* Get the size of the program header. - - If this is called by the linker before any of the section VMA's are set, it - can't calculate the correct value for a strange memory layout. This only - happens when SIZEOF_HEADERS is used in a linker script. In this case, - SORTED_HDRS is NULL and we assume the normal scenario of one text and one - data segment (exclusive of .interp and .dynamic). - - ??? User written scripts must either not use SIZEOF_HEADERS, or assume there - will be two segments. */ - -static bfd_size_type -get_program_header_size (bfd *abfd) -{ - size_t segs; - asection *s; - const struct elf_backend_data *bed = get_elf_backend_data (abfd); - - /* We can't return a different result each time we're called. */ - if (elf_tdata (abfd)->program_header_size != 0) - return elf_tdata (abfd)->program_header_size; - - if (elf_tdata (abfd)->segment_map != NULL) - { - struct elf_segment_map *m; - - segs = 0; - for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next) - ++segs; - elf_tdata (abfd)->program_header_size = segs * bed->s->sizeof_phdr; - return elf_tdata (abfd)->program_header_size; - } - - /* Assume we will need exactly two PT_LOAD segments: one for text - and one for data. */ - segs = 2; - - s = bfd_get_section_by_name (abfd, ".interp"); - if (s != NULL && (s->flags & SEC_LOAD) != 0) - { - /* If we have a loadable interpreter section, we need a - PT_INTERP segment. In this case, assume we also need a - PT_PHDR segment, although that may not be true for all - targets. */ - segs += 2; - } - - if (bfd_get_section_by_name (abfd, ".dynamic") != NULL) - { - /* We need a PT_DYNAMIC segment. */ - ++segs; - } - - if (elf_tdata (abfd)->eh_frame_hdr) - { - /* We need a PT_GNU_EH_FRAME segment. */ - ++segs; - } - - if (elf_tdata (abfd)->stack_flags) - { - /* We need a PT_GNU_STACK segment. */ - ++segs; - } - - if (elf_tdata (abfd)->relro) - { - /* We need a PT_GNU_RELRO segment. */ - ++segs; - } - - for (s = abfd->sections; s != NULL; s = s->next) - { - if ((s->flags & SEC_LOAD) != 0 - && strncmp (s->name, ".note", 5) == 0) - { - /* We need a PT_NOTE segment. */ - ++segs; - } - } - - for (s = abfd->sections; s != NULL; s = s->next) - { - if (s->flags & SEC_THREAD_LOCAL) - { - /* We need a PT_TLS segment. */ - ++segs; - break; - } - } - - /* Let the backend count up any program headers it might need. */ - if (bed->elf_backend_additional_program_headers) - { - int a; - - a = (*bed->elf_backend_additional_program_headers) (abfd); - if (a == -1) - abort (); - segs += a; - } - - elf_tdata (abfd)->program_header_size = segs * bed->s->sizeof_phdr; - return elf_tdata (abfd)->program_header_size; -} - /* Work out the file positions of all the sections. This is called by _bfd_elf_compute_section_file_positions. All the section sizes and VMAs must be known before this is called. @@ -4722,16 +4877,16 @@ static bfd_boolean assign_file_positions_except_relocs (bfd *abfd, struct bfd_link_info *link_info) { - struct elf_obj_tdata * const tdata = elf_tdata (abfd); - Elf_Internal_Ehdr * const i_ehdrp = elf_elfheader (abfd); - Elf_Internal_Shdr ** const i_shdrpp = elf_elfsections (abfd); - unsigned int num_sec = elf_numsections (abfd); + struct elf_obj_tdata *tdata = elf_tdata (abfd); + Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd); file_ptr off; const struct elf_backend_data *bed = get_elf_backend_data (abfd); if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0 && bfd_get_format (abfd) != bfd_core) { + Elf_Internal_Shdr ** const i_shdrpp = elf_elfsections (abfd); + unsigned int num_sec = elf_numsections (abfd); Elf_Internal_Shdr **hdrpp; unsigned int i; @@ -4766,58 +4921,30 @@ assign_file_positions_except_relocs (bfd *abfd, } else { - unsigned int i; - Elf_Internal_Shdr **hdrpp; + unsigned int alloc; /* Assign file positions for the loaded sections based on the - assignment of sections to segments. */ - if (! assign_file_positions_for_segments (abfd, link_info)) + assignment of sections to segments. */ + if (!assign_file_positions_for_load_sections (abfd, link_info)) return FALSE; - /* Assign file positions for the other sections. */ + /* And for non-load sections. */ + if (!assign_file_positions_for_non_load_sections (abfd, link_info)) + return FALSE; - off = elf_tdata (abfd)->next_file_pos; - for (i = 1, hdrpp = i_shdrpp + 1; i < num_sec; i++, hdrpp++) + if (bed->elf_backend_modify_program_headers != NULL) { - Elf_Internal_Shdr *hdr; + if (!(*bed->elf_backend_modify_program_headers) (abfd, link_info)) + return FALSE; + } - hdr = *hdrpp; - if (hdr->bfd_section != NULL - && hdr->bfd_section->filepos != 0) - hdr->sh_offset = hdr->bfd_section->filepos; - else if ((hdr->sh_flags & SHF_ALLOC) != 0) - { - if (hdr->sh_size != 0) - ((*_bfd_error_handler) - (_("%B: warning: allocated section `%s' not in segment"), - abfd, - (hdr->bfd_section == NULL - ? "*unknown*" - : hdr->bfd_section->name))); - if ((abfd->flags & D_PAGED) != 0) - off += vma_page_aligned_bias (hdr->sh_addr, off, - bed->maxpagesize); - else - off += vma_page_aligned_bias (hdr->sh_addr, off, - hdr->sh_addralign); - off = _bfd_elf_assign_file_position_for_section (hdr, off, - FALSE); - } - else if (((hdr->sh_type == SHT_REL || hdr->sh_type == SHT_RELA) - && hdr->bfd_section == NULL) - || hdr == i_shdrpp[tdata->symtab_section] - || hdr == i_shdrpp[tdata->symtab_shndx_section] - || hdr == i_shdrpp[tdata->strtab_section]) - hdr->sh_offset = -1; - else - off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE); + /* Write out the program headers. */ + alloc = tdata->program_header_size / bed->s->sizeof_phdr; + if (bfd_seek (abfd, (bfd_signed_vma) bed->s->sizeof_ehdr, SEEK_SET) != 0 + || bed->s->write_out_phdrs (abfd, tdata->phdr, alloc) != 0) + return FALSE; - if (i == SHN_LORESERVE - 1) - { - i += SHN_HIRESERVE + 1 - SHN_LORESERVE; - hdrpp += SHN_HIRESERVE + 1 - SHN_LORESERVE; - } - } + off = tdata->next_file_pos; } /* Place the section headers. */ @@ -4825,7 +4952,7 @@ assign_file_positions_except_relocs (bfd *abfd, i_ehdrp->e_shoff = off; off += i_ehdrp->e_shnum * i_ehdrp->e_shentsize; - elf_tdata (abfd)->next_file_pos = off; + tdata->next_file_pos = off; return TRUE; } @@ -4994,7 +5121,7 @@ _bfd_elf_write_object_contents (bfd *abfd) /* Write out the section header names. */ if (elf_shstrtab (abfd) != NULL && (bfd_seek (abfd, elf_tdata (abfd)->shstrtab_hdr.sh_offset, SEEK_SET) != 0 - || ! _bfd_elf_strtab_emit (abfd, elf_shstrtab (abfd)))) + || !_bfd_elf_strtab_emit (abfd, elf_shstrtab (abfd)))) return FALSE; if (bed->elf_backend_final_write_processing) @@ -5066,13 +5193,14 @@ _bfd_elf_symbol_from_bfd_symbol (bfd *abfd, asymbol **asym_ptr_ptr) && (flags & BSF_SECTION_SYM) && asym_ptr->section) { + asection *sec; int indx; - if (asym_ptr->section->output_section != NULL) - indx = asym_ptr->section->output_section->index; - else - indx = asym_ptr->section->index; - if (indx < elf_num_section_syms (abfd) + sec = asym_ptr->section; + if (sec->owner != abfd && sec->output_section != NULL) + sec = sec->output_section; + if (sec->owner == abfd + && (indx = sec->index) < elf_num_section_syms (abfd) && elf_section_syms (abfd)[indx] != NULL) asym_ptr->udata.i = elf_section_syms (abfd)[indx]->udata.i; } @@ -5082,7 +5210,7 @@ _bfd_elf_symbol_from_bfd_symbol (bfd *abfd, asymbol **asym_ptr_ptr) if (idx == 0) { /* This case can occur when using --strip-symbol on a symbol - which is used in a relocation entry. */ + which is used in a relocation entry. */ (*_bfd_error_handler) (_("%B: symbol `%s' required but not present"), abfd, bfd_asymbol_name (asym_ptr)); @@ -5161,7 +5289,7 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd) && bfd_get_format (ibfd) == bfd_core \ && s->vma == 0 && s->lma == 0 \ && (bfd_vma) s->filepos >= p->p_offset \ - && ((bfd_vma) s->filepos + s->size \ + && ((bfd_vma) s->filepos + s->size \ <= p->p_offset + p->p_filesz)) /* The complicated case when p_vaddr is 0 is to handle the Solaris @@ -5175,13 +5303,13 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd) && (s->flags & SEC_HAS_CONTENTS) != 0 \ && s->size > 0 \ && (bfd_vma) s->filepos >= p->p_offset \ - && ((bfd_vma) s->filepos + s->size \ + && ((bfd_vma) s->filepos + s->size \ <= p->p_offset + p->p_filesz)) /* Decide if the given section should be included in the given segment. A section will be included if: 1. It is within the address space of the segment -- we use the LMA - if that is set for the segment and the VMA otherwise, + if that is set for the segment and the VMA otherwise, 2. It is an allocated segment, 3. There is an output section associated with it, 4. The section has not already been allocated to a previous segment. @@ -5189,14 +5317,13 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd) 6. PT_TLS segment includes only SHF_TLS sections. 7. SHF_TLS sections are only in PT_TLS or PT_LOAD segments. 8. PT_DYNAMIC should not contain empty sections at the beginning - (with the possible exception of .dynamic). */ -#define INCLUDE_SECTION_IN_SEGMENT(section, segment, bed) \ + (with the possible exception of .dynamic). */ +#define IS_SECTION_IN_INPUT_SEGMENT(section, segment, bed) \ ((((segment->p_paddr \ ? IS_CONTAINED_BY_LMA (section, segment, segment->p_paddr) \ : IS_CONTAINED_BY_VMA (section, segment)) \ && (section->flags & SEC_ALLOC) != 0) \ || IS_COREFILE_NOTE (segment, section)) \ - && section->output_section != NULL \ && segment->p_type != PT_GNU_STACK \ && (segment->p_type != PT_TLS \ || (section->flags & SEC_THREAD_LOCAL)) \ @@ -5206,12 +5333,18 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd) && (segment->p_type != PT_DYNAMIC \ || SECTION_SIZE (section, segment) > 0 \ || (segment->p_paddr \ - ? segment->p_paddr != section->lma \ - : segment->p_vaddr != section->vma) \ + ? segment->p_paddr != section->lma \ + : segment->p_vaddr != section->vma) \ || (strcmp (bfd_get_section_name (ibfd, section), ".dynamic") \ - == 0)) \ + == 0)) \ && ! section->segment_mark) +/* If the output section of a section in the input segment is NULL, + it is removed from the corresponding output segment. */ +#define INCLUDE_SECTION_IN_SEGMENT(section, segment, bed) \ + (IS_SECTION_IN_INPUT_SEGMENT (section, segment, bed) \ + && section->output_section != NULL) + /* Returns TRUE iff seg1 starts after the end of seg2. */ #define SEGMENT_AFTER_SEGMENT(seg1, seg2, field) \ (seg1->field >= SEGMENT_END (seg2, seg2->field)) @@ -5224,9 +5357,9 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd) LMA. */ #define SEGMENT_OVERLAPS(seg1, seg2) \ ( !(SEGMENT_AFTER_SEGMENT (seg1, seg2, p_vaddr) \ - || SEGMENT_AFTER_SEGMENT (seg2, seg1, p_vaddr)) \ + || SEGMENT_AFTER_SEGMENT (seg2, seg1, p_vaddr)) \ && !(SEGMENT_AFTER_SEGMENT (seg1, seg2, p_paddr) \ - || SEGMENT_AFTER_SEGMENT (seg2, seg1, p_paddr))) + || SEGMENT_AFTER_SEGMENT (seg2, seg1, p_paddr))) /* Initialise the segment mark field. */ for (section = ibfd->sections; section != NULL; section = section->next) @@ -5269,7 +5402,7 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd) if (segment2->p_vaddr < segment->p_vaddr) { /* Extend SEGMENT2 to include SEGMENT and then delete - SEGMENT. */ + SEGMENT. */ extra_length = SEGMENT_END (segment, segment->p_vaddr) - SEGMENT_END (segment2, segment2->p_vaddr); @@ -5290,7 +5423,7 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd) else { /* Extend SEGMENT to include SEGMENT2 and then delete - SEGMENT2. */ + SEGMENT2. */ extra_length = SEGMENT_END (segment2, segment2->p_vaddr) - SEGMENT_END (segment, segment->p_vaddr); @@ -5319,22 +5452,33 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd) bfd_vma suggested_lma; unsigned int j; bfd_size_type amt; + asection * first_section; if (segment->p_type == PT_NULL) continue; + first_section = NULL; /* Compute how many sections might be placed into this segment. */ for (section = ibfd->sections, section_count = 0; section != NULL; section = section->next) - if (INCLUDE_SECTION_IN_SEGMENT (section, segment, bed)) - ++section_count; + { + /* Find the first section in the input segment, which may be + removed from the corresponding output segment. */ + if (IS_SECTION_IN_INPUT_SEGMENT (section, segment, bed)) + { + if (first_section == NULL) + first_section = section; + if (section->output_section != NULL) + ++section_count; + } + } /* Allocate a segment map big enough to contain all of the sections we have selected. */ amt = sizeof (struct elf_segment_map); amt += ((bfd_size_type) section_count - 1) * sizeof (asection *); - map = bfd_alloc (obfd, amt); + map = bfd_zalloc (obfd, amt); if (map == NULL) return FALSE; @@ -5344,8 +5488,15 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd) map->p_type = segment->p_type; map->p_flags = segment->p_flags; map->p_flags_valid = 1; - map->p_paddr = segment->p_paddr; - map->p_paddr_valid = 1; + + /* If the first section in the input segment is removed, there is + no need to preserve segment physical address in the corresponding + output segment. */ + if (!first_section || first_section->output_section != NULL) + { + map->p_paddr = segment->p_paddr; + map->p_paddr_valid = 1; + } /* Determine if this segment contains the ELF file header and if it contains the program headers themselves. */ @@ -5462,8 +5613,7 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd) if (IS_CONTAINED_BY_LMA (output_section, segment, map->p_paddr) || IS_COREFILE_NOTE (segment, section) || (bed->want_p_paddr_set_to_zero && - IS_CONTAINED_BY_VMA (output_section, segment)) - ) + IS_CONTAINED_BY_VMA (output_section, segment))) { if (matching_lma == 0) matching_lma = output_section->lma; @@ -5492,6 +5642,13 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd) *pointer_to_map = map; pointer_to_map = &map->next; + if (matching_lma != map->p_paddr + && !map->includes_filehdr && !map->includes_phdrs) + /* There is some padding before the first section in the + segment. So, we must account for that in the output + segment's vma. */ + map->p_vaddr_offset = matching_lma - map->p_paddr; + free (sections); continue; } @@ -5675,6 +5832,7 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd) #undef IS_CONTAINED_BY_LMA #undef IS_COREFILE_NOTE #undef IS_SOLARIS_PT_INTERP +#undef IS_SECTION_IN_INPUT_SEGMENT #undef INCLUDE_SECTION_IN_SEGMENT #undef SEGMENT_AFTER_SEGMENT #undef SEGMENT_OVERLAPS @@ -5709,6 +5867,7 @@ copy_elf_program_header (bfd *ibfd, bfd *obfd) unsigned int section_count; bfd_size_type amt; Elf_Internal_Shdr *this_hdr; + asection *first_section = NULL; /* FIXME: Do we need to copy PT_NULL segment? */ if (segment->p_type == PT_NULL) @@ -5721,7 +5880,11 @@ copy_elf_program_header (bfd *ibfd, bfd *obfd) { this_hdr = &(elf_section_data(section)->this_hdr); if (ELF_IS_SECTION_IN_SEGMENT_FILE (this_hdr, segment)) - section_count++; + { + if (!first_section) + first_section = section; + section_count++; + } } /* Allocate a segment map big enough to contain @@ -5729,7 +5892,7 @@ copy_elf_program_header (bfd *ibfd, bfd *obfd) amt = sizeof (struct elf_segment_map); if (section_count != 0) amt += ((bfd_size_type) section_count - 1) * sizeof (asection *); - map = bfd_alloc (obfd, amt); + map = bfd_zalloc (obfd, amt); if (map == NULL) return FALSE; @@ -5741,6 +5904,9 @@ copy_elf_program_header (bfd *ibfd, bfd *obfd) map->p_flags_valid = 1; map->p_paddr = segment->p_paddr; map->p_paddr_valid = 1; + map->p_align = segment->p_align; + map->p_align_valid = 1; + map->p_vaddr_offset = 0; /* Determine if this segment contains the ELF file header and if it contains the program headers themselves. */ @@ -5760,17 +5926,26 @@ copy_elf_program_header (bfd *ibfd, bfd *obfd) phdr_included = TRUE; } + if (!map->includes_phdrs && !map->includes_filehdr) + /* There is some other padding before the first section. */ + map->p_vaddr_offset = ((first_section ? first_section->lma : 0) + - segment->p_paddr); + if (section_count != 0) { unsigned int isec = 0; - for (section = ibfd->sections; + for (section = first_section; section != NULL; section = section->next) { this_hdr = &(elf_section_data(section)->this_hdr); if (ELF_IS_SECTION_IN_SEGMENT_FILE (this_hdr, segment)) - map->sections[isec++] = section->output_section; + { + map->sections[isec++] = section->output_section; + if (isec == section_count) + break; + } } } @@ -5798,8 +5973,8 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) if (ibfd->xvec == obfd->xvec) { - /* Check if any sections in the input BFD covered by ELF program - header are changed. */ + /* Check to see if any sections in the input BFD + covered by ELF program header have changed. */ Elf_Internal_Phdr *segment; asection *section, *osec; unsigned int i, num_segments; @@ -5815,6 +5990,15 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) i < num_segments; i++, segment++) { + /* PR binutils/3535. The Solaris linker always sets the p_paddr + and p_memsz fields of special segments (DYNAMIC, INTERP) to 0 + which severly confuses things, so always regenerate the segment + map in this case. */ + if (segment->p_paddr == 0 + && segment->p_memsz == 0 + && (segment->p_type == PT_INTERP || segment->p_type == PT_DYNAMIC)) + goto rewrite; + for (section = ibfd->sections; section != NULL; section = section->next) { @@ -5842,7 +6026,7 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) } } - /* Check to see if any output section doesn't come from the + /* Check to see if any output section do not come from the input BFD. */ for (section = obfd->sections; section != NULL; section = section->next) @@ -5877,16 +6061,22 @@ _bfd_elf_init_private_section_data (bfd *ibfd, || obfd->xvec->flavour != bfd_target_elf_flavour) return TRUE; - /* FIXME: What if the output ELF section type has been set to - something different? */ - if (elf_section_type (osec) == SHT_NULL) + /* Don't copy the output ELF section type from input if the + output BFD section flags have been set to something different. + elf_fake_sections will set ELF section type based on BFD + section flags. */ + if (elf_section_type (osec) == SHT_NULL + && (osec->flags == isec->flags || !osec->flags)) elf_section_type (osec) = elf_section_type (isec); + /* FIXME: Is this correct for all OS/PROC specific flags? */ + elf_section_flags (osec) |= (elf_section_flags (isec) + & (SHF_MASKOS | SHF_MASKPROC)); + /* Set things up for objcopy and relocatable link. The output SHT_GROUP section will have its elf_next_in_group pointing back to the input group members. Ignore linker created group section. See elfNN_ia64_object_p in elfxx-ia64.c. */ - if (need_group) { if (elf_sec_group (isec) == NULL @@ -5951,6 +6141,8 @@ _bfd_elf_copy_private_section_data (bfd *ibfd, bfd_boolean _bfd_elf_copy_private_header_data (bfd *ibfd, bfd *obfd) { + asection *isec; + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour || bfd_get_flavour (obfd) != bfd_target_elf_flavour) return TRUE; @@ -5966,6 +6158,27 @@ _bfd_elf_copy_private_header_data (bfd *ibfd, bfd *obfd) return FALSE; } + /* _bfd_elf_copy_private_section_data copied over the SHF_GROUP flag + but this might be wrong if we deleted the group section. */ + for (isec = ibfd->sections; isec != NULL; isec = isec->next) + if (elf_section_type (isec) == SHT_GROUP + && isec->output_section == NULL) + { + asection *first = elf_next_in_group (isec); + asection *s = first; + while (s != NULL) + { + if (s->output_section != NULL) + { + elf_section_flags (s->output_section) &= ~SHF_GROUP; + elf_group_name (s->output_section) = NULL; + } + s = elf_next_in_group (s); + if (s == first) + break; + } + } + return TRUE; } @@ -6238,6 +6451,10 @@ Unable to find equivalent output section for symbol '%s' from section '%s'"), type = STT_FUNC; else if ((flags & BSF_OBJECT) != 0) type = STT_OBJECT; + else if ((flags & BSF_RELC) != 0) + type = STT_RELC; + else if ((flags & BSF_SRELC) != 0) + type = STT_SRELC; else type = STT_NOTYPE; @@ -7036,13 +7253,31 @@ _bfd_elf_find_inliner_info (bfd *abfd, } int -_bfd_elf_sizeof_headers (bfd *abfd, bfd_boolean reloc) +_bfd_elf_sizeof_headers (bfd *abfd, struct bfd_link_info *info) { - int ret; + const struct elf_backend_data *bed = get_elf_backend_data (abfd); + int ret = bed->s->sizeof_ehdr; + + if (!info->relocatable) + { + bfd_size_type phdr_size = elf_tdata (abfd)->program_header_size; + + if (phdr_size == (bfd_size_type) -1) + { + struct elf_segment_map *m; + + phdr_size = 0; + for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next) + phdr_size += bed->s->sizeof_phdr; + + if (phdr_size == 0) + phdr_size = get_program_header_size (abfd, info); + } + + elf_tdata (abfd)->program_header_size = phdr_size; + ret += phdr_size; + } - ret = get_elf_backend_data (abfd)->s->sizeof_ehdr; - if (! reloc) - ret += get_program_header_size (abfd); return ret; } @@ -7178,7 +7413,7 @@ _bfd_elf_close_and_cleanup (bfd *abfd) { if (bfd_get_format (abfd) == bfd_object) { - if (elf_shstrtab (abfd) != NULL) + if (elf_tdata (abfd) != NULL && elf_shstrtab (abfd) != NULL) _bfd_elf_strtab_free (elf_shstrtab (abfd)); _bfd_dwarf2_cleanup_debug_info (abfd); } @@ -7232,13 +7467,12 @@ elfcore_maybe_make_sect (bfd *abfd, char *name, asection *sect) if (bfd_get_section_by_name (abfd, name) != NULL) return TRUE; - sect2 = bfd_make_section (abfd, name); + sect2 = bfd_make_section_with_flags (abfd, name, sect->flags); if (sect2 == NULL) return FALSE; sect2->size = sect->size; sect2->filepos = sect->filepos; - sect2->flags = sect->flags; sect2->alignment_power = sect->alignment_power; return TRUE; } @@ -7270,12 +7504,12 @@ _bfd_elfcore_make_pseudosection (bfd *abfd, return FALSE; memcpy (threaded_name, buf, len); - sect = bfd_make_section_anyway (abfd, threaded_name); + sect = bfd_make_section_anyway_with_flags (abfd, threaded_name, + SEC_HAS_CONTENTS); if (sect == NULL) return FALSE; sect->size = size; sect->filepos = filepos; - sect->flags = SEC_HAS_CONTENTS; sect->alignment_power = 2; return elfcore_maybe_make_sect (abfd, name, sect); @@ -7554,7 +7788,7 @@ elfcore_grok_lwpstatus (bfd *abfd, Elf_Internal_Note *note) return FALSE; memcpy (name, buf, len); - sect = bfd_make_section_anyway (abfd, name); + sect = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS); if (sect == NULL) return FALSE; @@ -7569,7 +7803,6 @@ elfcore_grok_lwpstatus (bfd *abfd, Elf_Internal_Note *note) sect->filepos = note->descpos + offsetof (lwpstatus_t, pr_reg); #endif - sect->flags = SEC_HAS_CONTENTS; sect->alignment_power = 2; if (!elfcore_maybe_make_sect (abfd, ".reg", sect)) @@ -7584,7 +7817,7 @@ elfcore_grok_lwpstatus (bfd *abfd, Elf_Internal_Note *note) return FALSE; memcpy (name, buf, len); - sect = bfd_make_section_anyway (abfd, name); + sect = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS); if (sect == NULL) return FALSE; @@ -7599,7 +7832,6 @@ elfcore_grok_lwpstatus (bfd *abfd, Elf_Internal_Note *note) sect->filepos = note->descpos + offsetof (lwpstatus_t, pr_fpreg); #endif - sect->flags = SEC_HAS_CONTENTS; sect->alignment_power = 2; return elfcore_maybe_make_sect (abfd, ".reg2", sect); @@ -7640,7 +7872,7 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note) memcpy (name, buf, len); - sect = bfd_make_section_anyway (abfd, name); + sect = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS); if (sect == NULL) return FALSE; @@ -7648,7 +7880,6 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note) sect->filepos = (note->descpos + offsetof (struct win32_pstatus, data.thread_info.thread_context)); - sect->flags = SEC_HAS_CONTENTS; sect->alignment_power = 2; if (pstatus.data.thread_info.is_active_thread) @@ -7668,14 +7899,13 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note) memcpy (name, buf, len); - sect = bfd_make_section_anyway (abfd, name); + sect = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS); if (sect == NULL) return FALSE; sect->size = note->descsz; sect->filepos = note->descpos; - sect->flags = SEC_HAS_CONTENTS; sect->alignment_power = 2; break; @@ -7745,13 +7975,13 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note) case NT_AUXV: { - asection *sect = bfd_make_section_anyway (abfd, ".auxv"); + asection *sect = bfd_make_section_anyway_with_flags (abfd, ".auxv", + SEC_HAS_CONTENTS); if (sect == NULL) return FALSE; sect->size = note->descsz; sect->filepos = note->descpos; - sect->flags = SEC_HAS_CONTENTS; sect->alignment_power = 1 + bfd_get_arch_size (abfd) / 32; return TRUE; @@ -7776,7 +8006,6 @@ elfcore_netbsd_get_lwpid (Elf_Internal_Note *note, int *lwpidp) static bfd_boolean elfcore_grok_netbsd_procinfo (bfd *abfd, Elf_Internal_Note *note) { - /* Signal number at offset 0x08. */ elf_tdata (abfd)->core_signal = bfd_h_get_32 (abfd, (bfd_byte *) note->descdata + 0x08); @@ -7804,9 +8033,9 @@ elfcore_grok_netbsd_note (bfd *abfd, Elf_Internal_Note *note) if (note->type == NT_NETBSDCORE_PROCINFO) { /* NetBSD-specific core "procinfo". Note that we expect to - find this note before any of the others, which is fine, - since the kernel writes this note out first when it - creates a core file. */ + find this note before any of the others, which is fine, + since the kernel writes this note out first when it + creates a core file. */ return elfcore_grok_netbsd_procinfo (abfd, note); } @@ -7822,44 +8051,44 @@ elfcore_grok_netbsd_note (bfd *abfd, Elf_Internal_Note *note) switch (bfd_get_arch (abfd)) { - /* On the Alpha, SPARC (32-bit and 64-bit), PT_GETREGS == mach+0 and - PT_GETFPREGS == mach+2. */ + /* On the Alpha, SPARC (32-bit and 64-bit), PT_GETREGS == mach+0 and + PT_GETFPREGS == mach+2. */ case bfd_arch_alpha: case bfd_arch_sparc: switch (note->type) - { - case NT_NETBSDCORE_FIRSTMACH+0: - return elfcore_make_note_pseudosection (abfd, ".reg", note); + { + case NT_NETBSDCORE_FIRSTMACH+0: + return elfcore_make_note_pseudosection (abfd, ".reg", note); - case NT_NETBSDCORE_FIRSTMACH+2: - return elfcore_make_note_pseudosection (abfd, ".reg2", note); + case NT_NETBSDCORE_FIRSTMACH+2: + return elfcore_make_note_pseudosection (abfd, ".reg2", note); - default: - return TRUE; - } + default: + return TRUE; + } - /* On all other arch's, PT_GETREGS == mach+1 and - PT_GETFPREGS == mach+3. */ + /* On all other arch's, PT_GETREGS == mach+1 and + PT_GETFPREGS == mach+3. */ default: switch (note->type) - { - case NT_NETBSDCORE_FIRSTMACH+1: - return elfcore_make_note_pseudosection (abfd, ".reg", note); + { + case NT_NETBSDCORE_FIRSTMACH+1: + return elfcore_make_note_pseudosection (abfd, ".reg", note); - case NT_NETBSDCORE_FIRSTMACH+3: - return elfcore_make_note_pseudosection (abfd, ".reg2", note); + case NT_NETBSDCORE_FIRSTMACH+3: + return elfcore_make_note_pseudosection (abfd, ".reg2", note); - default: - return TRUE; - } + default: + return TRUE; + } } /* NOTREACHED */ } static bfd_boolean -elfcore_grok_nto_status (bfd *abfd, Elf_Internal_Note *note, pid_t *tid) +elfcore_grok_nto_status (bfd *abfd, Elf_Internal_Note *note, long *tid) { void *ddata = note->descdata; char buf[100]; @@ -7891,20 +8120,19 @@ elfcore_grok_nto_status (bfd *abfd, Elf_Internal_Note *note, pid_t *tid) elf_tdata (abfd)->core_lwpid = *tid; /* Make a ".qnx_core_status/%d" section. */ - sprintf (buf, ".qnx_core_status/%ld", (long) *tid); + sprintf (buf, ".qnx_core_status/%ld", *tid); name = bfd_alloc (abfd, strlen (buf) + 1); if (name == NULL) return FALSE; strcpy (name, buf); - sect = bfd_make_section_anyway (abfd, name); + sect = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS); if (sect == NULL) return FALSE; sect->size = note->descsz; sect->filepos = note->descpos; - sect->flags = SEC_HAS_CONTENTS; sect->alignment_power = 2; return (elfcore_maybe_make_sect (abfd, ".qnx_core_status", sect)); @@ -7913,7 +8141,7 @@ elfcore_grok_nto_status (bfd *abfd, Elf_Internal_Note *note, pid_t *tid) static bfd_boolean elfcore_grok_nto_regs (bfd *abfd, Elf_Internal_Note *note, - pid_t tid, + long tid, char *base) { char buf[100]; @@ -7921,20 +8149,19 @@ elfcore_grok_nto_regs (bfd *abfd, asection *sect; /* Make a "(base)/%d" section. */ - sprintf (buf, "%s/%ld", base, (long) tid); + sprintf (buf, "%s/%ld", base, tid); name = bfd_alloc (abfd, strlen (buf) + 1); if (name == NULL) return FALSE; strcpy (name, buf); - sect = bfd_make_section_anyway (abfd, name); + sect = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS); if (sect == NULL) return FALSE; sect->size = note->descsz; sect->filepos = note->descpos; - sect->flags = SEC_HAS_CONTENTS; sect->alignment_power = 2; /* This is the current thread. */ @@ -7955,7 +8182,7 @@ elfcore_grok_nto_note (bfd *abfd, Elf_Internal_Note *note) /* Every GREG section has a STATUS section before it. Store the tid from the previous call to pass down to the next gregs function. */ - static pid_t tid = 1; + static long tid = 1; switch (note->type) { @@ -7975,45 +8202,42 @@ elfcore_grok_nto_note (bfd *abfd, Elf_Internal_Note *note) /* Function: elfcore_write_note Inputs: - buffer to hold note + buffer to hold note, and current size of buffer name of note type of note data for note size of data for note + Writes note to end of buffer. ELF64 notes are written exactly as + for ELF32, despite the current (as of 2006) ELF gabi specifying + that they ought to have 8-byte namesz and descsz field, and have + 8-byte alignment. Other writers, eg. Linux kernel, do the same. + Return: - End of buffer containing note. */ + Pointer to realloc'd buffer, *BUFSIZ updated. */ char * -elfcore_write_note (bfd *abfd, +elfcore_write_note (bfd *abfd, char *buf, - int *bufsiz, + int *bufsiz, const char *name, - int type, + int type, const void *input, - int size) + int size) { Elf_External_Note *xnp; size_t namesz; - size_t pad; size_t newspace; - char *p, *dest; + char *dest; namesz = 0; - pad = 0; if (name != NULL) - { - const struct elf_backend_data *bed; - - namesz = strlen (name) + 1; - bed = get_elf_backend_data (abfd); - pad = -namesz & ((1 << bed->s->log_file_align) - 1); - } + namesz = strlen (name) + 1; - newspace = 12 + namesz + pad + size; + newspace = 12 + ((namesz + 3) & -4) + ((size + 3) & -4); - p = realloc (buf, *bufsiz + newspace); - dest = p + *bufsiz; + buf = realloc (buf, *bufsiz + newspace); + dest = buf + *bufsiz; *bufsiz += newspace; xnp = (Elf_External_Note *) dest; H_PUT_32 (abfd, namesz, xnp->namesz); @@ -8024,14 +8248,20 @@ elfcore_write_note (bfd *abfd, { memcpy (dest, name, namesz); dest += namesz; - while (pad != 0) + while (namesz & 3) { *dest++ = '\0'; - --pad; + ++namesz; } } memcpy (dest, input, size); - return p; + dest += size; + while (size & 3) + { + *dest++ = '\0'; + ++size; + } + return buf; } #if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T) @@ -8042,22 +8272,52 @@ elfcore_write_prpsinfo (bfd *abfd, const char *fname, const char *psargs) { - int note_type; - char *note_name = "CORE"; + const char *note_name = "CORE"; + const struct elf_backend_data *bed = get_elf_backend_data (abfd); + + if (bed->elf_backend_write_core_note != NULL) + { + char *ret; + ret = (*bed->elf_backend_write_core_note) (abfd, buf, bufsiz, + NT_PRPSINFO, fname, psargs); + if (ret != NULL) + return ret; + } + +#if defined (HAVE_PRPSINFO32_T) || defined (HAVE_PSINFO32_T) + if (bed->s->elfclass == ELFCLASS32) + { +#if defined (HAVE_PSINFO32_T) + psinfo32_t data; + int note_type = NT_PSINFO; +#else + prpsinfo32_t data; + int note_type = NT_PRPSINFO; +#endif + memset (&data, 0, sizeof (data)); + strncpy (data.pr_fname, fname, sizeof (data.pr_fname)); + strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs)); + return elfcore_write_note (abfd, buf, bufsiz, + note_name, note_type, &data, sizeof (data)); + } + else +#endif + { #if defined (HAVE_PSINFO_T) - psinfo_t data; - note_type = NT_PSINFO; + psinfo_t data; + int note_type = NT_PSINFO; #else - prpsinfo_t data; - note_type = NT_PRPSINFO; + prpsinfo_t data; + int note_type = NT_PRPSINFO; #endif - memset (&data, 0, sizeof (data)); - strncpy (data.pr_fname, fname, sizeof (data.pr_fname)); - strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs)); - return elfcore_write_note (abfd, buf, bufsiz, - note_name, note_type, &data, sizeof (data)); + memset (&data, 0, sizeof (data)); + strncpy (data.pr_fname, fname, sizeof (data.pr_fname)); + strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs)); + return elfcore_write_note (abfd, buf, bufsiz, + note_name, note_type, &data, sizeof (data)); + } } #endif /* PSINFO_T or PRPSINFO_T */ @@ -8070,15 +8330,43 @@ elfcore_write_prstatus (bfd *abfd, int cursig, const void *gregs) { - prstatus_t prstat; - char *note_name = "CORE"; + const char *note_name = "CORE"; + const struct elf_backend_data *bed = get_elf_backend_data (abfd); - memset (&prstat, 0, sizeof (prstat)); - prstat.pr_pid = pid; - prstat.pr_cursig = cursig; - memcpy (&prstat.pr_reg, gregs, sizeof (prstat.pr_reg)); - return elfcore_write_note (abfd, buf, bufsiz, - note_name, NT_PRSTATUS, &prstat, sizeof (prstat)); + if (bed->elf_backend_write_core_note != NULL) + { + char *ret; + ret = (*bed->elf_backend_write_core_note) (abfd, buf, bufsiz, + NT_PRSTATUS, + pid, cursig, gregs); + if (ret != NULL) + return ret; + } + +#if defined (HAVE_PRSTATUS32_T) + if (bed->s->elfclass == ELFCLASS32) + { + prstatus32_t prstat; + + memset (&prstat, 0, sizeof (prstat)); + prstat.pr_pid = pid; + prstat.pr_cursig = cursig; + memcpy (&prstat.pr_reg, gregs, sizeof (prstat.pr_reg)); + return elfcore_write_note (abfd, buf, bufsiz, note_name, + NT_PRSTATUS, &prstat, sizeof (prstat)); + } + else +#endif + { + prstatus_t prstat; + + memset (&prstat, 0, sizeof (prstat)); + prstat.pr_pid = pid; + prstat.pr_cursig = cursig; + memcpy (&prstat.pr_reg, gregs, sizeof (prstat.pr_reg)); + return elfcore_write_note (abfd, buf, bufsiz, note_name, + NT_PRSTATUS, &prstat, sizeof (prstat)); + } } #endif /* HAVE_PRSTATUS_T */ @@ -8092,7 +8380,7 @@ elfcore_write_lwpstatus (bfd *abfd, const void *gregs) { lwpstatus_t lwpstat; - char *note_name = "CORE"; + const char *note_name = "CORE"; memset (&lwpstat, 0, sizeof (lwpstat)); lwpstat.pr_lwpid = pid >> 16; @@ -8122,14 +8410,31 @@ elfcore_write_pstatus (bfd *abfd, int cursig ATTRIBUTE_UNUSED, const void *gregs ATTRIBUTE_UNUSED) { - pstatus_t pstat; - char *note_name = "CORE"; + const char *note_name = "CORE"; +#if defined (HAVE_PSTATUS32_T) + const struct elf_backend_data *bed = get_elf_backend_data (abfd); - memset (&pstat, 0, sizeof (pstat)); - pstat.pr_pid = pid & 0xffff; - buf = elfcore_write_note (abfd, buf, bufsiz, note_name, - NT_PSTATUS, &pstat, sizeof (pstat)); - return buf; + if (bed->s->elfclass == ELFCLASS32) + { + pstatus32_t pstat; + + memset (&pstat, 0, sizeof (pstat)); + pstat.pr_pid = pid & 0xffff; + buf = elfcore_write_note (abfd, buf, bufsiz, note_name, + NT_PSTATUS, &pstat, sizeof (pstat)); + return buf; + } + else +#endif + { + pstatus_t pstat; + + memset (&pstat, 0, sizeof (pstat)); + pstat.pr_pid = pid & 0xffff; + buf = elfcore_write_note (abfd, buf, bufsiz, note_name, + NT_PSTATUS, &pstat, sizeof (pstat)); + return buf; + } } #endif /* HAVE_PSTATUS_T */ @@ -8140,7 +8445,7 @@ elfcore_write_prfpreg (bfd *abfd, const void *fpregs, int size) { - char *note_name = "CORE"; + const char *note_name = "CORE"; return elfcore_write_note (abfd, buf, bufsiz, note_name, NT_FPREGSET, fpregs, size); } @@ -8196,21 +8501,21 @@ elfcore_read_notes (bfd *abfd, file_ptr offset, bfd_size_type size) in.descdata = in.namedata + BFD_ALIGN (in.namesz, 4); in.descpos = offset + (in.descdata - buf); - if (strncmp (in.namedata, "NetBSD-CORE", 11) == 0) - { - if (! elfcore_grok_netbsd_note (abfd, &in)) - goto error; - } - else if (strncmp (in.namedata, "QNX", 3) == 0) + if (CONST_STRNEQ (in.namedata, "NetBSD-CORE")) + { + if (! elfcore_grok_netbsd_note (abfd, &in)) + goto error; + } + else if (CONST_STRNEQ (in.namedata, "QNX")) { if (! elfcore_grok_nto_note (abfd, &in)) goto error; } else - { - if (! elfcore_grok_note (abfd, &in)) - goto error; - } + { + if (! elfcore_grok_note (abfd, &in)) + goto error; + } p = in.descdata + BFD_ALIGN (in.descsz, 4); } @@ -8516,39 +8821,41 @@ _bfd_elf_get_synthetic_symtab (bfd *abfd, return n; } -/* Sort symbol by binding and section. We want to put definitions - sorted by section at the beginning. */ - -static int -elf_sort_elf_symbol (const void *arg1, const void *arg2) +struct elf_symbuf_symbol { - const Elf_Internal_Sym *s1; - const Elf_Internal_Sym *s2; - int shndx; - - /* Make sure that undefined symbols are at the end. */ - s1 = (const Elf_Internal_Sym *) arg1; - if (s1->st_shndx == SHN_UNDEF) - return 1; - s2 = (const Elf_Internal_Sym *) arg2; - if (s2->st_shndx == SHN_UNDEF) - return -1; - - /* Sorted by section index. */ - shndx = s1->st_shndx - s2->st_shndx; - if (shndx != 0) - return shndx; + unsigned long st_name; /* Symbol name, index in string tbl */ + unsigned char st_info; /* Type and binding attributes */ + unsigned char st_other; /* Visibilty, and target specific */ +}; - /* Sorted by binding. */ - return ELF_ST_BIND (s1->st_info) - ELF_ST_BIND (s2->st_info); -} +struct elf_symbuf_head +{ + struct elf_symbuf_symbol *ssym; + bfd_size_type count; + unsigned int st_shndx; +}; struct elf_symbol { - Elf_Internal_Sym *sym; + union + { + Elf_Internal_Sym *isym; + struct elf_symbuf_symbol *ssym; + } u; const char *name; }; +/* Sort references to symbols by ascending section number. */ + +static int +elf_sort_elf_symbol (const void *arg1, const void *arg2) +{ + const Elf_Internal_Sym *s1 = *(const Elf_Internal_Sym **) arg1; + const Elf_Internal_Sym *s2 = *(const Elf_Internal_Sym **) arg2; + + return s1->st_shndx - s2->st_shndx; +} + static int elf_sym_name_compare (const void *arg1, const void *arg2) { @@ -8557,20 +8864,79 @@ elf_sym_name_compare (const void *arg1, const void *arg2) return strcmp (s1->name, s2->name); } +static struct elf_symbuf_head * +elf_create_symbuf (bfd_size_type symcount, Elf_Internal_Sym *isymbuf) +{ + Elf_Internal_Sym **ind, **indbufend, **indbuf + = bfd_malloc2 (symcount, sizeof (*indbuf)); + struct elf_symbuf_symbol *ssym; + struct elf_symbuf_head *ssymbuf, *ssymhead; + bfd_size_type i, shndx_count; + + if (indbuf == NULL) + return NULL; + + for (ind = indbuf, i = 0; i < symcount; i++) + if (isymbuf[i].st_shndx != SHN_UNDEF) + *ind++ = &isymbuf[i]; + indbufend = ind; + + qsort (indbuf, indbufend - indbuf, sizeof (Elf_Internal_Sym *), + elf_sort_elf_symbol); + + shndx_count = 0; + if (indbufend > indbuf) + for (ind = indbuf, shndx_count++; ind < indbufend - 1; ind++) + if (ind[0]->st_shndx != ind[1]->st_shndx) + shndx_count++; + + ssymbuf = bfd_malloc ((shndx_count + 1) * sizeof (*ssymbuf) + + (indbufend - indbuf) * sizeof (*ssymbuf)); + if (ssymbuf == NULL) + { + free (indbuf); + return NULL; + } + + ssym = (struct elf_symbuf_symbol *) (ssymbuf + shndx_count); + ssymbuf->ssym = NULL; + ssymbuf->count = shndx_count; + ssymbuf->st_shndx = 0; + for (ssymhead = ssymbuf, ind = indbuf; ind < indbufend; ssym++, ind++) + { + if (ind == indbuf || ssymhead->st_shndx != (*ind)->st_shndx) + { + ssymhead++; + ssymhead->ssym = ssym; + ssymhead->count = 0; + ssymhead->st_shndx = (*ind)->st_shndx; + } + ssym->st_name = (*ind)->st_name; + ssym->st_info = (*ind)->st_info; + ssym->st_other = (*ind)->st_other; + ssymhead->count++; + } + BFD_ASSERT ((bfd_size_type) (ssymhead - ssymbuf) == shndx_count); + + free (indbuf); + return ssymbuf; +} + /* Check if 2 sections define the same set of local and global symbols. */ bfd_boolean -bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2) +bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2, + struct bfd_link_info *info) { bfd *bfd1, *bfd2; const struct elf_backend_data *bed1, *bed2; Elf_Internal_Shdr *hdr1, *hdr2; bfd_size_type symcount1, symcount2; Elf_Internal_Sym *isymbuf1, *isymbuf2; - Elf_Internal_Sym *isymstart1 = NULL, *isymstart2 = NULL, *isym; - Elf_Internal_Sym *isymend; - struct elf_symbol *symp, *symtable1 = NULL, *symtable2 = NULL; + struct elf_symbuf_head *ssymbuf1, *ssymbuf2; + Elf_Internal_Sym *isym, *isymend; + struct elf_symbol *symtable1 = NULL, *symtable2 = NULL; bfd_size_type count1, count2, i; int shndx1, shndx2; bfd_boolean result; @@ -8580,10 +8946,8 @@ bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2) /* If both are .gnu.linkonce sections, they have to have the same section name. */ - if (strncmp (sec1->name, ".gnu.linkonce", - sizeof ".gnu.linkonce" - 1) == 0 - && strncmp (sec2->name, ".gnu.linkonce", - sizeof ".gnu.linkonce" - 1) == 0) + if (CONST_STRNEQ (sec1->name, ".gnu.linkonce") + && CONST_STRNEQ (sec2->name, ".gnu.linkonce")) return strcmp (sec1->name + sizeof ".gnu.linkonce", sec2->name + sizeof ".gnu.linkonce") == 0; @@ -8619,84 +8983,155 @@ bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2) if (symcount1 == 0 || symcount2 == 0) return FALSE; - isymbuf1 = bfd_elf_get_elf_syms (bfd1, hdr1, symcount1, 0, - NULL, NULL, NULL); - isymbuf2 = bfd_elf_get_elf_syms (bfd2, hdr2, symcount2, 0, - NULL, NULL, NULL); - result = FALSE; - if (isymbuf1 == NULL || isymbuf2 == NULL) - goto done; + isymbuf1 = NULL; + isymbuf2 = NULL; + ssymbuf1 = elf_tdata (bfd1)->symbuf; + ssymbuf2 = elf_tdata (bfd2)->symbuf; - /* Sort symbols by binding and section. Global definitions are at - the beginning. */ - qsort (isymbuf1, symcount1, sizeof (Elf_Internal_Sym), - elf_sort_elf_symbol); - qsort (isymbuf2, symcount2, sizeof (Elf_Internal_Sym), - elf_sort_elf_symbol); + if (ssymbuf1 == NULL) + { + isymbuf1 = bfd_elf_get_elf_syms (bfd1, hdr1, symcount1, 0, + NULL, NULL, NULL); + if (isymbuf1 == NULL) + goto done; - /* Count definitions in the section. */ - count1 = 0; - for (isym = isymbuf1, isymend = isym + symcount1; - isym < isymend; isym++) + if (!info->reduce_memory_overheads) + elf_tdata (bfd1)->symbuf = ssymbuf1 + = elf_create_symbuf (symcount1, isymbuf1); + } + + if (ssymbuf1 == NULL || ssymbuf2 == NULL) { - if (isym->st_shndx == (unsigned int) shndx1) - { - if (count1 == 0) - isymstart1 = isym; - count1++; - } + isymbuf2 = bfd_elf_get_elf_syms (bfd2, hdr2, symcount2, 0, + NULL, NULL, NULL); + if (isymbuf2 == NULL) + goto done; - if (count1 && isym->st_shndx != (unsigned int) shndx1) - break; + if (ssymbuf1 != NULL && !info->reduce_memory_overheads) + elf_tdata (bfd2)->symbuf = ssymbuf2 + = elf_create_symbuf (symcount2, isymbuf2); } - count2 = 0; - for (isym = isymbuf2, isymend = isym + symcount2; - isym < isymend; isym++) + if (ssymbuf1 != NULL && ssymbuf2 != NULL) { - if (isym->st_shndx == (unsigned int) shndx2) + /* Optimized faster version. */ + bfd_size_type lo, hi, mid; + struct elf_symbol *symp; + struct elf_symbuf_symbol *ssym, *ssymend; + + lo = 0; + hi = ssymbuf1->count; + ssymbuf1++; + count1 = 0; + while (lo < hi) { - if (count2 == 0) - isymstart2 = isym; - count2++; + mid = (lo + hi) / 2; + if ((unsigned int) shndx1 < ssymbuf1[mid].st_shndx) + hi = mid; + else if ((unsigned int) shndx1 > ssymbuf1[mid].st_shndx) + lo = mid + 1; + else + { + count1 = ssymbuf1[mid].count; + ssymbuf1 += mid; + break; + } } - if (count2 && isym->st_shndx != (unsigned int) shndx2) - break; + lo = 0; + hi = ssymbuf2->count; + ssymbuf2++; + count2 = 0; + while (lo < hi) + { + mid = (lo + hi) / 2; + if ((unsigned int) shndx2 < ssymbuf2[mid].st_shndx) + hi = mid; + else if ((unsigned int) shndx2 > ssymbuf2[mid].st_shndx) + lo = mid + 1; + else + { + count2 = ssymbuf2[mid].count; + ssymbuf2 += mid; + break; + } + } + + if (count1 == 0 || count2 == 0 || count1 != count2) + goto done; + + symtable1 = bfd_malloc (count1 * sizeof (struct elf_symbol)); + symtable2 = bfd_malloc (count2 * sizeof (struct elf_symbol)); + if (symtable1 == NULL || symtable2 == NULL) + goto done; + + symp = symtable1; + for (ssym = ssymbuf1->ssym, ssymend = ssym + count1; + ssym < ssymend; ssym++, symp++) + { + symp->u.ssym = ssym; + symp->name = bfd_elf_string_from_elf_section (bfd1, + hdr1->sh_link, + ssym->st_name); + } + + symp = symtable2; + for (ssym = ssymbuf2->ssym, ssymend = ssym + count2; + ssym < ssymend; ssym++, symp++) + { + symp->u.ssym = ssym; + symp->name = bfd_elf_string_from_elf_section (bfd2, + hdr2->sh_link, + ssym->st_name); + } + + /* Sort symbol by name. */ + qsort (symtable1, count1, sizeof (struct elf_symbol), + elf_sym_name_compare); + qsort (symtable2, count1, sizeof (struct elf_symbol), + elf_sym_name_compare); + + for (i = 0; i < count1; i++) + /* Two symbols must have the same binding, type and name. */ + if (symtable1 [i].u.ssym->st_info != symtable2 [i].u.ssym->st_info + || symtable1 [i].u.ssym->st_other != symtable2 [i].u.ssym->st_other + || strcmp (symtable1 [i].name, symtable2 [i].name) != 0) + goto done; + + result = TRUE; + goto done; } - if (count1 == 0 || count2 == 0 || count1 != count2) + symtable1 = bfd_malloc (symcount1 * sizeof (struct elf_symbol)); + symtable2 = bfd_malloc (symcount2 * sizeof (struct elf_symbol)); + if (symtable1 == NULL || symtable2 == NULL) goto done; - symtable1 = bfd_malloc (count1 * sizeof (struct elf_symbol)); - symtable2 = bfd_malloc (count1 * sizeof (struct elf_symbol)); + /* Count definitions in the section. */ + count1 = 0; + for (isym = isymbuf1, isymend = isym + symcount1; isym < isymend; isym++) + if (isym->st_shndx == (unsigned int) shndx1) + symtable1[count1++].u.isym = isym; - if (symtable1 == NULL || symtable2 == NULL) + count2 = 0; + for (isym = isymbuf2, isymend = isym + symcount2; isym < isymend; isym++) + if (isym->st_shndx == (unsigned int) shndx2) + symtable2[count2++].u.isym = isym; + + if (count1 == 0 || count2 == 0 || count1 != count2) goto done; - symp = symtable1; - for (isym = isymstart1, isymend = isym + count1; - isym < isymend; isym++) - { - symp->sym = isym; - symp->name = bfd_elf_string_from_elf_section (bfd1, - hdr1->sh_link, - isym->st_name); - symp++; - } - - symp = symtable2; - for (isym = isymstart2, isymend = isym + count1; - isym < isymend; isym++) - { - symp->sym = isym; - symp->name = bfd_elf_string_from_elf_section (bfd2, - hdr2->sh_link, - isym->st_name); - symp++; - } - + for (i = 0; i < count1; i++) + symtable1[i].name + = bfd_elf_string_from_elf_section (bfd1, hdr1->sh_link, + symtable1[i].u.isym->st_name); + + for (i = 0; i < count2; i++) + symtable2[i].name + = bfd_elf_string_from_elf_section (bfd2, hdr2->sh_link, + symtable2[i].u.isym->st_name); + /* Sort symbol by name. */ qsort (symtable1, count1, sizeof (struct elf_symbol), elf_sym_name_compare); @@ -8705,8 +9140,8 @@ bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2) for (i = 0; i < count1; i++) /* Two symbols must have the same binding, type and name. */ - if (symtable1 [i].sym->st_info != symtable2 [i].sym->st_info - || symtable1 [i].sym->st_other != symtable2 [i].sym->st_other + if (symtable1 [i].u.isym->st_info != symtable2 [i].u.isym->st_info + || symtable1 [i].u.isym->st_other != symtable2 [i].u.isym->st_other || strcmp (symtable1 [i].name, symtable2 [i].name) != 0) goto done; @@ -8728,8 +9163,7 @@ done: /* It is only used by x86-64 so far. */ asection _bfd_elf_large_com_section = BFD_FAKE_SECTION (_bfd_elf_large_com_section, - SEC_IS_COMMON, NULL, NULL, "LARGE_COMMON", - 0); + SEC_IS_COMMON, NULL, "LARGE_COMMON", 0); /* Return TRUE if 2 section types are compatible. */ @@ -8745,3 +9179,25 @@ _bfd_elf_match_sections_by_type (bfd *abfd, const asection *asec, return elf_section_type (asec) == elf_section_type (bsec); } + +void +_bfd_elf_set_osabi (bfd * abfd, + struct bfd_link_info * link_info ATTRIBUTE_UNUSED) +{ + Elf_Internal_Ehdr * i_ehdrp; /* ELF file header, internal form. */ + + i_ehdrp = elf_elfheader (abfd); + + i_ehdrp->e_ident[EI_OSABI] = get_elf_backend_data (abfd)->elf_osabi; +} + + +/* Return TRUE for ELF symbol types that represent functions. + This is the default version of this function, which is sufficient for + most targets. It returns true if TYPE is STT_FUNC. */ + +bfd_boolean +_bfd_elf_is_function_type (unsigned int type) +{ + return (type == STT_FUNC); +} diff --git a/contrib/binutils/bfd/elf32-arc.c b/contrib/binutils/bfd/elf32-arc.c index a6011bdb32dd..58d63010783f 100644 --- a/contrib/binutils/bfd/elf32-arc.c +++ b/contrib/binutils/bfd/elf32-arc.c @@ -1,5 +1,5 @@ /* ARC-specific support for 32-bit ELF - Copyright 1994, 1995, 1997, 1999, 2001, 2002, 2005 + Copyright 1994, 1995, 1997, 1999, 2001, 2002, 2005, 2007 Free Software Foundation, Inc. Contributed by Doug Evans (dje@cygnus.com). @@ -20,8 +20,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "elf-bfd.h" #include "elf/arc.h" @@ -147,6 +147,22 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return NULL; } +static reloc_howto_type * +bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (elf_arc_howto_table) / sizeof (elf_arc_howto_table[0]); + i++) + if (elf_arc_howto_table[i].name != NULL + && strcasecmp (elf_arc_howto_table[i].name, r_name) == 0) + return &elf_arc_howto_table[i]; + + return NULL; +} + /* Set the howto pointer for an ARC ELF reloc. */ static void diff --git a/contrib/binutils/bfd/elf32-arm.c b/contrib/binutils/bfd/elf32-arm.c index 4c65de1663a2..8e1caa8be7a3 100644 --- a/contrib/binutils/bfd/elf32-arm.c +++ b/contrib/binutils/bfd/elf32-arm.c @@ -1,5 +1,5 @@ /* 32-bit ELF support for ARM - Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,8 +18,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libiberty.h" #include "libbfd.h" #include "elf-bfd.h" @@ -66,7 +66,7 @@ #define ARM_ELF_OS_ABI_VERSION ELFOSABI_ARM #endif -static const struct elf_backend_data elf32_arm_vxworks_bed; +static struct elf_backend_data elf32_arm_vxworks_bed; /* Note: code such as elf32_arm_reloc_type_lookup expect to use e.g. R_ARM_PC24 as an index into this, and find the R_ARM_PC24 HOWTO @@ -134,19 +134,19 @@ static reloc_howto_type elf32_arm_howto_table_1[] = TRUE), /* pcrel_offset */ /* 8 bit absolute - R_ARM_LDR_PC_G0 in AAELF */ - HOWTO (R_ARM_PC13, /* type */ + HOWTO (R_ARM_LDR_PC_G0, /* type */ 0, /* rightshift */ 0, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - FALSE, /* pc_relative */ + 32, /* bitsize */ + TRUE, /* pc_relative */ 0, /* bitpos */ - complain_overflow_bitfield,/* complain_on_overflow */ + complain_overflow_dont,/* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ - "R_ARM_PC13", /* name */ + "R_ARM_LDR_PC_G0", /* name */ FALSE, /* partial_inplace */ - 0x000000ff, /* src_mask */ - 0x000000ff, /* dst_mask */ - FALSE), /* pcrel_offset */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ /* 16 bit absolute */ HOWTO (R_ARM_ABS16, /* type */ @@ -221,11 +221,10 @@ static reloc_howto_type elf32_arm_howto_table_1[] = 0xffffffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* FIXME: Has two more bits of offset in Thumb32. */ HOWTO (R_ARM_THM_CALL, /* type */ 1, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ - 23, /* bitsize */ + 25, /* bitsize */ TRUE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed,/* complain_on_overflow */ @@ -839,12 +838,12 @@ static reloc_howto_type elf32_arm_howto_table_1[] = 13, /* bitsize */ TRUE, /* pc_relative */ 0, /* bitpos */ - complain_overflow_signed,/* complain_on_overflow */ + complain_overflow_dont,/* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_ARM_THM_ALU_PREL_11_0",/* name */ FALSE, /* partial_inplace */ - 0x040070ff, /* src_mask */ - 0x040070ff, /* dst_mask */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ TRUE), /* pcrel_offset */ HOWTO (R_ARM_THM_PC12, /* type */ @@ -853,12 +852,12 @@ static reloc_howto_type elf32_arm_howto_table_1[] = 13, /* bitsize */ TRUE, /* pc_relative */ 0, /* bitpos */ - complain_overflow_signed,/* complain_on_overflow */ + complain_overflow_dont,/* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_ARM_THM_PC12", /* name */ FALSE, /* partial_inplace */ - 0x040070ff, /* src_mask */ - 0x040070ff, /* dst_mask */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ TRUE), /* pcrel_offset */ HOWTO (R_ARM_ABS32_NOI, /* type */ @@ -888,13 +887,389 @@ static reloc_howto_type elf32_arm_howto_table_1[] = 0xffffffff, /* src_mask */ 0xffffffff, /* dst_mask */ FALSE), /* pcrel_offset */ -}; -/* Relocations 57 .. 83 are the "group relocations" which we do not - support. */ + /* Group relocations. */ + + HOWTO (R_ARM_ALU_PC_G0_NC, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_ALU_PC_G0_NC", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_ALU_PC_G0, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_ALU_PC_G0", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_ALU_PC_G1_NC, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_ALU_PC_G1_NC", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_ALU_PC_G1, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_ALU_PC_G1", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_ALU_PC_G2, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_ALU_PC_G2", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_LDR_PC_G1, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_LDR_PC_G1", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_LDR_PC_G2, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_LDR_PC_G2", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_LDRS_PC_G0, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_LDRS_PC_G0", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_LDRS_PC_G1, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_LDRS_PC_G1", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_LDRS_PC_G2, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_LDRS_PC_G2", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_LDC_PC_G0, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_LDC_PC_G0", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_LDC_PC_G1, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_LDC_PC_G1", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_LDC_PC_G2, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_LDC_PC_G2", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_ALU_SB_G0_NC, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_ALU_SB_G0_NC", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_ALU_SB_G0, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_ALU_SB_G0", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_ALU_SB_G1_NC, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_ALU_SB_G1_NC", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_ALU_SB_G1, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_ALU_SB_G1", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_ALU_SB_G2, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_ALU_SB_G2", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_LDR_SB_G0, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_LDR_SB_G0", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_LDR_SB_G1, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_LDR_SB_G1", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_LDR_SB_G2, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_LDR_SB_G2", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_LDRS_SB_G0, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_LDRS_SB_G0", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_LDRS_SB_G1, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_LDRS_SB_G1", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_LDRS_SB_G2, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_LDRS_SB_G2", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_LDC_SB_G0, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_LDC_SB_G0", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_LDC_SB_G1, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_LDC_SB_G1", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_LDC_SB_G2, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_LDC_SB_G2", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* End of group relocations. */ -static reloc_howto_type elf32_arm_howto_table_2[] = -{ HOWTO (R_ARM_MOVW_BREL_NC, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -1234,7 +1609,7 @@ static reloc_howto_type elf32_arm_howto_table_2[] = 249-255 extended, currently unused, relocations: */ -static reloc_howto_type elf32_arm_howto_table_3[4] = +static reloc_howto_type elf32_arm_howto_table_2[4] = { HOWTO (R_ARM_RREL32, /* type */ 0, /* rightshift */ @@ -1299,13 +1674,9 @@ elf32_arm_howto_from_type (unsigned int r_type) if (r_type < NUM_ELEM (elf32_arm_howto_table_1)) return &elf32_arm_howto_table_1[r_type]; - if (r_type >= R_ARM_MOVW_BREL_NC - && r_type < R_ARM_MOVW_BREL_NC + NUM_ELEM (elf32_arm_howto_table_2)) - return &elf32_arm_howto_table_2[r_type - R_ARM_MOVW_BREL_NC]; - if (r_type >= R_ARM_RREL32 && r_type < R_ARM_RREL32 + NUM_ELEM (elf32_arm_howto_table_2)) - return &elf32_arm_howto_table_3[r_type - R_ARM_RREL32]; + return &elf32_arm_howto_table_2[r_type - R_ARM_RREL32]; return NULL; } @@ -1370,6 +1741,42 @@ static const struct elf32_arm_reloc_map elf32_arm_reloc_map[] = {BFD_RELOC_ARM_TLS_LE32, R_ARM_TLS_LE32}, {BFD_RELOC_VTABLE_INHERIT, R_ARM_GNU_VTINHERIT}, {BFD_RELOC_VTABLE_ENTRY, R_ARM_GNU_VTENTRY}, + {BFD_RELOC_ARM_MOVW, R_ARM_MOVW_ABS_NC}, + {BFD_RELOC_ARM_MOVT, R_ARM_MOVT_ABS}, + {BFD_RELOC_ARM_MOVW_PCREL, R_ARM_MOVW_PREL_NC}, + {BFD_RELOC_ARM_MOVT_PCREL, R_ARM_MOVT_PREL}, + {BFD_RELOC_ARM_THUMB_MOVW, R_ARM_THM_MOVW_ABS_NC}, + {BFD_RELOC_ARM_THUMB_MOVT, R_ARM_THM_MOVT_ABS}, + {BFD_RELOC_ARM_THUMB_MOVW_PCREL, R_ARM_THM_MOVW_PREL_NC}, + {BFD_RELOC_ARM_THUMB_MOVT_PCREL, R_ARM_THM_MOVT_PREL}, + {BFD_RELOC_ARM_ALU_PC_G0_NC, R_ARM_ALU_PC_G0_NC}, + {BFD_RELOC_ARM_ALU_PC_G0, R_ARM_ALU_PC_G0}, + {BFD_RELOC_ARM_ALU_PC_G1_NC, R_ARM_ALU_PC_G1_NC}, + {BFD_RELOC_ARM_ALU_PC_G1, R_ARM_ALU_PC_G1}, + {BFD_RELOC_ARM_ALU_PC_G2, R_ARM_ALU_PC_G2}, + {BFD_RELOC_ARM_LDR_PC_G0, R_ARM_LDR_PC_G0}, + {BFD_RELOC_ARM_LDR_PC_G1, R_ARM_LDR_PC_G1}, + {BFD_RELOC_ARM_LDR_PC_G2, R_ARM_LDR_PC_G2}, + {BFD_RELOC_ARM_LDRS_PC_G0, R_ARM_LDRS_PC_G0}, + {BFD_RELOC_ARM_LDRS_PC_G1, R_ARM_LDRS_PC_G1}, + {BFD_RELOC_ARM_LDRS_PC_G2, R_ARM_LDRS_PC_G2}, + {BFD_RELOC_ARM_LDC_PC_G0, R_ARM_LDC_PC_G0}, + {BFD_RELOC_ARM_LDC_PC_G1, R_ARM_LDC_PC_G1}, + {BFD_RELOC_ARM_LDC_PC_G2, R_ARM_LDC_PC_G2}, + {BFD_RELOC_ARM_ALU_SB_G0_NC, R_ARM_ALU_SB_G0_NC}, + {BFD_RELOC_ARM_ALU_SB_G0, R_ARM_ALU_SB_G0}, + {BFD_RELOC_ARM_ALU_SB_G1_NC, R_ARM_ALU_SB_G1_NC}, + {BFD_RELOC_ARM_ALU_SB_G1, R_ARM_ALU_SB_G1}, + {BFD_RELOC_ARM_ALU_SB_G2, R_ARM_ALU_SB_G2}, + {BFD_RELOC_ARM_LDR_SB_G0, R_ARM_LDR_SB_G0}, + {BFD_RELOC_ARM_LDR_SB_G1, R_ARM_LDR_SB_G1}, + {BFD_RELOC_ARM_LDR_SB_G2, R_ARM_LDR_SB_G2}, + {BFD_RELOC_ARM_LDRS_SB_G0, R_ARM_LDRS_SB_G0}, + {BFD_RELOC_ARM_LDRS_SB_G1, R_ARM_LDRS_SB_G1}, + {BFD_RELOC_ARM_LDRS_SB_G2, R_ARM_LDRS_SB_G2}, + {BFD_RELOC_ARM_LDC_SB_G0, R_ARM_LDC_SB_G0}, + {BFD_RELOC_ARM_LDC_SB_G1, R_ARM_LDC_SB_G1}, + {BFD_RELOC_ARM_LDC_SB_G2, R_ARM_LDC_SB_G2} }; static reloc_howto_type * @@ -1384,6 +1791,31 @@ elf32_arm_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return NULL; } +static reloc_howto_type * +elf32_arm_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (elf32_arm_howto_table_1) + / sizeof (elf32_arm_howto_table_1[0])); + i++) + if (elf32_arm_howto_table_1[i].name != NULL + && strcasecmp (elf32_arm_howto_table_1[i].name, r_name) == 0) + return &elf32_arm_howto_table_1[i]; + + for (i = 0; + i < (sizeof (elf32_arm_howto_table_2) + / sizeof (elf32_arm_howto_table_2[0])); + i++) + if (elf32_arm_howto_table_2[i].name != NULL + && strcasecmp (elf32_arm_howto_table_2[i].name, r_name) == 0) + return &elf32_arm_howto_table_2[i]; + + return NULL; +} + /* Support for core dump NOTE sections */ static bfd_boolean elf32_arm_nabi_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) @@ -1485,6 +1917,9 @@ typedef unsigned short int insn16; #define ARM2THUMB_GLUE_SECTION_NAME ".glue_7" #define ARM2THUMB_GLUE_ENTRY_NAME "__%s_from_arm" +#define VFP11_ERRATUM_VENEER_SECTION_NAME ".vfp11_veneer" +#define VFP11_ERRATUM_VENEER_ENTRY_NAME "__vfp11_veneer_%x" + /* The name of the dynamic interpreter. This is put in the .interp section. */ #define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" @@ -1597,11 +2032,46 @@ typedef struct elf32_elf_section_map } elf32_arm_section_map; +/* Information about a VFP11 erratum veneer, or a branch to such a veneer. */ + +typedef enum +{ + VFP11_ERRATUM_BRANCH_TO_ARM_VENEER, + VFP11_ERRATUM_BRANCH_TO_THUMB_VENEER, + VFP11_ERRATUM_ARM_VENEER, + VFP11_ERRATUM_THUMB_VENEER +} +elf32_vfp11_erratum_type; + +typedef struct elf32_vfp11_erratum_list +{ + struct elf32_vfp11_erratum_list *next; + bfd_vma vma; + union + { + struct + { + struct elf32_vfp11_erratum_list *veneer; + unsigned int vfp_insn; + } b; + struct + { + struct elf32_vfp11_erratum_list *branch; + unsigned int id; + } v; + } u; + elf32_vfp11_erratum_type type; +} +elf32_vfp11_erratum_list; + typedef struct _arm_elf_section_data { struct bfd_elf_section_data elf; unsigned int mapcount; + unsigned int mapsize; elf32_arm_section_map *map; + unsigned int erratumcount; + elf32_vfp11_erratum_list *erratumlist; } _arm_elf_section_data; @@ -1611,22 +2081,6 @@ _arm_elf_section_data; /* The size of the thread control block. */ #define TCB_SIZE 8 -#define NUM_KNOWN_ATTRIBUTES 32 - -typedef struct aeabi_attribute -{ - int type; - unsigned int i; - char *s; -} aeabi_attribute; - -typedef struct aeabi_attribute_list -{ - struct aeabi_attribute_list *next; - int tag; - aeabi_attribute attr; -} aeabi_attribute_list; - struct elf32_arm_obj_tdata { struct elf_obj_tdata root; @@ -1634,8 +2088,8 @@ struct elf32_arm_obj_tdata /* tls_type for each local got entry. */ char *local_got_tls_type; - aeabi_attribute known_eabi_attributes[NUM_KNOWN_ATTRIBUTES]; - aeabi_attribute_list *other_eabi_attributes; + /* Zero to warn when linking objects with incompatible enum sizes. */ + int no_enum_size_warning; }; #define elf32_arm_tdata(abfd) \ @@ -1647,11 +2101,14 @@ struct elf32_arm_obj_tdata static bfd_boolean elf32_arm_mkobject (bfd *abfd) { - bfd_size_type amt = sizeof (struct elf32_arm_obj_tdata); - abfd->tdata.any = bfd_zalloc (abfd, amt); if (abfd->tdata.any == NULL) - return FALSE; - return TRUE; + { + bfd_size_type amt = sizeof (struct elf32_arm_obj_tdata); + abfd->tdata.any = bfd_zalloc (abfd, amt); + if (abfd->tdata.any == NULL) + return FALSE; + } + return bfd_elf_mkobject (abfd); } /* The ARM linker needs to keep track of the number of relocs that it @@ -1698,6 +2155,10 @@ struct elf32_arm_link_hash_entry #define GOT_TLS_GD 2 #define GOT_TLS_IE 4 unsigned char tls_type; + + /* The symbol marking the real symbol location for exported thumb + symbols with Arm stubs. */ + struct elf_link_hash_entry *export_glue; }; /* Traverse an arm ELF linker hash table. */ @@ -1723,6 +2184,10 @@ struct elf32_arm_link_hash_table /* The size in bytes of the section containing the ARM-to-Thumb glue. */ bfd_size_type arm_glue_size; + /* The size in bytes of the section containing glue for VFP11 erratum + veneers. */ + bfd_size_type vfp11_erratum_glue_size; + /* An arbitrary input BFD chosen to hold the glue sections. */ bfd * bfd_of_glue_owner; @@ -1730,7 +2195,7 @@ struct elf32_arm_link_hash_table int byteswap_code; /* Zero if R_ARM_TARGET1 means R_ARM_ABS32. - Nonzero if R_ARM_TARGET1 means R_ARM_ABS32. */ + Nonzero if R_ARM_TARGET1 means R_ARM_REL32. */ int target1_is_rel; /* The relocation to use for R_ARM_TARGET2 relocations. */ @@ -1742,6 +2207,16 @@ struct elf32_arm_link_hash_table /* Nonzero if the ARM/Thumb BLX instructions are available for use. */ int use_blx; + /* What sort of code sequences we should look for which may trigger the + VFP11 denorm erratum. */ + bfd_arm_vfp11_fix vfp11_fix; + + /* Global counter for the number of fixes we have emitted. */ + int num_vfp11_fixes; + + /* Nonzero to force PIC branch veneers. */ + int pic_veneer; + /* The number of bytes in the initial entry in the PLT. */ bfd_size_type plt_header_size; @@ -1809,6 +2284,7 @@ elf32_arm_link_hash_newfunc (struct bfd_hash_entry * entry, ret->tls_type = GOT_UNKNOWN; ret->plt_thumb_refcount = 0; ret->plt_got_offset = -1; + ret->export_glue = NULL; } return (struct bfd_hash_entry *) ret; @@ -1822,9 +2298,9 @@ reloc_section_p (struct elf32_arm_link_hash_table *htab, const char *name, asection *s) { if (htab->use_rel) - return strncmp (name, ".rel", 4) == 0 && strcmp (s->name, name + 4) == 0; + return CONST_STRNEQ (name, ".rel") && strcmp (s->name, name + 4) == 0; else - return strncmp (name, ".rela", 5) == 0 && strcmp (s->name, name + 5) == 0; + return CONST_STRNEQ (name, ".rela") && strcmp (s->name, name + 5) == 0; } /* Create .got, .gotplt, and .rel(a).got sections in DYNOBJ, and set up @@ -1957,15 +2433,17 @@ elf32_arm_copy_indirect_symbol (struct bfd_link_info *info, eind->relocs_copied = NULL; } - /* Copy over PLT info. */ - edir->plt_thumb_refcount += eind->plt_thumb_refcount; - eind->plt_thumb_refcount = 0; - - if (ind->root.type == bfd_link_hash_indirect - && dir->got.refcount <= 0) + if (ind->root.type == bfd_link_hash_indirect) { - edir->tls_type = eind->tls_type; - eind->tls_type = GOT_UNKNOWN; + /* Copy over PLT info. */ + edir->plt_thumb_refcount += eind->plt_thumb_refcount; + eind->plt_thumb_refcount = 0; + + if (dir->got.refcount <= 0) + { + edir->tls_type = eind->tls_type; + eind->tls_type = GOT_UNKNOWN; + } } _bfd_elf_link_hash_copy_indirect (info, dir, ind); @@ -2001,6 +2479,9 @@ elf32_arm_link_hash_table_create (bfd *abfd) ret->srelplt2 = NULL; ret->thumb_glue_size = 0; ret->arm_glue_size = 0; + ret->vfp11_fix = BFD_ARM_VFP11_FIX_NONE; + ret->vfp11_erratum_glue_size = 0; + ret->num_vfp11_fixes = 0; ret->bfd_of_glue_owner = NULL; ret->byteswap_code = 0; ret->target1_is_rel = 0; @@ -2029,7 +2510,7 @@ elf32_arm_link_hash_table_create (bfd *abfd) static struct elf_link_hash_entry * find_thumb_glue (struct bfd_link_info *link_info, const char *name, - bfd *input_bfd) + char **error_message) { char *tmp_name; struct elf_link_hash_entry *hash; @@ -2049,9 +2530,8 @@ find_thumb_glue (struct bfd_link_info *link_info, (&(hash_table)->root, tmp_name, FALSE, FALSE, TRUE); if (hash == NULL) - /* xgettext:c-format */ - (*_bfd_error_handler) (_("%B: unable to find THUMB glue '%s' for `%s'"), - input_bfd, tmp_name, name); + asprintf (error_message, _("unable to find THUMB glue '%s' for '%s'"), + tmp_name, name); free (tmp_name); @@ -2063,7 +2543,7 @@ find_thumb_glue (struct bfd_link_info *link_info, static struct elf_link_hash_entry * find_arm_glue (struct bfd_link_info *link_info, const char *name, - bfd *input_bfd) + char **error_message) { char *tmp_name; struct elf_link_hash_entry *myh; @@ -2083,9 +2563,8 @@ find_arm_glue (struct bfd_link_info *link_info, (&(hash_table)->root, tmp_name, FALSE, FALSE, TRUE); if (myh == NULL) - /* xgettext:c-format */ - (*_bfd_error_handler) (_("%B: unable to find ARM glue '%s' for `%s'"), - input_bfd, tmp_name, name); + asprintf (error_message, _("unable to find ARM glue '%s' for '%s'"), + tmp_name, name); free (tmp_name); @@ -2101,6 +2580,13 @@ find_arm_glue (struct bfd_link_info *link_info, __func_addr: .word func @ behave as if you saw a ARM_32 reloc. + (v5t static images) + .arm + __func_from_arm: + ldr pc, __func_addr + __func_addr: + .word func @ behave as if you saw a ARM_32 reloc. + (relocatable images) .arm __func_from_arm: @@ -2116,6 +2602,10 @@ static const insn32 a2t1_ldr_insn = 0xe59fc000; static const insn32 a2t2_bx_r12_insn = 0xe12fff1c; static const insn32 a2t3_func_addr_insn = 0x00000001; +#define ARM2THUMB_V5_STATIC_GLUE_SIZE 8 +static const insn32 a2t1v5_ldr_insn = 0xe51ff004; +static const insn32 a2t2v5_func_addr_insn = 0x00000001; + #define ARM2THUMB_PIC_GLUE_SIZE 16 static const insn32 a2t1p_ldr_insn = 0xe59fc004; static const insn32 a2t2p_add_pc_insn = 0xe08cc00f; @@ -2142,6 +2632,8 @@ static const insn16 t2a1_bx_pc_insn = 0x4778; static const insn16 t2a2_noop_insn = 0x46c0; static const insn32 t2a3_b_insn = 0xea000000; +#define VFP11_ERRATUM_VENEER_SIZE 8 + #ifndef ELFARM_NABI_C_INCLUDED bfd_boolean bfd_elf32_arm_allocate_interworking_sections (struct bfd_link_info * info) @@ -2165,7 +2657,7 @@ bfd_elf32_arm_allocate_interworking_sections (struct bfd_link_info * info) foo = bfd_alloc (globals->bfd_of_glue_owner, globals->arm_glue_size); - s->size = globals->arm_glue_size; + BFD_ASSERT (s->size == globals->arm_glue_size); s->contents = foo; } @@ -2180,14 +2672,32 @@ bfd_elf32_arm_allocate_interworking_sections (struct bfd_link_info * info) foo = bfd_alloc (globals->bfd_of_glue_owner, globals->thumb_glue_size); - s->size = globals->thumb_glue_size; + BFD_ASSERT (s->size == globals->thumb_glue_size); + s->contents = foo; + } + + if (globals->vfp11_erratum_glue_size != 0) + { + BFD_ASSERT (globals->bfd_of_glue_owner != NULL); + + s = bfd_get_section_by_name + (globals->bfd_of_glue_owner, VFP11_ERRATUM_VENEER_SECTION_NAME); + + BFD_ASSERT (s != NULL); + + foo = bfd_alloc (globals->bfd_of_glue_owner, + globals->vfp11_erratum_glue_size); + + BFD_ASSERT (s->size == globals->vfp11_erratum_glue_size); s->contents = foo; } return TRUE; } -static void +/* Allocate space and symbols for calling a Thumb function from Arm mode. + returns the symbol identifying teh stub. */ +static struct elf_link_hash_entry * record_arm_to_thumb_glue (struct bfd_link_info * link_info, struct elf_link_hash_entry * h) { @@ -2198,6 +2708,7 @@ record_arm_to_thumb_glue (struct bfd_link_info * link_info, struct bfd_link_hash_entry * bh; struct elf32_arm_link_hash_table * globals; bfd_vma val; + bfd_size_type size; globals = elf32_arm_hash_table (link_info); @@ -2222,7 +2733,7 @@ record_arm_to_thumb_glue (struct bfd_link_info * link_info, { /* We've already seen this guy. */ free (tmp_name); - return; + return myh; } /* The only trick here is using hash_table->arm_glue_size as the value. @@ -2240,12 +2751,18 @@ record_arm_to_thumb_glue (struct bfd_link_info * link_info, free (tmp_name); - if ((link_info->shared || globals->root.is_relocatable_executable)) - globals->arm_glue_size += ARM2THUMB_PIC_GLUE_SIZE; + if (link_info->shared || globals->root.is_relocatable_executable + || globals->pic_veneer) + size = ARM2THUMB_PIC_GLUE_SIZE; + else if (globals->use_blx) + size = ARM2THUMB_V5_STATIC_GLUE_SIZE; else - globals->arm_glue_size += ARM2THUMB_STATIC_GLUE_SIZE; + size = ARM2THUMB_STATIC_GLUE_SIZE; - return; + s->size += size; + globals->arm_glue_size += size; + + return myh; } static void @@ -2319,11 +2836,162 @@ record_thumb_to_arm_glue (struct bfd_link_info *link_info, free (tmp_name); + s->size += THUMB2ARM_GLUE_SIZE; hash_table->thumb_glue_size += THUMB2ARM_GLUE_SIZE; return; } + +/* Add an entry to the code/data map for section SEC. */ + +static void +elf32_arm_section_map_add (asection *sec, char type, bfd_vma vma) +{ + struct _arm_elf_section_data *sec_data = elf32_arm_section_data (sec); + unsigned int newidx; + + if (sec_data->map == NULL) + { + sec_data->map = bfd_malloc (sizeof (elf32_arm_section_map)); + sec_data->mapcount = 0; + sec_data->mapsize = 1; + } + + newidx = sec_data->mapcount++; + + if (sec_data->mapcount > sec_data->mapsize) + { + sec_data->mapsize *= 2; + sec_data->map = bfd_realloc (sec_data->map, sec_data->mapsize + * sizeof (elf32_arm_section_map)); + } + + sec_data->map[newidx].vma = vma; + sec_data->map[newidx].type = type; +} + + +/* Record information about a VFP11 denorm-erratum veneer. Only ARM-mode + veneers are handled for now. */ + +static bfd_vma +record_vfp11_erratum_veneer (struct bfd_link_info *link_info, + elf32_vfp11_erratum_list *branch, + bfd *branch_bfd, + asection *branch_sec, + unsigned int offset) +{ + asection *s; + struct elf32_arm_link_hash_table *hash_table; + char *tmp_name; + struct elf_link_hash_entry *myh; + struct bfd_link_hash_entry *bh; + bfd_vma val; + struct _arm_elf_section_data *sec_data; + int errcount; + elf32_vfp11_erratum_list *newerr; + + hash_table = elf32_arm_hash_table (link_info); + + BFD_ASSERT (hash_table != NULL); + BFD_ASSERT (hash_table->bfd_of_glue_owner != NULL); + + s = bfd_get_section_by_name + (hash_table->bfd_of_glue_owner, VFP11_ERRATUM_VENEER_SECTION_NAME); + + sec_data = elf32_arm_section_data (s); + + BFD_ASSERT (s != NULL); + + tmp_name = bfd_malloc ((bfd_size_type) strlen + (VFP11_ERRATUM_VENEER_ENTRY_NAME) + 10); + + BFD_ASSERT (tmp_name); + + sprintf (tmp_name, VFP11_ERRATUM_VENEER_ENTRY_NAME, + hash_table->num_vfp11_fixes); + + myh = elf_link_hash_lookup + (&(hash_table)->root, tmp_name, FALSE, FALSE, FALSE); + + BFD_ASSERT (myh == NULL); + + bh = NULL; + val = hash_table->vfp11_erratum_glue_size; + _bfd_generic_link_add_one_symbol (link_info, hash_table->bfd_of_glue_owner, + tmp_name, BSF_FUNCTION | BSF_LOCAL, s, val, + NULL, TRUE, FALSE, &bh); + + myh = (struct elf_link_hash_entry *) bh; + myh->type = ELF_ST_INFO (STB_LOCAL, STT_FUNC); + myh->forced_local = 1; + + /* Link veneer back to calling location. */ + errcount = ++(sec_data->erratumcount); + newerr = bfd_zmalloc (sizeof (elf32_vfp11_erratum_list)); + + newerr->type = VFP11_ERRATUM_ARM_VENEER; + newerr->vma = -1; + newerr->u.v.branch = branch; + newerr->u.v.id = hash_table->num_vfp11_fixes; + branch->u.b.veneer = newerr; + + newerr->next = sec_data->erratumlist; + sec_data->erratumlist = newerr; + + /* A symbol for the return from the veneer. */ + sprintf (tmp_name, VFP11_ERRATUM_VENEER_ENTRY_NAME "_r", + hash_table->num_vfp11_fixes); + + myh = elf_link_hash_lookup + (&(hash_table)->root, tmp_name, FALSE, FALSE, FALSE); + + if (myh != NULL) + abort (); + + bh = NULL; + val = offset + 4; + _bfd_generic_link_add_one_symbol (link_info, branch_bfd, tmp_name, BSF_LOCAL, + branch_sec, val, NULL, TRUE, FALSE, &bh); + + myh = (struct elf_link_hash_entry *) bh; + myh->type = ELF_ST_INFO (STB_LOCAL, STT_FUNC); + myh->forced_local = 1; + + free (tmp_name); + + /* Generate a mapping symbol for the veneer section, and explicitly add an + entry for that symbol to the code/data map for the section. */ + if (hash_table->vfp11_erratum_glue_size == 0) + { + bh = NULL; + /* FIXME: Creates an ARM symbol. Thumb mode will need attention if it + ever requires this erratum fix. */ + _bfd_generic_link_add_one_symbol (link_info, + hash_table->bfd_of_glue_owner, "$a", + BSF_LOCAL, s, 0, NULL, + TRUE, FALSE, &bh); + + myh = (struct elf_link_hash_entry *) bh; + myh->type = ELF_ST_INFO (STB_LOCAL, STT_NOTYPE); + myh->forced_local = 1; + + /* The elf32_arm_init_maps function only cares about symbols from input + BFDs. We must make a note of this generated mapping symbol + ourselves so that code byteswapping works properly in + elf32_arm_write_section. */ + elf32_arm_section_map_add (s, 'a', 0); + } + + s->size += VFP11_ERRATUM_VENEER_SIZE; + hash_table->vfp11_erratum_glue_size += VFP11_ERRATUM_VENEER_SIZE; + hash_table->num_vfp11_fixes++; + + /* The offset of the veneer. */ + return val; +} + /* Add the glue sections to ABFD. This function is called from the linker scripts in ld/emultempl/{armelf}.em. */ @@ -2346,7 +3014,8 @@ bfd_elf32_arm_add_glue_sections_to_bfd (bfd *abfd, /* Note: we do not include the flag SEC_LINKER_CREATED, as this will prevent elf_link_input_bfd() from processing the contents of this section. */ - flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY; + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_CODE | SEC_READONLY); sec = bfd_make_section_with_flags (abfd, ARM2THUMB_GLUE_SECTION_NAME, @@ -2365,8 +3034,8 @@ bfd_elf32_arm_add_glue_sections_to_bfd (bfd *abfd, if (sec == NULL) { - flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY - | SEC_CODE | SEC_READONLY; + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_CODE | SEC_READONLY); sec = bfd_make_section_with_flags (abfd, THUMB2ARM_GLUE_SECTION_NAME, @@ -2379,6 +3048,24 @@ bfd_elf32_arm_add_glue_sections_to_bfd (bfd *abfd, sec->gc_mark = 1; } + sec = bfd_get_section_by_name (abfd, VFP11_ERRATUM_VENEER_SECTION_NAME); + + if (sec == NULL) + { + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_CODE | SEC_READONLY); + + sec = bfd_make_section_with_flags (abfd, + VFP11_ERRATUM_VENEER_SECTION_NAME, + flags); + + if (sec == NULL + || !bfd_set_section_alignment (abfd, sec, 2)) + return FALSE; + + sec->gc_mark = 1; + } + return TRUE; } @@ -2414,14 +3101,14 @@ bfd_elf32_arm_get_bfd_for_interworking (bfd *abfd, struct bfd_link_info *info) static void check_use_blx(struct elf32_arm_link_hash_table *globals) { - if (elf32_arm_get_eabi_attr_int (globals->obfd, Tag_CPU_arch) > 2) + if (bfd_elf_get_obj_attr_int (globals->obfd, OBJ_ATTR_PROC, + Tag_CPU_arch) > 2) globals->use_blx = 1; } bfd_boolean bfd_elf32_arm_process_before_allocation (bfd *abfd, - struct bfd_link_info *link_info, - int byteswap_code) + struct bfd_link_info *link_info) { Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Rela *internal_relocs = NULL; @@ -2444,13 +3131,12 @@ bfd_elf32_arm_process_before_allocation (bfd *abfd, BFD_ASSERT (globals != NULL); BFD_ASSERT (globals->bfd_of_glue_owner != NULL); - if (byteswap_code && !bfd_big_endian (abfd)) + if (globals->byteswap_code && !bfd_big_endian (abfd)) { _bfd_error_handler (_("%B: BE8 images only valid in big-endian mode."), abfd); return FALSE; } - globals->byteswap_code = byteswap_code; /* Rummage around all the relocs and map the glue vectors. */ sec = abfd->sections; @@ -2463,6 +3149,9 @@ bfd_elf32_arm_process_before_allocation (bfd *abfd, if (sec->reloc_count == 0) continue; + if ((sec->flags & SEC_EXCLUDE) != 0) + continue; + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; /* Load the relocs. */ @@ -2546,7 +3235,8 @@ bfd_elf32_arm_process_before_allocation (bfd *abfd, /* This one is a call from thumb code. We look up the target of the call. If it is not a thumb target, we insert glue. */ - if (ELF_ST_TYPE (h->type) != STT_ARM_TFUNC && !globals->use_blx) + if (ELF_ST_TYPE (h->type) != STT_ARM_TFUNC && !globals->use_blx + && h->root.type != bfd_link_hash_undefweak) record_thumb_to_arm_glue (link_info, h); break; @@ -2581,14 +3271,654 @@ error_return: #endif +/* Initialise maps of ARM/Thumb/data for input BFDs. */ + +void +bfd_elf32_arm_init_maps (bfd *abfd) +{ + Elf_Internal_Sym *isymbuf; + Elf_Internal_Shdr *hdr; + unsigned int i, localsyms; + + if ((abfd->flags & DYNAMIC) != 0) + return; + + hdr = &elf_tdata (abfd)->symtab_hdr; + localsyms = hdr->sh_info; + + /* Obtain a buffer full of symbols for this BFD. The hdr->sh_info field + should contain the number of local symbols, which should come before any + global symbols. Mapping symbols are always local. */ + isymbuf = bfd_elf_get_elf_syms (abfd, hdr, localsyms, 0, NULL, NULL, + NULL); + + /* No internal symbols read? Skip this BFD. */ + if (isymbuf == NULL) + return; + + for (i = 0; i < localsyms; i++) + { + Elf_Internal_Sym *isym = &isymbuf[i]; + asection *sec = bfd_section_from_elf_index (abfd, isym->st_shndx); + const char *name; + + if (sec != NULL + && ELF_ST_BIND (isym->st_info) == STB_LOCAL) + { + name = bfd_elf_string_from_elf_section (abfd, + hdr->sh_link, isym->st_name); + + if (bfd_is_arm_special_symbol_name (name, + BFD_ARM_SPECIAL_SYM_TYPE_MAP)) + elf32_arm_section_map_add (sec, name[1], isym->st_value); + } + } +} + + +void +bfd_elf32_arm_set_vfp11_fix (bfd *obfd, struct bfd_link_info *link_info) +{ + struct elf32_arm_link_hash_table *globals = elf32_arm_hash_table (link_info); + obj_attribute *out_attr = elf_known_obj_attributes_proc (obfd); + + /* We assume that ARMv7+ does not need the VFP11 denorm erratum fix. */ + if (out_attr[Tag_CPU_arch].i >= TAG_CPU_ARCH_V7) + { + switch (globals->vfp11_fix) + { + case BFD_ARM_VFP11_FIX_DEFAULT: + case BFD_ARM_VFP11_FIX_NONE: + globals->vfp11_fix = BFD_ARM_VFP11_FIX_NONE; + break; + + default: + /* Give a warning, but do as the user requests anyway. */ + (*_bfd_error_handler) (_("%B: warning: selected VFP11 erratum " + "workaround is not necessary for target architecture"), obfd); + } + } + else if (globals->vfp11_fix == BFD_ARM_VFP11_FIX_DEFAULT) + /* For earlier architectures, we might need the workaround, but do not + enable it by default. If users is running with broken hardware, they + must enable the erratum fix explicitly. */ + globals->vfp11_fix = BFD_ARM_VFP11_FIX_NONE; +} + + +enum bfd_arm_vfp11_pipe { + VFP11_FMAC, + VFP11_LS, + VFP11_DS, + VFP11_BAD +}; + +/* Return a VFP register number. This is encoded as RX:X for single-precision + registers, or X:RX for double-precision registers, where RX is the group of + four bits in the instruction encoding and X is the single extension bit. + RX and X fields are specified using their lowest (starting) bit. The return + value is: + + 0...31: single-precision registers s0...s31 + 32...63: double-precision registers d0...d31. + + Although X should be zero for VFP11 (encoding d0...d15 only), we might + encounter VFP3 instructions, so we allow the full range for DP registers. */ + +static unsigned int +bfd_arm_vfp11_regno (unsigned int insn, bfd_boolean is_double, unsigned int rx, + unsigned int x) +{ + if (is_double) + return (((insn >> rx) & 0xf) | (((insn >> x) & 1) << 4)) + 32; + else + return (((insn >> rx) & 0xf) << 1) | ((insn >> x) & 1); +} + +/* Set bits in *WMASK according to a register number REG as encoded by + bfd_arm_vfp11_regno(). Ignore d16-d31. */ + +static void +bfd_arm_vfp11_write_mask (unsigned int *wmask, unsigned int reg) +{ + if (reg < 32) + *wmask |= 1 << reg; + else if (reg < 48) + *wmask |= 3 << ((reg - 32) * 2); +} + +/* Return TRUE if WMASK overwrites anything in REGS. */ + +static bfd_boolean +bfd_arm_vfp11_antidependency (unsigned int wmask, int *regs, int numregs) +{ + int i; + + for (i = 0; i < numregs; i++) + { + unsigned int reg = regs[i]; + + if (reg < 32 && (wmask & (1 << reg)) != 0) + return TRUE; + + reg -= 32; + + if (reg >= 16) + continue; + + if ((wmask & (3 << (reg * 2))) != 0) + return TRUE; + } + + return FALSE; +} + +/* In this function, we're interested in two things: finding input registers + for VFP data-processing instructions, and finding the set of registers which + arbitrary VFP instructions may write to. We use a 32-bit unsigned int to + hold the written set, so FLDM etc. are easy to deal with (we're only + interested in 32 SP registers or 16 dp registers, due to the VFP version + implemented by the chip in question). DP registers are marked by setting + both SP registers in the write mask). */ + +static enum bfd_arm_vfp11_pipe +bfd_arm_vfp11_insn_decode (unsigned int insn, unsigned int *destmask, int *regs, + int *numregs) +{ + enum bfd_arm_vfp11_pipe pipe = VFP11_BAD; + bfd_boolean is_double = ((insn & 0xf00) == 0xb00) ? 1 : 0; + + if ((insn & 0x0f000e10) == 0x0e000a00) /* A data-processing insn. */ + { + unsigned int pqrs; + unsigned int fd = bfd_arm_vfp11_regno (insn, is_double, 12, 22); + unsigned int fm = bfd_arm_vfp11_regno (insn, is_double, 0, 5); + + pqrs = ((insn & 0x00800000) >> 20) + | ((insn & 0x00300000) >> 19) + | ((insn & 0x00000040) >> 6); + + switch (pqrs) + { + case 0: /* fmac[sd]. */ + case 1: /* fnmac[sd]. */ + case 2: /* fmsc[sd]. */ + case 3: /* fnmsc[sd]. */ + pipe = VFP11_FMAC; + bfd_arm_vfp11_write_mask (destmask, fd); + regs[0] = fd; + regs[1] = bfd_arm_vfp11_regno (insn, is_double, 16, 7); /* Fn. */ + regs[2] = fm; + *numregs = 3; + break; + + case 4: /* fmul[sd]. */ + case 5: /* fnmul[sd]. */ + case 6: /* fadd[sd]. */ + case 7: /* fsub[sd]. */ + pipe = VFP11_FMAC; + goto vfp_binop; + + case 8: /* fdiv[sd]. */ + pipe = VFP11_DS; + vfp_binop: + bfd_arm_vfp11_write_mask (destmask, fd); + regs[0] = bfd_arm_vfp11_regno (insn, is_double, 16, 7); /* Fn. */ + regs[1] = fm; + *numregs = 2; + break; + + case 15: /* extended opcode. */ + { + unsigned int extn = ((insn >> 15) & 0x1e) + | ((insn >> 7) & 1); + + switch (extn) + { + case 0: /* fcpy[sd]. */ + case 1: /* fabs[sd]. */ + case 2: /* fneg[sd]. */ + case 8: /* fcmp[sd]. */ + case 9: /* fcmpe[sd]. */ + case 10: /* fcmpz[sd]. */ + case 11: /* fcmpez[sd]. */ + case 16: /* fuito[sd]. */ + case 17: /* fsito[sd]. */ + case 24: /* ftoui[sd]. */ + case 25: /* ftouiz[sd]. */ + case 26: /* ftosi[sd]. */ + case 27: /* ftosiz[sd]. */ + /* These instructions will not bounce due to underflow. */ + *numregs = 0; + pipe = VFP11_FMAC; + break; + + case 3: /* fsqrt[sd]. */ + /* fsqrt cannot underflow, but it can (perhaps) overwrite + registers to cause the erratum in previous instructions. */ + bfd_arm_vfp11_write_mask (destmask, fd); + pipe = VFP11_DS; + break; + + case 15: /* fcvt{ds,sd}. */ + { + int rnum = 0; + + bfd_arm_vfp11_write_mask (destmask, fd); + + /* Only FCVTSD can underflow. */ + if ((insn & 0x100) != 0) + regs[rnum++] = fm; + + *numregs = rnum; + + pipe = VFP11_FMAC; + } + break; + + default: + return VFP11_BAD; + } + } + break; + + default: + return VFP11_BAD; + } + } + /* Two-register transfer. */ + else if ((insn & 0x0fe00ed0) == 0x0c400a10) + { + unsigned int fm = bfd_arm_vfp11_regno (insn, is_double, 0, 5); + + if ((insn & 0x100000) == 0) + { + if (is_double) + bfd_arm_vfp11_write_mask (destmask, fm); + else + { + bfd_arm_vfp11_write_mask (destmask, fm); + bfd_arm_vfp11_write_mask (destmask, fm + 1); + } + } + + pipe = VFP11_LS; + } + else if ((insn & 0x0e100e00) == 0x0c100a00) /* A load insn. */ + { + int fd = bfd_arm_vfp11_regno (insn, is_double, 12, 22); + unsigned int puw = ((insn >> 21) & 0x1) | (((insn >> 23) & 3) << 1); + + switch (puw) + { + case 0: /* Two-reg transfer. We should catch these above. */ + abort (); + + case 2: /* fldm[sdx]. */ + case 3: + case 5: + { + unsigned int i, offset = insn & 0xff; + + if (is_double) + offset >>= 1; + + for (i = fd; i < fd + offset; i++) + bfd_arm_vfp11_write_mask (destmask, i); + } + break; + + case 4: /* fld[sd]. */ + case 6: + bfd_arm_vfp11_write_mask (destmask, fd); + break; + + default: + return VFP11_BAD; + } + + pipe = VFP11_LS; + } + /* Single-register transfer. Note L==0. */ + else if ((insn & 0x0f100e10) == 0x0e000a10) + { + unsigned int opcode = (insn >> 21) & 7; + unsigned int fn = bfd_arm_vfp11_regno (insn, is_double, 16, 7); + + switch (opcode) + { + case 0: /* fmsr/fmdlr. */ + case 1: /* fmdhr. */ + /* Mark fmdhr and fmdlr as writing to the whole of the DP + destination register. I don't know if this is exactly right, + but it is the conservative choice. */ + bfd_arm_vfp11_write_mask (destmask, fn); + break; + + case 7: /* fmxr. */ + break; + } + + pipe = VFP11_LS; + } + + return pipe; +} + + +static int elf32_arm_compare_mapping (const void * a, const void * b); + + +/* Look for potentially-troublesome code sequences which might trigger the + VFP11 denormal/antidependency erratum. See, e.g., the ARM1136 errata sheet + (available from ARM) for details of the erratum. A short version is + described in ld.texinfo. */ + +bfd_boolean +bfd_elf32_arm_vfp11_erratum_scan (bfd *abfd, struct bfd_link_info *link_info) +{ + asection *sec; + bfd_byte *contents = NULL; + int state = 0; + int regs[3], numregs = 0; + struct elf32_arm_link_hash_table *globals = elf32_arm_hash_table (link_info); + int use_vector = (globals->vfp11_fix == BFD_ARM_VFP11_FIX_VECTOR); + + /* We use a simple FSM to match troublesome VFP11 instruction sequences. + The states transition as follows: + + 0 -> 1 (vector) or 0 -> 2 (scalar) + A VFP FMAC-pipeline instruction has been seen. Fill + regs[0]..regs[numregs-1] with its input operands. Remember this + instruction in 'first_fmac'. + + 1 -> 2 + Any instruction, except for a VFP instruction which overwrites + regs[*]. + + 1 -> 3 [ -> 0 ] or + 2 -> 3 [ -> 0 ] + A VFP instruction has been seen which overwrites any of regs[*]. + We must make a veneer! Reset state to 0 before examining next + instruction. + + 2 -> 0 + If we fail to match anything in state 2, reset to state 0 and reset + the instruction pointer to the instruction after 'first_fmac'. + + If the VFP11 vector mode is in use, there must be at least two unrelated + instructions between anti-dependent VFP11 instructions to properly avoid + triggering the erratum, hence the use of the extra state 1. + */ + + /* If we are only performing a partial link do not bother + to construct any glue. */ + if (link_info->relocatable) + return TRUE; + + /* We should have chosen a fix type by the time we get here. */ + BFD_ASSERT (globals->vfp11_fix != BFD_ARM_VFP11_FIX_DEFAULT); + + if (globals->vfp11_fix == BFD_ARM_VFP11_FIX_NONE) + return TRUE; + + /* Skip if this bfd does not correspond to an ELF image. */ + if (bfd_get_flavour (abfd) != bfd_target_elf_flavour) + return TRUE; + + for (sec = abfd->sections; sec != NULL; sec = sec->next) + { + unsigned int i, span, first_fmac = 0, veneer_of_insn = 0; + struct _arm_elf_section_data *sec_data; + + /* If we don't have executable progbits, we're not interested in this + section. Also skip if section is to be excluded. */ + if (elf_section_type (sec) != SHT_PROGBITS + || (elf_section_flags (sec) & SHF_EXECINSTR) == 0 + || (sec->flags & SEC_EXCLUDE) != 0 + || strcmp (sec->name, VFP11_ERRATUM_VENEER_SECTION_NAME) == 0) + continue; + + sec_data = elf32_arm_section_data (sec); + + if (sec_data->mapcount == 0) + continue; + + if (elf_section_data (sec)->this_hdr.contents != NULL) + contents = elf_section_data (sec)->this_hdr.contents; + else if (! bfd_malloc_and_get_section (abfd, sec, &contents)) + goto error_return; + + qsort (sec_data->map, sec_data->mapcount, sizeof (elf32_arm_section_map), + elf32_arm_compare_mapping); + + for (span = 0; span < sec_data->mapcount; span++) + { + unsigned int span_start = sec_data->map[span].vma; + unsigned int span_end = (span == sec_data->mapcount - 1) + ? sec->size : sec_data->map[span + 1].vma; + char span_type = sec_data->map[span].type; + + /* FIXME: Only ARM mode is supported at present. We may need to + support Thumb-2 mode also at some point. */ + if (span_type != 'a') + continue; + + for (i = span_start; i < span_end;) + { + unsigned int next_i = i + 4; + unsigned int insn = bfd_big_endian (abfd) + ? (contents[i] << 24) + | (contents[i + 1] << 16) + | (contents[i + 2] << 8) + | contents[i + 3] + : (contents[i + 3] << 24) + | (contents[i + 2] << 16) + | (contents[i + 1] << 8) + | contents[i]; + unsigned int writemask = 0; + enum bfd_arm_vfp11_pipe pipe; + + switch (state) + { + case 0: + pipe = bfd_arm_vfp11_insn_decode (insn, &writemask, regs, + &numregs); + /* I'm assuming the VFP11 erratum can trigger with denorm + operands on either the FMAC or the DS pipeline. This might + lead to slightly overenthusiastic veneer insertion. */ + if (pipe == VFP11_FMAC || pipe == VFP11_DS) + { + state = use_vector ? 1 : 2; + first_fmac = i; + veneer_of_insn = insn; + } + break; + + case 1: + { + int other_regs[3], other_numregs; + pipe = bfd_arm_vfp11_insn_decode (insn, &writemask, + other_regs, + &other_numregs); + if (pipe != VFP11_BAD + && bfd_arm_vfp11_antidependency (writemask, regs, + numregs)) + state = 3; + else + state = 2; + } + break; + + case 2: + { + int other_regs[3], other_numregs; + pipe = bfd_arm_vfp11_insn_decode (insn, &writemask, + other_regs, + &other_numregs); + if (pipe != VFP11_BAD + && bfd_arm_vfp11_antidependency (writemask, regs, + numregs)) + state = 3; + else + { + state = 0; + next_i = first_fmac + 4; + } + } + break; + + case 3: + abort (); /* Should be unreachable. */ + } + + if (state == 3) + { + elf32_vfp11_erratum_list *newerr + = bfd_zmalloc (sizeof (elf32_vfp11_erratum_list)); + int errcount; + + errcount = ++(elf32_arm_section_data (sec)->erratumcount); + + newerr->u.b.vfp_insn = veneer_of_insn; + + switch (span_type) + { + case 'a': + newerr->type = VFP11_ERRATUM_BRANCH_TO_ARM_VENEER; + break; + + default: + abort (); + } + + record_vfp11_erratum_veneer (link_info, newerr, abfd, sec, + first_fmac); + + newerr->vma = -1; + + newerr->next = sec_data->erratumlist; + sec_data->erratumlist = newerr; + + state = 0; + } + + i = next_i; + } + } + + if (contents != NULL + && elf_section_data (sec)->this_hdr.contents != contents) + free (contents); + contents = NULL; + } + + return TRUE; + +error_return: + if (contents != NULL + && elf_section_data (sec)->this_hdr.contents != contents) + free (contents); + + return FALSE; +} + +/* Find virtual-memory addresses for VFP11 erratum veneers and return locations + after sections have been laid out, using specially-named symbols. */ + +void +bfd_elf32_arm_vfp11_fix_veneer_locations (bfd *abfd, + struct bfd_link_info *link_info) +{ + asection *sec; + struct elf32_arm_link_hash_table *globals; + char *tmp_name; + + if (link_info->relocatable) + return; + + /* Skip if this bfd does not correspond to an ELF image. */ + if (bfd_get_flavour (abfd) != bfd_target_elf_flavour) + return; + + globals = elf32_arm_hash_table (link_info); + + tmp_name = bfd_malloc ((bfd_size_type) strlen + (VFP11_ERRATUM_VENEER_ENTRY_NAME) + 10); + + for (sec = abfd->sections; sec != NULL; sec = sec->next) + { + struct _arm_elf_section_data *sec_data = elf32_arm_section_data (sec); + elf32_vfp11_erratum_list *errnode = sec_data->erratumlist; + + for (; errnode != NULL; errnode = errnode->next) + { + struct elf_link_hash_entry *myh; + bfd_vma vma; + + switch (errnode->type) + { + case VFP11_ERRATUM_BRANCH_TO_ARM_VENEER: + case VFP11_ERRATUM_BRANCH_TO_THUMB_VENEER: + /* Find veneer symbol. */ + sprintf (tmp_name, VFP11_ERRATUM_VENEER_ENTRY_NAME, + errnode->u.b.veneer->u.v.id); + + myh = elf_link_hash_lookup + (&(globals)->root, tmp_name, FALSE, FALSE, TRUE); + + if (myh == NULL) + (*_bfd_error_handler) (_("%B: unable to find VFP11 veneer " + "`%s'"), abfd, tmp_name); + + vma = myh->root.u.def.section->output_section->vma + + myh->root.u.def.section->output_offset + + myh->root.u.def.value; + + errnode->u.b.veneer->vma = vma; + break; + + case VFP11_ERRATUM_ARM_VENEER: + case VFP11_ERRATUM_THUMB_VENEER: + /* Find return location. */ + sprintf (tmp_name, VFP11_ERRATUM_VENEER_ENTRY_NAME "_r", + errnode->u.v.id); + + myh = elf_link_hash_lookup + (&(globals)->root, tmp_name, FALSE, FALSE, TRUE); + + if (myh == NULL) + (*_bfd_error_handler) (_("%B: unable to find VFP11 veneer " + "`%s'"), abfd, tmp_name); + + vma = myh->root.u.def.section->output_section->vma + + myh->root.u.def.section->output_offset + + myh->root.u.def.value; + + errnode->u.v.branch->vma = vma; + break; + + default: + abort (); + } + } + } + + free (tmp_name); +} + + /* Set target relocation values needed during linking. */ void -bfd_elf32_arm_set_target_relocs (struct bfd_link_info *link_info, +bfd_elf32_arm_set_target_relocs (struct bfd *output_bfd, + struct bfd_link_info *link_info, int target1_is_rel, char * target2_type, int fix_v4bx, - int use_blx) + int use_blx, + bfd_arm_vfp11_fix vfp11_fix, + int no_enum_warn, int pic_veneer) { struct elf32_arm_link_hash_table *globals; @@ -2608,6 +3938,10 @@ bfd_elf32_arm_set_target_relocs (struct bfd_link_info *link_info, } globals->fix_v4bx = fix_v4bx; globals->use_blx |= use_blx; + globals->vfp11_fix = vfp11_fix; + globals->pic_veneer = pic_veneer; + + elf32_arm_tdata (output_bfd)->no_enum_size_warning = no_enum_warn; } /* The thumb form of a long branch is a bit finicky, because the offset @@ -2664,6 +3998,35 @@ insert_thumb_branch (insn32 br_insn, int rel_off) return br_insn; } + +/* Store an Arm insn into an output section not processed by + elf32_arm_write_section. */ + +static void +put_arm_insn (struct elf32_arm_link_hash_table *htab, + bfd * output_bfd, bfd_vma val, void * ptr) +{ + if (htab->byteswap_code != bfd_little_endian (output_bfd)) + bfd_putl32 (val, ptr); + else + bfd_putb32 (val, ptr); +} + + +/* Store a 16-bit Thumb insn into an output section not processed by + elf32_arm_write_section. */ + +static void +put_thumb_insn (struct elf32_arm_link_hash_table *htab, + bfd * output_bfd, bfd_vma val, void * ptr) +{ + if (htab->byteswap_code != bfd_little_endian (output_bfd)) + bfd_putl16 (val, ptr); + else + bfd_putb16 (val, ptr); +} + + /* Thumb code calling an ARM function. */ static int @@ -2676,7 +4039,8 @@ elf32_thumb_to_arm_stub (struct bfd_link_info * info, asection * sym_sec, bfd_vma offset, bfd_signed_vma addend, - bfd_vma val) + bfd_vma val, + char **error_message) { asection * s = 0; bfd_vma my_offset; @@ -2685,7 +4049,7 @@ elf32_thumb_to_arm_stub (struct bfd_link_info * info, struct elf_link_hash_entry * myh; struct elf32_arm_link_hash_table * globals; - myh = find_thumb_glue (info, name, input_bfd); + myh = find_thumb_glue (info, name, error_message); if (myh == NULL) return FALSE; @@ -2720,11 +4084,11 @@ elf32_thumb_to_arm_stub (struct bfd_link_info * info, --my_offset; myh->root.u.def.value = my_offset; - bfd_put_16 (output_bfd, (bfd_vma) t2a1_bx_pc_insn, - s->contents + my_offset); + put_thumb_insn (globals, output_bfd, (bfd_vma) t2a1_bx_pc_insn, + s->contents + my_offset); - bfd_put_16 (output_bfd, (bfd_vma) t2a2_noop_insn, - s->contents + my_offset + 2); + put_thumb_insn (globals, output_bfd, (bfd_vma) t2a2_noop_insn, + s->contents + my_offset + 2); ret_offset = /* Address of destination of the stub. */ @@ -2742,9 +4106,9 @@ elf32_thumb_to_arm_stub (struct bfd_link_info * info, /* ARM branches work from the pc of the instruction + 8. */ + 8); - bfd_put_32 (output_bfd, - (bfd_vma) t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF), - s->contents + my_offset + 4); + put_arm_insn (globals, output_bfd, + (bfd_vma) t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF), + s->contents + my_offset + 4); } BFD_ASSERT (my_offset <= globals->thumb_glue_size); @@ -2771,30 +4135,26 @@ elf32_thumb_to_arm_stub (struct bfd_link_info * info, return TRUE; } -/* Arm code calling a Thumb function. */ +/* Populate an Arm to Thumb stub. Returns the stub symbol. */ -static int -elf32_arm_to_thumb_stub (struct bfd_link_info * info, - const char * name, - bfd * input_bfd, - bfd * output_bfd, - asection * input_section, - bfd_byte * hit_data, - asection * sym_sec, - bfd_vma offset, - bfd_signed_vma addend, - bfd_vma val) +static struct elf_link_hash_entry * +elf32_arm_create_thumb_stub (struct bfd_link_info * info, + const char * name, + bfd * input_bfd, + bfd * output_bfd, + asection * sym_sec, + bfd_vma val, + asection *s, + char **error_message) { - unsigned long int tmp; bfd_vma my_offset; - asection * s; long int ret_offset; struct elf_link_hash_entry * myh; struct elf32_arm_link_hash_table * globals; - myh = find_arm_glue (info, name, input_bfd); + myh = find_arm_glue (info, name, error_message); if (myh == NULL) - return FALSE; + return NULL; globals = elf32_arm_hash_table (info); @@ -2802,11 +4162,6 @@ elf32_arm_to_thumb_stub (struct bfd_link_info * info, BFD_ASSERT (globals->bfd_of_glue_owner != NULL); my_offset = myh->root.u.def.value; - s = bfd_get_section_by_name (globals->bfd_of_glue_owner, - ARM2THUMB_GLUE_SECTION_NAME); - BFD_ASSERT (s != NULL); - BFD_ASSERT (s->contents != NULL); - BFD_ASSERT (s->output_section != NULL); if ((my_offset & 0x01) == 0x01) { @@ -2823,18 +4178,19 @@ elf32_arm_to_thumb_stub (struct bfd_link_info * info, --my_offset; myh->root.u.def.value = my_offset; - if ((info->shared || globals->root.is_relocatable_executable)) + if (info->shared || globals->root.is_relocatable_executable + || globals->pic_veneer) { /* For relocatable objects we can't use absolute addresses, so construct the address from a relative offset. */ /* TODO: If the offset is small it's probably worth constructing the address with adds. */ - bfd_put_32 (output_bfd, (bfd_vma) a2t1p_ldr_insn, - s->contents + my_offset); - bfd_put_32 (output_bfd, (bfd_vma) a2t2p_add_pc_insn, - s->contents + my_offset + 4); - bfd_put_32 (output_bfd, (bfd_vma) a2t3p_bx_r12_insn, - s->contents + my_offset + 8); + put_arm_insn (globals, output_bfd, (bfd_vma) a2t1p_ldr_insn, + s->contents + my_offset); + put_arm_insn (globals, output_bfd, (bfd_vma) a2t2p_add_pc_insn, + s->contents + my_offset + 4); + put_arm_insn (globals, output_bfd, (bfd_vma) a2t3p_bx_r12_insn, + s->contents + my_offset + 8); /* Adjust the offset by 4 for the position of the add, and 8 for the pipeline offset. */ ret_offset = (val - (s->output_offset @@ -2844,13 +4200,22 @@ elf32_arm_to_thumb_stub (struct bfd_link_info * info, bfd_put_32 (output_bfd, ret_offset, s->contents + my_offset + 12); } - else + else if (globals->use_blx) { - bfd_put_32 (output_bfd, (bfd_vma) a2t1_ldr_insn, - s->contents + my_offset); + put_arm_insn (globals, output_bfd, (bfd_vma) a2t1v5_ldr_insn, + s->contents + my_offset); - bfd_put_32 (output_bfd, (bfd_vma) a2t2_bx_r12_insn, + /* It's a thumb address. Add the low order bit. */ + bfd_put_32 (output_bfd, val | a2t2v5_func_addr_insn, s->contents + my_offset + 4); + } + else + { + put_arm_insn (globals, output_bfd, (bfd_vma) a2t1_ldr_insn, + s->contents + my_offset); + + put_arm_insn (globals, output_bfd, (bfd_vma) a2t2_bx_r12_insn, + s->contents + my_offset + 4); /* It's a thumb address. Add the low order bit. */ bfd_put_32 (output_bfd, val | a2t3_func_addr_insn, @@ -2860,6 +4225,48 @@ elf32_arm_to_thumb_stub (struct bfd_link_info * info, BFD_ASSERT (my_offset <= globals->arm_glue_size); + return myh; +} + +/* Arm code calling a Thumb function. */ + +static int +elf32_arm_to_thumb_stub (struct bfd_link_info * info, + const char * name, + bfd * input_bfd, + bfd * output_bfd, + asection * input_section, + bfd_byte * hit_data, + asection * sym_sec, + bfd_vma offset, + bfd_signed_vma addend, + bfd_vma val, + char **error_message) +{ + unsigned long int tmp; + bfd_vma my_offset; + asection * s; + long int ret_offset; + struct elf_link_hash_entry * myh; + struct elf32_arm_link_hash_table * globals; + + globals = elf32_arm_hash_table (info); + + BFD_ASSERT (globals != NULL); + BFD_ASSERT (globals->bfd_of_glue_owner != NULL); + + s = bfd_get_section_by_name (globals->bfd_of_glue_owner, + ARM2THUMB_GLUE_SECTION_NAME); + BFD_ASSERT (s != NULL); + BFD_ASSERT (s->contents != NULL); + BFD_ASSERT (s->output_section != NULL); + + myh = elf32_arm_create_thumb_stub (info, name, input_bfd, output_bfd, + sym_sec, val, s, error_message); + if (!myh) + return FALSE; + + my_offset = myh->root.u.def.value; tmp = bfd_get_32 (input_bfd, hit_data); tmp = tmp & 0xFF000000; @@ -2879,6 +4286,70 @@ elf32_arm_to_thumb_stub (struct bfd_link_info * info, return TRUE; } +/* Populate Arm stub for an exported Thumb function. */ + +static bfd_boolean +elf32_arm_to_thumb_export_stub (struct elf_link_hash_entry *h, void * inf) +{ + struct bfd_link_info * info = (struct bfd_link_info *) inf; + asection * s; + struct elf_link_hash_entry * myh; + struct elf32_arm_link_hash_entry *eh; + struct elf32_arm_link_hash_table * globals; + asection *sec; + bfd_vma val; + char *error_message; + + eh = elf32_arm_hash_entry(h); + /* Allocate stubs for exported Thumb functions on v4t. */ + if (eh->export_glue == NULL) + return TRUE; + + globals = elf32_arm_hash_table (info); + + BFD_ASSERT (globals != NULL); + BFD_ASSERT (globals->bfd_of_glue_owner != NULL); + + s = bfd_get_section_by_name (globals->bfd_of_glue_owner, + ARM2THUMB_GLUE_SECTION_NAME); + BFD_ASSERT (s != NULL); + BFD_ASSERT (s->contents != NULL); + BFD_ASSERT (s->output_section != NULL); + + sec = eh->export_glue->root.u.def.section; + + BFD_ASSERT (sec->output_section != NULL); + + val = eh->export_glue->root.u.def.value + sec->output_offset + + sec->output_section->vma; + myh = elf32_arm_create_thumb_stub (info, h->root.root.string, + h->root.u.def.section->owner, + globals->obfd, sec, val, s, + &error_message); + BFD_ASSERT (myh); + return TRUE; +} + +/* Generate Arm stubs for exported Thumb symbols. */ +static void +elf32_arm_begin_write_processing (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *link_info) +{ + struct elf32_arm_link_hash_table * globals; + + if (!link_info) + return; + + globals = elf32_arm_hash_table (link_info); + /* If blx is available then exported Thumb symbols are OK and there is + nothing to do. */ + if (globals->use_blx) + return; + + elf_link_hash_traverse (&globals->root, elf32_arm_to_thumb_export_stub, + link_info); +} + /* Some relocations map to different relocations depending on the target. Return the real relocation. */ static int @@ -2944,6 +4415,83 @@ elf32_arm_abs12_reloc (bfd *abfd, void *data, bfd_vma value) return bfd_reloc_ok; } +/* For a given value of n, calculate the value of G_n as required to + deal with group relocations. We return it in the form of an + encoded constant-and-rotation, together with the final residual. If n is + specified as less than zero, then final_residual is filled with the + input value and no further action is performed. */ + +static bfd_vma +calculate_group_reloc_mask (bfd_vma value, int n, bfd_vma *final_residual) +{ + int current_n; + bfd_vma g_n; + bfd_vma encoded_g_n = 0; + bfd_vma residual = value; /* Also known as Y_n. */ + + for (current_n = 0; current_n <= n; current_n++) + { + int shift; + + /* Calculate which part of the value to mask. */ + if (residual == 0) + shift = 0; + else + { + int msb; + + /* Determine the most significant bit in the residual and + align the resulting value to a 2-bit boundary. */ + for (msb = 30; msb >= 0; msb -= 2) + if (residual & (3 << msb)) + break; + + /* The desired shift is now (msb - 6), or zero, whichever + is the greater. */ + shift = msb - 6; + if (shift < 0) + shift = 0; + } + + /* Calculate g_n in 32-bit as well as encoded constant+rotation form. */ + g_n = residual & (0xff << shift); + encoded_g_n = (g_n >> shift) + | ((g_n <= 0xff ? 0 : (32 - shift) / 2) << 8); + + /* Calculate the residual for the next time around. */ + residual &= ~g_n; + } + + *final_residual = residual; + + return encoded_g_n; +} + +/* Given an ARM instruction, determine whether it is an ADD or a SUB. + Returns 1 if it is an ADD, -1 if it is a SUB, and 0 otherwise. */ +static int +identify_add_or_sub(bfd_vma insn) +{ + int opcode = insn & 0x1e00000; + + if (opcode == 1 << 23) /* ADD */ + return 1; + + if (opcode == 1 << 22) /* SUB */ + return -1; + + return 0; +} + +/* Determine if we're dealing with a Thumb-2 object. */ + +static int using_thumb2 (struct elf32_arm_link_hash_table *globals) +{ + int arch = bfd_elf_get_obj_attr_int (globals->obfd, OBJ_ATTR_PROC, + Tag_CPU_arch); + return arch == TAG_CPU_ARCH_V6T2 || arch >= TAG_CPU_ARCH_V7; +} + /* Perform a relocation as part of a final link. */ static bfd_reloc_status_type @@ -2959,7 +4507,8 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, const char * sym_name, int sym_flags, struct elf_link_hash_entry * h, - bfd_boolean * unresolved_reloc_p) + bfd_boolean * unresolved_reloc_p, + char **error_message) { unsigned long r_type = howto->type; unsigned long r_symndx; @@ -3036,23 +4585,20 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, case R_ARM_PC24: case R_ARM_ABS32: + case R_ARM_ABS32_NOI: case R_ARM_REL32: + case R_ARM_REL32_NOI: case R_ARM_CALL: case R_ARM_JUMP24: case R_ARM_XPC25: case R_ARM_PREL31: case R_ARM_PLT32: - /* r_symndx will be zero only for relocs against symbols - from removed linkonce sections, or sections discarded by - a linker script. */ - if (r_symndx == 0) - return bfd_reloc_ok; - /* Handle relocations which should use the PLT entry. ABS32/REL32 will use the symbol's value, which may point to a PLT entry, but we don't need to handle that here. If we created a PLT entry, all branches in this object should go to it. */ - if ((r_type != R_ARM_ABS32 && r_type != R_ARM_REL32) + if ((r_type != R_ARM_ABS32 && r_type != R_ARM_REL32 + && r_type != R_ARM_ABS32_NOI && r_type != R_ARM_REL32_NOI) && h != NULL && splt != NULL && h->plt.offset != (bfd_vma) -1) @@ -3076,7 +4622,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, run time. */ if ((info->shared || globals->root.is_relocatable_executable) && (input_section->flags & SEC_ALLOC) - && (r_type != R_ARM_REL32 + && ((r_type != R_ARM_REL32 && r_type != R_ARM_REL32_NOI) || !SYMBOL_CALLS_LOCAL (info, h)) && (h == NULL || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT @@ -3141,6 +4687,8 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, value |= 1; if (globals->symbian_p) { + asection *osec; + /* On Symbian OS, the data segment and text segement can be relocated independently. Therefore, we must indicate the segment to which this @@ -3148,11 +4696,27 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, use any symbol in the right segment; we just use the section symbol as it is convenient. (We cannot use the symbol given by "h" directly as it - will not appear in the dynamic symbol table.) */ + will not appear in the dynamic symbol table.) + + Note that the dynamic linker ignores the section + symbol value, so we don't subtract osec->vma + from the emitted reloc addend. */ if (sym_sec) - symbol = elf_section_data (sym_sec->output_section)->dynindx; + osec = sym_sec->output_section; else - symbol = elf_section_data (input_section->output_section)->dynindx; + osec = input_section->output_section; + symbol = elf_section_data (osec)->dynindx; + if (symbol == 0) + { + struct elf_link_hash_table *htab = elf_hash_table (info); + + if ((osec->flags & SEC_READONLY) == 0 + && htab->data_index_section != NULL) + osec = htab->data_index_section; + else + osec = htab->text_index_section; + symbol = elf_section_data (osec)->dynindx; + } BFD_ASSERT (symbol != 0); } else @@ -3207,11 +4771,14 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, /* Check for Arm calling Thumb function. */ if (sym_flags == STT_ARM_TFUNC) { - elf32_arm_to_thumb_stub (info, sym_name, input_bfd, - output_bfd, input_section, - hit_data, sym_sec, rel->r_offset, - signed_addend, value); - return bfd_reloc_ok; + if (elf32_arm_to_thumb_stub (info, sym_name, input_bfd, + output_bfd, input_section, + hit_data, sym_sec, rel->r_offset, + signed_addend, value, + error_message)) + return bfd_reloc_ok; + else + return bfd_reloc_dangerous; } } @@ -3246,40 +4813,43 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, signed_addend = value; signed_addend >>= howto->rightshift; - /* It is not an error for an undefined weak reference to be - out of range. Any program that branches to such a symbol - is going to crash anyway, so there is no point worrying - about getting the destination exactly right. */ - if (! h || h->root.type != bfd_link_hash_undefweak) + /* A branch to an undefined weak symbol is turned into a jump to + the next instruction. */ + if (h && h->root.type == bfd_link_hash_undefweak) + { + value = (bfd_get_32 (input_bfd, hit_data) & 0xf0000000) + | 0x0affffff; + } + else { /* Perform a signed range check. */ if ( signed_addend > ((bfd_signed_vma) (howto->dst_mask >> 1)) || signed_addend < - ((bfd_signed_vma) ((howto->dst_mask + 1) >> 1))) return bfd_reloc_overflow; - } - addend = (value & 2); + addend = (value & 2); - value = (signed_addend & howto->dst_mask) - | (bfd_get_32 (input_bfd, hit_data) & (~ howto->dst_mask)); + value = (signed_addend & howto->dst_mask) + | (bfd_get_32 (input_bfd, hit_data) & (~ howto->dst_mask)); - /* Set the H bit in the BLX instruction. */ - if (sym_flags == STT_ARM_TFUNC) - { - if (addend) - value |= (1 << 24); - else - value &= ~(bfd_vma)(1 << 24); - } - if (r_type == R_ARM_CALL) - { - /* Select the correct instruction (BL or BLX). */ + /* Set the H bit in the BLX instruction. */ if (sym_flags == STT_ARM_TFUNC) - value |= (1 << 28); - else { - value &= ~(bfd_vma)(1 << 28); - value |= (1 << 24); + if (addend) + value |= (1 << 24); + else + value &= ~(bfd_vma)(1 << 24); + } + if (r_type == R_ARM_CALL) + { + /* Select the correct instruction (BL or BLX). */ + if (sym_flags == STT_ARM_TFUNC) + value |= (1 << 28); + else + { + value &= ~(bfd_vma)(1 << 28); + value |= (1 << 24); + } } } break; @@ -3290,6 +4860,10 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, value |= 1; break; + case R_ARM_ABS32_NOI: + value += addend; + break; + case R_ARM_REL32: value += addend; if (sym_flags == STT_ARM_TFUNC) @@ -3298,6 +4872,12 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, + input_section->output_offset + rel->r_offset); break; + case R_ARM_REL32_NOI: + value += addend; + value -= (input_section->output_section->vma + + input_section->output_offset + rel->r_offset); + break; + case R_ARM_PREL31: value -= (input_section->output_section->vma + input_section->output_offset + rel->r_offset); @@ -3355,27 +4935,122 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, bfd_put_16 (input_bfd, value, hit_data); return bfd_reloc_ok; + case R_ARM_THM_ALU_PREL_11_0: + /* Corresponds to: addw.w reg, pc, #offset (and similarly for subw). */ + { + bfd_vma insn; + bfd_signed_vma relocation; + + insn = (bfd_get_16 (input_bfd, hit_data) << 16) + | bfd_get_16 (input_bfd, hit_data + 2); + + if (globals->use_rel) + { + signed_addend = (insn & 0xff) | ((insn & 0x7000) >> 4) + | ((insn & (1 << 26)) >> 15); + if (insn & 0xf00000) + signed_addend = -signed_addend; + } + + relocation = value + signed_addend; + relocation -= (input_section->output_section->vma + + input_section->output_offset + + rel->r_offset); + + value = abs (relocation); + + if (value >= 0x1000) + return bfd_reloc_overflow; + + insn = (insn & 0xfb0f8f00) | (value & 0xff) + | ((value & 0x700) << 4) + | ((value & 0x800) << 15); + if (relocation < 0) + insn |= 0xa00000; + + bfd_put_16 (input_bfd, insn >> 16, hit_data); + bfd_put_16 (input_bfd, insn & 0xffff, hit_data + 2); + + return bfd_reloc_ok; + } + + case R_ARM_THM_PC12: + /* Corresponds to: ldr.w reg, [pc, #offset]. */ + { + bfd_vma insn; + bfd_signed_vma relocation; + + insn = (bfd_get_16 (input_bfd, hit_data) << 16) + | bfd_get_16 (input_bfd, hit_data + 2); + + if (globals->use_rel) + { + signed_addend = insn & 0xfff; + if (!(insn & (1 << 23))) + signed_addend = -signed_addend; + } + + relocation = value + signed_addend; + relocation -= (input_section->output_section->vma + + input_section->output_offset + + rel->r_offset); + + value = abs (relocation); + + if (value >= 0x1000) + return bfd_reloc_overflow; + + insn = (insn & 0xff7ff000) | value; + if (relocation >= 0) + insn |= (1 << 23); + + bfd_put_16 (input_bfd, insn >> 16, hit_data); + bfd_put_16 (input_bfd, insn & 0xffff, hit_data + 2); + + return bfd_reloc_ok; + } + case R_ARM_THM_XPC22: case R_ARM_THM_CALL: /* Thumb BL (branch long instruction). */ { bfd_vma relocation; + bfd_vma reloc_sign; bfd_boolean overflow = FALSE; bfd_vma upper_insn = bfd_get_16 (input_bfd, hit_data); bfd_vma lower_insn = bfd_get_16 (input_bfd, hit_data + 2); - bfd_signed_vma reloc_signed_max = ((1 << (howto->bitsize - 1)) - 1) >> howto->rightshift; - bfd_signed_vma reloc_signed_min = ~ reloc_signed_max; + bfd_signed_vma reloc_signed_max; + bfd_signed_vma reloc_signed_min; bfd_vma check; bfd_signed_vma signed_check; + int bitsize; + int thumb2 = using_thumb2 (globals); + + /* A branch to an undefined weak symbol is turned into a jump to + the next instruction. */ + if (h && h->root.type == bfd_link_hash_undefweak) + { + bfd_put_16 (input_bfd, 0xe000, hit_data); + bfd_put_16 (input_bfd, 0xbf00, hit_data + 2); + return bfd_reloc_ok; + } - /* Need to refetch the addend and squish the two 11 bit pieces - together. */ + /* Fetch the addend. We use the Thumb-2 encoding (backwards compatible + with Thumb-1) involving the J1 and J2 bits. */ if (globals->use_rel) { - bfd_vma upper = upper_insn & 0x7ff; - bfd_vma lower = lower_insn & 0x7ff; - upper = (upper ^ 0x400) - 0x400; /* Sign extend. */ - addend = (upper << 12) | (lower << 1); + bfd_vma s = (upper_insn & (1 << 10)) >> 10; + bfd_vma upper = upper_insn & 0x3ff; + bfd_vma lower = lower_insn & 0x7ff; + bfd_vma j1 = (lower_insn & (1 << 13)) >> 13; + bfd_vma j2 = (lower_insn & (1 << 11)) >> 11; + bfd_vma i1 = j1 ^ s ? 0 : 1; + bfd_vma i2 = j2 ^ s ? 0 : 1; + + addend = (i1 << 23) | (i2 << 22) | (upper << 12) | (lower << 1); + /* Sign extend. */ + addend = (addend | ((s ? 0 : 1) << 24)) - (1 << 24); + signed_addend = addend; } @@ -3407,7 +5082,8 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, } else if (elf32_thumb_to_arm_stub (info, sym_name, input_bfd, output_bfd, input_section, - hit_data, sym_sec, rel->r_offset, signed_addend, value)) + hit_data, sym_sec, rel->r_offset, signed_addend, value, + error_message)) return bfd_reloc_ok; else return bfd_reloc_dangerous; @@ -3452,6 +5128,15 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, else signed_check = check | ~((bfd_vma) -1 >> howto->rightshift); + /* Calculate the permissable maximum and minimum values for + this relocation according to whether we're relocating for + Thumb-2 or not. */ + bitsize = howto->bitsize; + if (!thumb2) + bitsize -= 2; + reloc_signed_max = ((1 << (bitsize - 1)) - 1) >> howto->rightshift; + reloc_signed_min = ~reloc_signed_max; + /* Assumes two's complement. */ if (signed_check > reloc_signed_max || signed_check < reloc_signed_min) overflow = TRUE; @@ -3463,9 +5148,17 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, 1 of the base address. */ relocation = (relocation + 2) & ~ 3; - /* Put RELOCATION back into the insn. */ - upper_insn = (upper_insn & ~(bfd_vma) 0x7ff) | ((relocation >> 12) & 0x7ff); - lower_insn = (lower_insn & ~(bfd_vma) 0x7ff) | ((relocation >> 1) & 0x7ff); + /* Put RELOCATION back into the insn. Assumes two's complement. + We use the Thumb-2 encoding, which is safe even if dealing with + a Thumb-1 instruction by virtue of our overflow check above. */ + reloc_sign = (signed_check < 0) ? 1 : 0; + upper_insn = (upper_insn & ~(bfd_vma) 0x7ff) + | ((relocation >> 12) & 0x3ff) + | (reloc_sign << 10); + lower_insn = (lower_insn & ~(bfd_vma) 0x2fff) + | (((!((relocation >> 23) & 1)) ^ reloc_sign) << 13) + | (((!((relocation >> 22) & 1)) ^ reloc_sign) << 11) + | ((relocation >> 1) & 0x7ff); /* Put the relocated value back in the object file: */ bfd_put_16 (input_bfd, upper_insn, hit_data); @@ -3555,9 +5248,8 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, bfd_boolean overflow = FALSE; bfd_vma upper_insn = bfd_get_16 (input_bfd, hit_data); bfd_vma lower_insn = bfd_get_16 (input_bfd, hit_data + 2); - bfd_signed_vma reloc_signed_max = ((1 << (howto->bitsize - 1)) - 1) >> howto->rightshift; - bfd_signed_vma reloc_signed_min = ~ reloc_signed_max; - bfd_vma check; + bfd_signed_vma reloc_signed_max = 0xffffe; + bfd_signed_vma reloc_signed_min = -0x100000; bfd_signed_vma signed_check; /* Need to refetch the addend, reconstruct the top three bits, @@ -3565,14 +5257,14 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, if (globals->use_rel) { bfd_vma S = (upper_insn & 0x0400) >> 10; - bfd_vma upper = (upper_insn & 0x001f); + bfd_vma upper = (upper_insn & 0x003f); bfd_vma J1 = (lower_insn & 0x2000) >> 13; bfd_vma J2 = (lower_insn & 0x0800) >> 11; bfd_vma lower = (lower_insn & 0x07ff); - upper |= J2 << 6; - upper |= J1 << 7; - upper |= ~S << 8; + upper |= J1 << 6; + upper |= J2 << 7; + upper |= (!S) << 8; upper -= 0x0100; /* Sign extend. */ addend = (upper << 12) | (lower << 1); @@ -3586,17 +5278,8 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, relocation -= (input_section->output_section->vma + input_section->output_offset + rel->r_offset); + signed_check = (bfd_signed_vma) relocation; - check = relocation >> howto->rightshift; - - /* If this is a signed value, the rightshift just dropped - leading 1 bits (assuming twos complement). */ - if ((bfd_signed_vma) relocation >= 0) - signed_check = check; - else - signed_check = check | ~((bfd_vma) -1 >> howto->rightshift); - - /* Assumes two's complement. */ if (signed_check > reloc_signed_max || signed_check < reloc_signed_min) overflow = TRUE; @@ -3608,7 +5291,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, bfd_vma hi = (relocation & 0x0003f000) >> 12; bfd_vma lo = (relocation & 0x00000ffe) >> 1; - upper_insn = (upper_insn & 0xfb30) | (S << 10) | hi; + upper_insn = (upper_insn & 0xfbc0) | (S << 10) | hi; lower_insn = (lower_insn & 0xd000) | (J1 << 13) | (J2 << 11) | lo; } @@ -4097,199 +5780,499 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, } return bfd_reloc_ok; - default: - return bfd_reloc_notsupported; - } -} + case R_ARM_MOVW_ABS_NC: + case R_ARM_MOVT_ABS: + case R_ARM_MOVW_PREL_NC: + case R_ARM_MOVT_PREL: + /* Until we properly support segment-base-relative addressing then + we assume the segment base to be zero, as for the group relocations. + Thus R_ARM_MOVW_BREL_NC has the same semantics as R_ARM_MOVW_ABS_NC + and R_ARM_MOVT_BREL has the same semantics as R_ARM_MOVT_ABS. */ + case R_ARM_MOVW_BREL_NC: + case R_ARM_MOVW_BREL: + case R_ARM_MOVT_BREL: + { + bfd_vma insn = bfd_get_32 (input_bfd, hit_data); + if (globals->use_rel) + { + addend = ((insn >> 4) & 0xf000) | (insn & 0xfff); + signed_addend = (addend ^ 0x10000) - 0x10000; + } -static int -uleb128_size (unsigned int i) -{ - int size; - size = 1; - while (i >= 0x80) - { - i >>= 7; - size++; - } - return size; -} + value += signed_addend; -/* Return TRUE if the attribute has the default value (0/""). */ -static bfd_boolean -is_default_attr (aeabi_attribute *attr) -{ - if ((attr->type & 1) && attr->i != 0) - return FALSE; - if ((attr->type & 2) && attr->s && *attr->s) - return FALSE; + if (r_type == R_ARM_MOVW_PREL_NC || r_type == R_ARM_MOVT_PREL) + value -= (input_section->output_section->vma + + input_section->output_offset + rel->r_offset); - return TRUE; -} + if (r_type == R_ARM_MOVW_BREL && value >= 0x10000) + return bfd_reloc_overflow; -/* Return the size of a single attribute. */ -static bfd_vma -eabi_attr_size(int tag, aeabi_attribute *attr) -{ - bfd_vma size; + if (sym_flags == STT_ARM_TFUNC) + value |= 1; - if (is_default_attr (attr)) - return 0; + if (r_type == R_ARM_MOVT_ABS || r_type == R_ARM_MOVT_PREL + || r_type == R_ARM_MOVT_BREL) + value >>= 16; - size = uleb128_size (tag); - if (attr->type & 1) - size += uleb128_size (attr->i); - if (attr->type & 2) - size += strlen ((char *)attr->s) + 1; - return size; -} - -/* Returns the size of the eabi object attributess section. */ -bfd_vma -elf32_arm_eabi_attr_size (bfd *abfd) -{ - bfd_vma size; - aeabi_attribute *attr; - aeabi_attribute_list *list; - int i; + insn &= 0xfff0f000; + insn |= value & 0xfff; + insn |= (value & 0xf000) << 4; + bfd_put_32 (input_bfd, insn, hit_data); + } + return bfd_reloc_ok; + + case R_ARM_THM_MOVW_ABS_NC: + case R_ARM_THM_MOVT_ABS: + case R_ARM_THM_MOVW_PREL_NC: + case R_ARM_THM_MOVT_PREL: + /* Until we properly support segment-base-relative addressing then + we assume the segment base to be zero, as for the above relocations. + Thus R_ARM_THM_MOVW_BREL_NC has the same semantics as + R_ARM_THM_MOVW_ABS_NC and R_ARM_THM_MOVT_BREL has the same semantics + as R_ARM_THM_MOVT_ABS. */ + case R_ARM_THM_MOVW_BREL_NC: + case R_ARM_THM_MOVW_BREL: + case R_ARM_THM_MOVT_BREL: + { + bfd_vma insn; + + insn = bfd_get_16 (input_bfd, hit_data) << 16; + insn |= bfd_get_16 (input_bfd, hit_data + 2); - attr = elf32_arm_tdata (abfd)->known_eabi_attributes; - size = 16; /* 'A' <size> "aeabi" 0x1 <size>. */ - for (i = 4; i < NUM_KNOWN_ATTRIBUTES; i++) - size += eabi_attr_size (i, &attr[i]); + if (globals->use_rel) + { + addend = ((insn >> 4) & 0xf000) + | ((insn >> 15) & 0x0800) + | ((insn >> 4) & 0x0700) + | (insn & 0x00ff); + signed_addend = (addend ^ 0x10000) - 0x10000; + } - for (list = elf32_arm_tdata (abfd)->other_eabi_attributes; - list; - list = list->next) - size += eabi_attr_size (list->tag, &list->attr); + value += signed_addend; - return size; -} + if (r_type == R_ARM_THM_MOVW_PREL_NC || r_type == R_ARM_THM_MOVT_PREL) + value -= (input_section->output_section->vma + + input_section->output_offset + rel->r_offset); -static bfd_byte * -write_uleb128 (bfd_byte *p, unsigned int val) -{ - bfd_byte c; - do - { - c = val & 0x7f; - val >>= 7; - if (val) - c |= 0x80; - *(p++) = c; - } - while (val); - return p; -} + if (r_type == R_ARM_THM_MOVW_BREL && value >= 0x10000) + return bfd_reloc_overflow; -/* Write attribute ATTR to butter P, and return a pointer to the following - byte. */ -static bfd_byte * -write_eabi_attribute (bfd_byte *p, int tag, aeabi_attribute *attr) -{ - /* Suppress default entries. */ - if (is_default_attr(attr)) - return p; - - p = write_uleb128 (p, tag); - if (attr->type & 1) - p = write_uleb128 (p, attr->i); - if (attr->type & 2) - { - int len; + if (sym_flags == STT_ARM_TFUNC) + value |= 1; - len = strlen (attr->s) + 1; - memcpy (p, attr->s, len); - p += len; - } + if (r_type == R_ARM_THM_MOVT_ABS || r_type == R_ARM_THM_MOVT_PREL + || r_type == R_ARM_THM_MOVT_BREL) + value >>= 16; - return p; -} + insn &= 0xfbf08f00; + insn |= (value & 0xf000) << 4; + insn |= (value & 0x0800) << 15; + insn |= (value & 0x0700) << 4; + insn |= (value & 0x00ff); -/* Write the contents of the eabi attributes section to p. */ -void -elf32_arm_set_eabi_attr_contents (bfd *abfd, bfd_byte *contents, bfd_vma size) -{ - bfd_byte *p; - aeabi_attribute *attr; - aeabi_attribute_list *list; - int i; + bfd_put_16 (input_bfd, insn >> 16, hit_data); + bfd_put_16 (input_bfd, insn & 0xffff, hit_data + 2); + } + return bfd_reloc_ok; - p = contents; - *(p++) = 'A'; - bfd_put_32 (abfd, size - 1, p); - p += 4; - memcpy (p, "aeabi", 6); - p += 6; - *(p++) = Tag_File; - bfd_put_32 (abfd, size - 11, p); - p += 4; - - attr = elf32_arm_tdata (abfd)->known_eabi_attributes; - for (i = 4; i < NUM_KNOWN_ATTRIBUTES; i++) - p = write_eabi_attribute (p, i, &attr[i]); - - for (list = elf32_arm_tdata (abfd)->other_eabi_attributes; - list; - list = list->next) - p = write_eabi_attribute (p, list->tag, &list->attr); -} + case R_ARM_ALU_PC_G0_NC: + case R_ARM_ALU_PC_G1_NC: + case R_ARM_ALU_PC_G0: + case R_ARM_ALU_PC_G1: + case R_ARM_ALU_PC_G2: + case R_ARM_ALU_SB_G0_NC: + case R_ARM_ALU_SB_G1_NC: + case R_ARM_ALU_SB_G0: + case R_ARM_ALU_SB_G1: + case R_ARM_ALU_SB_G2: + { + bfd_vma insn = bfd_get_32 (input_bfd, hit_data); + bfd_vma pc = input_section->output_section->vma + + input_section->output_offset + rel->r_offset; + /* sb should be the origin of the *segment* containing the symbol. + It is not clear how to obtain this OS-dependent value, so we + make an arbitrary choice of zero. */ + bfd_vma sb = 0; + bfd_vma residual; + bfd_vma g_n; + bfd_signed_vma signed_value; + int group = 0; + + /* Determine which group of bits to select. */ + switch (r_type) + { + case R_ARM_ALU_PC_G0_NC: + case R_ARM_ALU_PC_G0: + case R_ARM_ALU_SB_G0_NC: + case R_ARM_ALU_SB_G0: + group = 0; + break; + + case R_ARM_ALU_PC_G1_NC: + case R_ARM_ALU_PC_G1: + case R_ARM_ALU_SB_G1_NC: + case R_ARM_ALU_SB_G1: + group = 1; + break; + + case R_ARM_ALU_PC_G2: + case R_ARM_ALU_SB_G2: + group = 2; + break; + + default: + abort(); + } -/* Override final_link to handle EABI object attribute sections. */ + /* If REL, extract the addend from the insn. If RELA, it will + have already been fetched for us. */ + if (globals->use_rel) + { + int negative; + bfd_vma constant = insn & 0xff; + bfd_vma rotation = (insn & 0xf00) >> 8; + + if (rotation == 0) + signed_addend = constant; + else + { + /* Compensate for the fact that in the instruction, the + rotation is stored in multiples of 2 bits. */ + rotation *= 2; + + /* Rotate "constant" right by "rotation" bits. */ + signed_addend = (constant >> rotation) | + (constant << (8 * sizeof (bfd_vma) - rotation)); + } + + /* Determine if the instruction is an ADD or a SUB. + (For REL, this determines the sign of the addend.) */ + negative = identify_add_or_sub (insn); + if (negative == 0) + { + (*_bfd_error_handler) + (_("%B(%A+0x%lx): Only ADD or SUB instructions are allowed for ALU group relocations"), + input_bfd, input_section, + (long) rel->r_offset, howto->name); + return bfd_reloc_overflow; + } + + signed_addend *= negative; + } -static bfd_boolean -elf32_arm_bfd_final_link (bfd *abfd, struct bfd_link_info *info) -{ - asection *o; - struct bfd_link_order *p; - asection *attr_section = NULL; - bfd_byte *contents; - bfd_vma size = 0; - - /* elf32_arm_merge_private_bfd_data will already have merged the - object attributes. Remove the input sections from the link, and set - the contents of the output secton. */ - for (o = abfd->sections; o != NULL; o = o->next) - { - if (strcmp (o->name, ".ARM.attributes") == 0) - { - for (p = o->map_head.link_order; p != NULL; p = p->next) - { - asection *input_section; - - if (p->type != bfd_indirect_link_order) - continue; - input_section = p->u.indirect.section; - /* Hack: reset the SEC_HAS_CONTENTS flag so that - elf_link_input_bfd ignores this section. */ - input_section->flags &= ~SEC_HAS_CONTENTS; - } - - size = elf32_arm_eabi_attr_size (abfd); - bfd_set_section_size (abfd, o, size); - attr_section = o; - /* Skip this section later on. */ - o->map_head.link_order = NULL; - } - } - /* Invoke the ELF linker to do all the work. */ - if (!bfd_elf_final_link (abfd, info)) - return FALSE; + /* Compute the value (X) to go in the place. */ + if (r_type == R_ARM_ALU_PC_G0_NC + || r_type == R_ARM_ALU_PC_G1_NC + || r_type == R_ARM_ALU_PC_G0 + || r_type == R_ARM_ALU_PC_G1 + || r_type == R_ARM_ALU_PC_G2) + /* PC relative. */ + signed_value = value - pc + signed_addend; + else + /* Section base relative. */ + signed_value = value - sb + signed_addend; + + /* If the target symbol is a Thumb function, then set the + Thumb bit in the address. */ + if (sym_flags == STT_ARM_TFUNC) + signed_value |= 1; + + /* Calculate the value of the relevant G_n, in encoded + constant-with-rotation format. */ + g_n = calculate_group_reloc_mask (abs (signed_value), group, + &residual); + + /* Check for overflow if required. */ + if ((r_type == R_ARM_ALU_PC_G0 + || r_type == R_ARM_ALU_PC_G1 + || r_type == R_ARM_ALU_PC_G2 + || r_type == R_ARM_ALU_SB_G0 + || r_type == R_ARM_ALU_SB_G1 + || r_type == R_ARM_ALU_SB_G2) && residual != 0) + { + (*_bfd_error_handler) + (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"), + input_bfd, input_section, + (long) rel->r_offset, abs (signed_value), howto->name); + return bfd_reloc_overflow; + } - if (attr_section) - { - contents = bfd_malloc(size); - if (contents == NULL) - return FALSE; - elf32_arm_set_eabi_attr_contents (abfd, contents, size); - bfd_set_section_contents (abfd, attr_section, contents, 0, size); - free (contents); + /* Mask out the value and the ADD/SUB part of the opcode; take care + not to destroy the S bit. */ + insn &= 0xff1ff000; + + /* Set the opcode according to whether the value to go in the + place is negative. */ + if (signed_value < 0) + insn |= 1 << 22; + else + insn |= 1 << 23; + + /* Encode the offset. */ + insn |= g_n; + + bfd_put_32 (input_bfd, insn, hit_data); + } + return bfd_reloc_ok; + + case R_ARM_LDR_PC_G0: + case R_ARM_LDR_PC_G1: + case R_ARM_LDR_PC_G2: + case R_ARM_LDR_SB_G0: + case R_ARM_LDR_SB_G1: + case R_ARM_LDR_SB_G2: + { + bfd_vma insn = bfd_get_32 (input_bfd, hit_data); + bfd_vma pc = input_section->output_section->vma + + input_section->output_offset + rel->r_offset; + bfd_vma sb = 0; /* See note above. */ + bfd_vma residual; + bfd_signed_vma signed_value; + int group = 0; + + /* Determine which groups of bits to calculate. */ + switch (r_type) + { + case R_ARM_LDR_PC_G0: + case R_ARM_LDR_SB_G0: + group = 0; + break; + + case R_ARM_LDR_PC_G1: + case R_ARM_LDR_SB_G1: + group = 1; + break; + + case R_ARM_LDR_PC_G2: + case R_ARM_LDR_SB_G2: + group = 2; + break; + + default: + abort(); + } + + /* If REL, extract the addend from the insn. If RELA, it will + have already been fetched for us. */ + if (globals->use_rel) + { + int negative = (insn & (1 << 23)) ? 1 : -1; + signed_addend = negative * (insn & 0xfff); + } + + /* Compute the value (X) to go in the place. */ + if (r_type == R_ARM_LDR_PC_G0 + || r_type == R_ARM_LDR_PC_G1 + || r_type == R_ARM_LDR_PC_G2) + /* PC relative. */ + signed_value = value - pc + signed_addend; + else + /* Section base relative. */ + signed_value = value - sb + signed_addend; + + /* Calculate the value of the relevant G_{n-1} to obtain + the residual at that stage. */ + calculate_group_reloc_mask (abs (signed_value), group - 1, &residual); + + /* Check for overflow. */ + if (residual >= 0x1000) + { + (*_bfd_error_handler) + (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"), + input_bfd, input_section, + (long) rel->r_offset, abs (signed_value), howto->name); + return bfd_reloc_overflow; + } + + /* Mask out the value and U bit. */ + insn &= 0xff7ff000; + + /* Set the U bit if the value to go in the place is non-negative. */ + if (signed_value >= 0) + insn |= 1 << 23; + + /* Encode the offset. */ + insn |= residual; + + bfd_put_32 (input_bfd, insn, hit_data); + } + return bfd_reloc_ok; + + case R_ARM_LDRS_PC_G0: + case R_ARM_LDRS_PC_G1: + case R_ARM_LDRS_PC_G2: + case R_ARM_LDRS_SB_G0: + case R_ARM_LDRS_SB_G1: + case R_ARM_LDRS_SB_G2: + { + bfd_vma insn = bfd_get_32 (input_bfd, hit_data); + bfd_vma pc = input_section->output_section->vma + + input_section->output_offset + rel->r_offset; + bfd_vma sb = 0; /* See note above. */ + bfd_vma residual; + bfd_signed_vma signed_value; + int group = 0; + + /* Determine which groups of bits to calculate. */ + switch (r_type) + { + case R_ARM_LDRS_PC_G0: + case R_ARM_LDRS_SB_G0: + group = 0; + break; + + case R_ARM_LDRS_PC_G1: + case R_ARM_LDRS_SB_G1: + group = 1; + break; + + case R_ARM_LDRS_PC_G2: + case R_ARM_LDRS_SB_G2: + group = 2; + break; + + default: + abort(); + } + + /* If REL, extract the addend from the insn. If RELA, it will + have already been fetched for us. */ + if (globals->use_rel) + { + int negative = (insn & (1 << 23)) ? 1 : -1; + signed_addend = negative * (((insn & 0xf00) >> 4) + (insn & 0xf)); + } + + /* Compute the value (X) to go in the place. */ + if (r_type == R_ARM_LDRS_PC_G0 + || r_type == R_ARM_LDRS_PC_G1 + || r_type == R_ARM_LDRS_PC_G2) + /* PC relative. */ + signed_value = value - pc + signed_addend; + else + /* Section base relative. */ + signed_value = value - sb + signed_addend; + + /* Calculate the value of the relevant G_{n-1} to obtain + the residual at that stage. */ + calculate_group_reloc_mask (abs (signed_value), group - 1, &residual); + + /* Check for overflow. */ + if (residual >= 0x100) + { + (*_bfd_error_handler) + (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"), + input_bfd, input_section, + (long) rel->r_offset, abs (signed_value), howto->name); + return bfd_reloc_overflow; + } + + /* Mask out the value and U bit. */ + insn &= 0xff7ff0f0; + + /* Set the U bit if the value to go in the place is non-negative. */ + if (signed_value >= 0) + insn |= 1 << 23; + + /* Encode the offset. */ + insn |= ((residual & 0xf0) << 4) | (residual & 0xf); + + bfd_put_32 (input_bfd, insn, hit_data); + } + return bfd_reloc_ok; + + case R_ARM_LDC_PC_G0: + case R_ARM_LDC_PC_G1: + case R_ARM_LDC_PC_G2: + case R_ARM_LDC_SB_G0: + case R_ARM_LDC_SB_G1: + case R_ARM_LDC_SB_G2: + { + bfd_vma insn = bfd_get_32 (input_bfd, hit_data); + bfd_vma pc = input_section->output_section->vma + + input_section->output_offset + rel->r_offset; + bfd_vma sb = 0; /* See note above. */ + bfd_vma residual; + bfd_signed_vma signed_value; + int group = 0; + + /* Determine which groups of bits to calculate. */ + switch (r_type) + { + case R_ARM_LDC_PC_G0: + case R_ARM_LDC_SB_G0: + group = 0; + break; + + case R_ARM_LDC_PC_G1: + case R_ARM_LDC_SB_G1: + group = 1; + break; + + case R_ARM_LDC_PC_G2: + case R_ARM_LDC_SB_G2: + group = 2; + break; + + default: + abort(); + } + + /* If REL, extract the addend from the insn. If RELA, it will + have already been fetched for us. */ + if (globals->use_rel) + { + int negative = (insn & (1 << 23)) ? 1 : -1; + signed_addend = negative * ((insn & 0xff) << 2); + } + + /* Compute the value (X) to go in the place. */ + if (r_type == R_ARM_LDC_PC_G0 + || r_type == R_ARM_LDC_PC_G1 + || r_type == R_ARM_LDC_PC_G2) + /* PC relative. */ + signed_value = value - pc + signed_addend; + else + /* Section base relative. */ + signed_value = value - sb + signed_addend; + + /* Calculate the value of the relevant G_{n-1} to obtain + the residual at that stage. */ + calculate_group_reloc_mask (abs (signed_value), group - 1, &residual); + + /* Check for overflow. (The absolute value to go in the place must be + divisible by four and, after having been divided by four, must + fit in eight bits.) */ + if ((residual & 0x3) != 0 || residual >= 0x400) + { + (*_bfd_error_handler) + (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"), + input_bfd, input_section, + (long) rel->r_offset, abs (signed_value), howto->name); + return bfd_reloc_overflow; + } + + /* Mask out the value and U bit. */ + insn &= 0xff7fff00; + + /* Set the U bit if the value to go in the place is non-negative. */ + if (signed_value >= 0) + insn |= 1 << 23; + + /* Encode the offset. */ + insn |= residual >> 2; + + bfd_put_32 (input_bfd, insn, hit_data); + } + return bfd_reloc_ok; + + default: + return bfd_reloc_notsupported; } - return TRUE; } - /* Add INCREMENT to the reloc (of type HOWTO) at ADDRESS. */ static void arm_add_to_rel (bfd * abfd, @@ -4392,8 +6375,6 @@ elf32_arm_relocate_section (bfd * output_bfd, struct elf32_arm_link_hash_table * globals; globals = elf32_arm_hash_table (info); - if (info->relocatable && !globals->use_rel) - return TRUE; symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); @@ -4413,6 +6394,7 @@ elf32_arm_relocate_section (bfd * output_bfd, arelent bfd_reloc; char sym_type; bfd_boolean unresolved_reloc = FALSE; + char *error_message = NULL; r_symndx = ELF32_R_SYM (rel->r_info); r_type = ELF32_R_TYPE (rel->r_info); @@ -4425,29 +6407,6 @@ elf32_arm_relocate_section (bfd * output_bfd, bfd_reloc.howto = elf32_arm_howto_from_type (r_type); howto = bfd_reloc.howto; - if (info->relocatable && globals->use_rel) - { - /* This is a relocatable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - arm_add_to_rel (input_bfd, contents + rel->r_offset, - howto, - (bfd_signed_vma) (sec->output_offset - + sym->st_value)); - } - } - - continue; - } - - /* This is a final link. */ h = NULL; sym = NULL; sec = NULL; @@ -4462,8 +6421,9 @@ elf32_arm_relocate_section (bfd * output_bfd, relocation = (sec->output_section->vma + sec->output_offset + sym->st_value); - if ((sec->flags & SEC_MERGE) - && ELF_ST_TYPE (sym->st_info) == STT_SECTION) + if (!info->relocatable + && (sec->flags & SEC_MERGE) + && ELF_ST_TYPE (sym->st_info) == STT_SECTION) { asection *msec; bfd_vma addend, value; @@ -4513,6 +6473,34 @@ elf32_arm_relocate_section (bfd * output_bfd, sym_type = h->type; } + if (sec != NULL && elf_discarded_section (sec)) + { + /* For relocs against symbols from removed linkonce sections, + or sections discarded by a linker script, we just want the + section contents zeroed. Avoid any special processing. */ + _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset); + rel->r_info = 0; + rel->r_addend = 0; + continue; + } + + if (info->relocatable) + { + /* This is a relocatable link. We don't have to change + anything, unless the reloc is against a section symbol, + in which case we have to adjust according to where the + section symbol winds up in the output section. */ + if (sym != NULL && ELF_ST_TYPE (sym->st_info) == STT_SECTION) + { + if (globals->use_rel) + arm_add_to_rel (input_bfd, contents + rel->r_offset, + howto, (bfd_signed_vma) sec->output_offset); + else + rel->r_addend += sec->output_offset; + } + continue; + } + if (h != NULL) name = h->root.root.string; else @@ -4546,7 +6534,7 @@ elf32_arm_relocate_section (bfd * output_bfd, relocation, info, sec, name, (h ? ELF_ST_TYPE (h->type) : ELF_ST_TYPE (sym->st_info)), h, - &unresolved_reloc); + &unresolved_reloc, &error_message); /* Dynamic relocs are not propagated for SEC_DEBUGGING sections because such sections are not SEC_ALLOC and thus ld.so will @@ -4567,8 +6555,6 @@ elf32_arm_relocate_section (bfd * output_bfd, if (r != bfd_reloc_ok) { - const char * msg = (const char *) 0; - switch (r) { case bfd_reloc_overflow: @@ -4592,24 +6578,25 @@ elf32_arm_relocate_section (bfd * output_bfd, break; case bfd_reloc_outofrange: - msg = _("internal error: out of range error"); + error_message = _("out of range"); goto common_error; case bfd_reloc_notsupported: - msg = _("internal error: unsupported relocation error"); + error_message = _("unsupported relocation"); goto common_error; case bfd_reloc_dangerous: - msg = _("internal error: dangerous error"); + /* error_message should already be set. */ goto common_error; default: - msg = _("internal error: unknown error"); + error_message = _("unknown error"); /* fall through */ common_error: - if (!((*info->callbacks->warning) - (info, msg, name, input_bfd, input_section, + BFD_ASSERT (error_message != NULL); + if (!((*info->callbacks->reloc_dangerous) + (info, error_message, input_bfd, input_section, rel->r_offset))) return FALSE; break; @@ -4620,130 +6607,6 @@ elf32_arm_relocate_section (bfd * output_bfd, return TRUE; } -/* Allocate/find an object attribute. */ -static aeabi_attribute * -elf32_arm_new_eabi_attr (bfd *abfd, int tag) -{ - aeabi_attribute *attr; - aeabi_attribute_list *list; - aeabi_attribute_list *p; - aeabi_attribute_list **lastp; - - - if (tag < NUM_KNOWN_ATTRIBUTES) - { - /* Knwon tags are preallocated. */ - attr = &elf32_arm_tdata (abfd)->known_eabi_attributes[tag]; - } - else - { - /* Create a new tag. */ - list = (aeabi_attribute_list *) - bfd_alloc (abfd, sizeof (aeabi_attribute_list)); - memset (list, 0, sizeof (aeabi_attribute_list)); - list->tag = tag; - /* Keep the tag list in order. */ - lastp = &elf32_arm_tdata (abfd)->other_eabi_attributes; - for (p = *lastp; p; p = p->next) - { - if (tag < p->tag) - break; - lastp = &p->next; - } - list->next = *lastp; - *lastp = list; - attr = &list->attr; - } - - return attr; -} - -int -elf32_arm_get_eabi_attr_int (bfd *abfd, int tag) -{ - aeabi_attribute_list *p; - - if (tag < NUM_KNOWN_ATTRIBUTES) - { - /* Knwon tags are preallocated. */ - return elf32_arm_tdata (abfd)->known_eabi_attributes[tag].i; - } - else - { - for (p = elf32_arm_tdata (abfd)->other_eabi_attributes; - p; - p = p->next) - { - if (tag == p->tag) - return p->attr.i; - if (tag < p->tag) - break; - } - return 0; - } -} - -void -elf32_arm_add_eabi_attr_int (bfd *abfd, int tag, unsigned int i) -{ - aeabi_attribute *attr; - - attr = elf32_arm_new_eabi_attr (abfd, tag); - attr->type = 1; - attr->i = i; -} - -static char * -attr_strdup (bfd *abfd, const char * s) -{ - char * p; - int len; - - len = strlen (s) + 1; - p = (char *)bfd_alloc(abfd, len); - return memcpy (p, s, len); -} - -void -elf32_arm_add_eabi_attr_string (bfd *abfd, int tag, const char *s) -{ - aeabi_attribute *attr; - - attr = elf32_arm_new_eabi_attr (abfd, tag); - attr->type = 2; - attr->s = attr_strdup (abfd, s); -} - -void -elf32_arm_add_eabi_attr_compat (bfd *abfd, unsigned int i, const char *s) -{ - aeabi_attribute_list *list; - aeabi_attribute_list *p; - aeabi_attribute_list **lastp; - - list = (aeabi_attribute_list *) - bfd_alloc (abfd, sizeof (aeabi_attribute_list)); - memset (list, 0, sizeof (aeabi_attribute_list)); - list->tag = Tag_compatibility; - list->attr.type = 3; - list->attr.i = i; - list->attr.s = attr_strdup (abfd, s); - - lastp = &elf32_arm_tdata (abfd)->other_eabi_attributes; - for (p = *lastp; p; p = p->next) - { - int cmp; - if (p->tag != Tag_compatibility) - break; - cmp = strcmp(s, p->attr.s); - if (cmp < 0 || (cmp == 0 && i < p->attr.i)) - break; - lastp = &p->next; - } - list->next = *lastp; - *lastp = list; -} - /* Set the right machine number. */ static bfd_boolean @@ -4794,49 +6657,6 @@ elf32_arm_set_private_flags (bfd *abfd, flagword flags) return TRUE; } -/* Copy the eabi object attribute from IBFD to OBFD. */ -static void -copy_eabi_attributes (bfd *ibfd, bfd *obfd) -{ - aeabi_attribute *in_attr; - aeabi_attribute *out_attr; - aeabi_attribute_list *list; - int i; - - in_attr = elf32_arm_tdata (ibfd)->known_eabi_attributes; - out_attr = elf32_arm_tdata (obfd)->known_eabi_attributes; - for (i = 4; i < NUM_KNOWN_ATTRIBUTES; i++) - { - out_attr->i = in_attr->i; - if (in_attr->s && *in_attr->s) - out_attr->s = attr_strdup (obfd, in_attr->s); - in_attr++; - out_attr++; - } - - for (list = elf32_arm_tdata (ibfd)->other_eabi_attributes; - list; - list = list->next) - { - in_attr = &list->attr; - switch (in_attr->type) - { - case 1: - elf32_arm_add_eabi_attr_int (obfd, list->tag, in_attr->i); - break; - case 2: - elf32_arm_add_eabi_attr_string (obfd, list->tag, in_attr->s); - break; - case 3: - elf32_arm_add_eabi_attr_compat (obfd, in_attr->i, in_attr->s); - break; - default: - abort(); - } - } -} - - /* Copy backend specific data from one object module to another. */ static bfd_boolean @@ -4888,8 +6708,8 @@ elf32_arm_copy_private_bfd_data (bfd *ibfd, bfd *obfd) elf_elfheader (obfd)->e_ident[EI_OSABI] = elf_elfheader (ibfd)->e_ident[EI_OSABI]; - /* Copy EABI object attributes. */ - copy_eabi_attributes (ibfd, obfd); + /* Copy object attributes. */ + _bfd_elf_copy_obj_attributes (ibfd, obfd); return TRUE; } @@ -4921,33 +6741,48 @@ enum AEABI_enum_forced_wide }; +/* Determine whether an object attribute tag takes an integer, a + string or both. */ +static int +elf32_arm_obj_attrs_arg_type (int tag) +{ + if (tag == Tag_compatibility) + return 3; + else if (tag == 4 || tag == 5) + return 2; + else if (tag < 32) + return 1; + else + return (tag & 1) != 0 ? 2 : 1; +} + /* Merge EABI object attributes from IBFD into OBFD. Raise an error if there are conflicting attributes. */ static bfd_boolean elf32_arm_merge_eabi_attributes (bfd *ibfd, bfd *obfd) { - aeabi_attribute *in_attr; - aeabi_attribute *out_attr; - aeabi_attribute_list *in_list; - aeabi_attribute_list *out_list; + obj_attribute *in_attr; + obj_attribute *out_attr; + obj_attribute_list *in_list; /* Some tags have 0 = don't care, 1 = strong requirement, 2 = weak requirement. */ static const int order_312[3] = {3, 1, 2}; int i; - if (!elf32_arm_tdata (ibfd)->known_eabi_attributes[0].i) + if (!elf_known_obj_attributes_proc (obfd)[0].i) { /* This is the first object. Copy the attributes. */ - copy_eabi_attributes (ibfd, obfd); + _bfd_elf_copy_obj_attributes (ibfd, obfd); + + /* Use the Tag_null value to indicate the attributes have been + initialized. */ + elf_known_obj_attributes_proc (obfd)[0].i = 1; + return TRUE; } - /* Use the Tag_null value to indicate the attributes have been - initialized. */ - elf32_arm_tdata (ibfd)->known_eabi_attributes[0].i = 1; - - in_attr = elf32_arm_tdata (ibfd)->known_eabi_attributes; - out_attr = elf32_arm_tdata (obfd)->known_eabi_attributes; + in_attr = elf_known_obj_attributes_proc (ibfd); + out_attr = elf_known_obj_attributes_proc (obfd); /* This needs to happen before Tag_ABI_FP_number_model is merged. */ if (in_attr[Tag_ABI_VFP_args].i != out_attr[Tag_ABI_VFP_args].i) { @@ -4963,16 +6798,19 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, bfd *obfd) } } - for (i = 4; i < NUM_KNOWN_ATTRIBUTES; i++) + for (i = 4; i < NUM_KNOWN_OBJ_ATTRIBUTES; i++) { /* Merge this attribute with existing attributes. */ switch (i) { case Tag_CPU_raw_name: case Tag_CPU_name: - /* Use whichever has the greatest architecture requirements. */ - if (in_attr[Tag_CPU_arch].i > out_attr[Tag_CPU_arch].i) - out_attr[i].s = attr_strdup(obfd, in_attr[i].s); + /* Use whichever has the greatest architecture requirements. We + won't necessarily have both the above tags, so make sure input + name is non-NULL. */ + if (in_attr[Tag_CPU_arch].i > out_attr[Tag_CPU_arch].i + && in_attr[i].s) + out_attr[i].s = _bfd_elf_attr_strdup (obfd, in_attr[i].s); break; case Tag_ABI_optimization_goals: @@ -5023,7 +6861,8 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, bfd *obfd) } break; case Tag_ABI_PCS_R9_use: - if (out_attr[i].i != AEABI_R9_unused + if (in_attr[i].i != out_attr[i].i + && out_attr[i].i != AEABI_R9_unused && in_attr[i].i != AEABI_R9_unused) { _bfd_error_handler @@ -5084,10 +6923,15 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, bfd *obfd) out_attr[i].i = in_attr[i].i; } else if (in_attr[i].i != AEABI_enum_forced_wide - && out_attr[i].i != in_attr[i].i) + && out_attr[i].i != in_attr[i].i + && !elf32_arm_tdata (obfd)->no_enum_size_warning) { + const char *aeabi_enum_names[] = + { "", "variable-size", "32-bit", "" }; _bfd_error_handler - (_("ERROR: %B: Conflicting enum sizes"), ibfd); + (_("warning: %B uses %s enums yet the output is to use %s enums; use of enum values across objects may fail"), + ibfd, aeabi_enum_names[in_attr[i].i], + aeabi_enum_names[out_attr[i].i]); } } break; @@ -5108,60 +6952,13 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, bfd *obfd) } } - in_list = elf32_arm_tdata (ibfd)->other_eabi_attributes; - out_list = elf32_arm_tdata (ibfd)->other_eabi_attributes; - while (in_list && in_list->tag == Tag_compatibility) - { - in_attr = &in_list->attr; - if (in_attr->i == 0) - continue; - if (in_attr->i == 1) - { - _bfd_error_handler - (_("ERROR: %B: Must be processed by '%s' toolchain"), - ibfd, in_attr->s); - return FALSE; - } - if (!out_list || out_list->tag != Tag_compatibility - || strcmp (in_attr->s, out_list->attr.s) != 0) - { - /* Add this compatibility tag to the output. */ - elf32_arm_add_eabi_attr_compat (obfd, in_attr->i, in_attr->s); - continue; - } - out_attr = &out_list->attr; - /* Check all the input tags with the same identifier. */ - for (;;) - { - if (out_list->tag != Tag_compatibility - || in_attr->i != out_attr->i - || strcmp (in_attr->s, out_attr->s) != 0) - { - _bfd_error_handler - (_("ERROR: %B: Incompatible object tag '%s':%d"), - ibfd, in_attr->s, in_attr->i); - return FALSE; - } - in_list = in_list->next; - if (in_list->tag != Tag_compatibility - || strcmp (in_attr->s, in_list->attr.s) != 0) - break; - in_attr = &in_list->attr; - out_list = out_list->next; - if (out_list) - out_attr = &out_list->attr; - } + /* Merge Tag_compatibility attributes and any common GNU ones. */ + _bfd_elf_merge_object_attributes (ibfd, obfd); - /* Check the output doesn't have extra tags with this identifier. */ - if (out_list && out_list->tag == Tag_compatibility - && strcmp (in_attr->s, out_list->attr.s) == 0) - { - _bfd_error_handler - (_("ERROR: %B: Incompatible object tag '%s':%d"), - ibfd, in_attr->s, out_list->attr.i); - return FALSE; - } - } + /* Check for any attributes not known on ARM. */ + in_list = elf_other_obj_attributes_proc (ibfd); + while (in_list && in_list->tag == Tag_compatibility) + in_list = in_list->next; for (; in_list; in_list = in_list->next) { @@ -5563,39 +7360,21 @@ elf32_arm_get_symbol_type (Elf_Internal_Sym * elf_sym, int type) } static asection * -elf32_arm_gc_mark_hook (asection * sec, - struct bfd_link_info * info ATTRIBUTE_UNUSED, - Elf_Internal_Rela * rel, - struct elf_link_hash_entry * h, - Elf_Internal_Sym * sym) +elf32_arm_gc_mark_hook (asection *sec, + struct bfd_link_info *info, + Elf_Internal_Rela *rel, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) { if (h != NULL) - { - switch (ELF32_R_TYPE (rel->r_info)) + switch (ELF32_R_TYPE (rel->r_info)) { case R_ARM_GNU_VTINHERIT: case R_ARM_GNU_VTENTRY: - break; - - default: - switch (h->root.type) - { - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - return h->root.u.def.section; - - case bfd_link_hash_common: - return h->root.u.c.p->section; - - default: - break; - } - } - } - else - return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + return NULL; + } - return NULL; + return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym); } /* Update the got entry reference counts for the section being removed. */ @@ -5661,13 +7440,23 @@ elf32_arm_gc_sweep_hook (bfd * abfd, break; case R_ARM_ABS32: + case R_ARM_ABS32_NOI: case R_ARM_REL32: + case R_ARM_REL32_NOI: case R_ARM_PC24: case R_ARM_PLT32: case R_ARM_CALL: case R_ARM_JUMP24: case R_ARM_PREL31: case R_ARM_THM_CALL: + case R_ARM_MOVW_ABS_NC: + case R_ARM_MOVT_ABS: + case R_ARM_MOVW_PREL_NC: + case R_ARM_MOVT_PREL: + case R_ARM_THM_MOVW_ABS_NC: + case R_ARM_THM_MOVT_ABS: + case R_ARM_THM_MOVW_PREL_NC: + case R_ARM_THM_MOVT_PREL: /* Should the interworking branches be here also? */ if (h != NULL) @@ -5686,14 +7475,17 @@ elf32_arm_gc_sweep_hook (bfd * abfd, } if (r_type == R_ARM_ABS32 - || r_type == R_ARM_REL32) + || r_type == R_ARM_REL32 + || r_type == R_ARM_ABS32_NOI + || r_type == R_ARM_REL32_NOI) { for (pp = &eh->relocs_copied; (p = *pp) != NULL; pp = &p->next) if (p->section == sec) { p->count -= 1; - if (ELF32_R_TYPE (rel->r_info) == R_ARM_REL32) + if (ELF32_R_TYPE (rel->r_info) == R_ARM_REL32 + || ELF32_R_TYPE (rel->r_info) == R_ARM_REL32_NOI) p->pc_count -= 1; if (p->count == 0) *pp = p->next; @@ -5871,13 +7663,23 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, /* Fall through */ case R_ARM_ABS32: + case R_ARM_ABS32_NOI: case R_ARM_REL32: + case R_ARM_REL32_NOI: case R_ARM_PC24: case R_ARM_PLT32: case R_ARM_CALL: case R_ARM_JUMP24: case R_ARM_PREL31: case R_ARM_THM_CALL: + case R_ARM_MOVW_ABS_NC: + case R_ARM_MOVT_ABS: + case R_ARM_MOVW_PREL_NC: + case R_ARM_MOVT_PREL: + case R_ARM_THM_MOVW_ABS_NC: + case R_ARM_THM_MOVT_ABS: + case R_ARM_THM_MOVW_PREL_NC: + case R_ARM_THM_MOVT_PREL: /* Should the interworking branches be listed here? */ if (h != NULL) { @@ -5894,12 +7696,11 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, refers to is in a different object. We can't tell for sure yet, because something later might force the symbol local. */ - if (r_type == R_ARM_PC24 - || r_type == R_ARM_CALL - || r_type == R_ARM_JUMP24 - || r_type == R_ARM_PREL31 - || r_type == R_ARM_PLT32 - || r_type == R_ARM_THM_CALL) + if (r_type != R_ARM_ABS32 + && r_type != R_ARM_REL32 + && r_type != R_ARM_ABS32_NOI + && r_type != R_ARM_REL32_NOI + && r_type != R_ARM_ABS12) h->needs_plt = 1; /* If we create a PLT entry, this relocation will reference @@ -5924,7 +7725,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, relocs_copied field of the hash table entry. */ if ((info->shared || htab->root.is_relocatable_executable) && (sec->flags & SEC_ALLOC) != 0 - && (r_type == R_ARM_ABS32 + && ((r_type == R_ARM_ABS32 || r_type == R_ARM_ABS32_NOI) || (h != NULL && ! h->needs_plt && (! info->symbolic || ! h->def_regular)))) { @@ -6008,7 +7809,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, p->pc_count = 0; } - if (r_type == R_ARM_REL32) + if (r_type == R_ARM_REL32 || r_type == R_ARM_REL32_NOI) p->pc_count += 1; p->count += 1; } @@ -6033,12 +7834,57 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, return TRUE; } +/* Unwinding tables are not referenced directly. This pass marks them as + required if the corresponding code section is marked. */ + +static bfd_boolean +elf32_arm_gc_mark_extra_sections(struct bfd_link_info *info, + elf_gc_mark_hook_fn gc_mark_hook) +{ + bfd *sub; + Elf_Internal_Shdr **elf_shdrp; + bfd_boolean again; + + /* Marking EH data may cause additional code sections to be marked, + requiring multiple passes. */ + again = TRUE; + while (again) + { + again = FALSE; + for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) + { + asection *o; + + if (bfd_get_flavour (sub) != bfd_target_elf_flavour) + continue; + + elf_shdrp = elf_elfsections (sub); + for (o = sub->sections; o != NULL; o = o->next) + { + Elf_Internal_Shdr *hdr; + hdr = &elf_section_data (o)->this_hdr; + if (hdr->sh_type == SHT_ARM_EXIDX && hdr->sh_link + && !o->gc_mark + && elf_shdrp[hdr->sh_link]->bfd_section->gc_mark) + { + again = TRUE; + if (!_bfd_elf_gc_mark (info, o, gc_mark_hook)) + return FALSE; + } + } + } + } + + return TRUE; +} + /* Treat mapping symbols as special target symbols. */ static bfd_boolean elf32_arm_is_target_special_symbol (bfd * abfd ATTRIBUTE_UNUSED, asymbol * sym) { - return bfd_is_arm_mapping_symbol_name (sym->name); + return bfd_is_arm_special_symbol_name (sym->name, + BFD_ARM_SPECIAL_SYM_TYPE_ANY); } /* This is a copy of elf_find_function() from elf.c except that @@ -6074,9 +7920,10 @@ arm_elf_find_function (bfd * abfd ATTRIBUTE_UNUSED, case STT_FUNC: case STT_ARM_TFUNC: case STT_NOTYPE: - /* Skip $a and $t symbols. */ + /* Skip mapping symbols. */ if ((q->symbol.flags & BSF_LOCAL) - && bfd_is_arm_mapping_symbol_name (q->symbol.name)) + && bfd_is_arm_special_symbol_name (q->symbol.name, + BFD_ARM_SPECIAL_SYM_TYPE_ANY)) continue; /* Fall through. */ if (bfd_get_section (&q->symbol) == section @@ -6177,7 +8024,6 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info, { bfd * dynobj; asection * s; - unsigned int power_of_two; struct elf32_arm_link_hash_entry * eh; struct elf32_arm_link_hash_table *globals; @@ -6290,28 +8136,7 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info, h->needs_copy = 1; } - /* We need to figure out the alignment required for this symbol. I - have no idea how ELF linkers handle this. */ - power_of_two = bfd_log2 (h->size); - if (power_of_two > 3) - power_of_two = 3; - - /* Apply the required alignment. */ - s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); - if (power_of_two > bfd_get_section_alignment (dynobj, s)) - { - if (! bfd_set_section_alignment (dynobj, s, power_of_two)) - return FALSE; - } - - /* Define the symbol as being at this point in the section. */ - h->root.u.def.section = s; - h->root.u.def.value = s->size; - - /* Increment the section size to make room for the symbol. */ - s->size += h->size; - - return TRUE; + return _bfd_elf_adjust_dynamic_copy (h, s); } /* Allocate space in .plt, .got and associated reloc sections for @@ -6500,6 +8325,37 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) else h->got.offset = (bfd_vma) -1; + /* Allocate stubs for exported Thumb functions on v4t. */ + if (!htab->use_blx && h->dynindx != -1 + && h->def_regular + && ELF_ST_TYPE (h->type) == STT_ARM_TFUNC + && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) + { + struct elf_link_hash_entry * th; + struct bfd_link_hash_entry * bh; + struct elf_link_hash_entry * myh; + char name[1024]; + asection *s; + bh = NULL; + /* Create a new symbol to regist the real location of the function. */ + s = h->root.u.def.section; + sprintf(name, "__real_%s", h->root.root.string); + _bfd_generic_link_add_one_symbol (info, s->owner, + name, BSF_GLOBAL, s, + h->root.u.def.value, + NULL, TRUE, FALSE, &bh); + + myh = (struct elf_link_hash_entry *) bh; + myh->type = ELF_ST_INFO (STB_LOCAL, STT_ARM_TFUNC); + myh->forced_local = 1; + eh->export_glue = myh; + th = record_arm_to_thumb_glue (info, h); + /* Point the symbol at the stub. */ + h->type = ELF_ST_INFO (ELF_ST_BIND (h->type), STT_FUNC); + h->root.u.def.section = th->root.u.def.section; + h->root.u.def.value = th->root.u.def.value & ~1; + } + if (eh->relocs_copied == NULL) return TRUE; @@ -6511,12 +8367,12 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) if (info->shared || htab->root.is_relocatable_executable) { - /* The only reloc that uses pc_count is R_ARM_REL32, which will - appear on something like ".long foo - .". We want calls to - protected symbols to resolve directly to the function rather - than going via the plt. If people want function pointer - comparisons to work as expected then they should avoid - writing assembly like ".long foo - .". */ + /* The only relocs that use pc_count are R_ARM_REL32 and + R_ARM_REL32_NOI, which will appear on something like + ".long foo - .". We want calls to protected symbols to resolve + directly to the function rather than going via the plt. If people + want function pointer comparisons to work as expected then they + should avoid writing assembly like ".long foo - .". */ if (SYMBOL_CALLS_LOCAL (info, h)) { struct elf32_arm_relocs_copied **pp; @@ -6633,6 +8489,16 @@ elf32_arm_readonly_dynrelocs (struct elf_link_hash_entry *h, PTR inf) return TRUE; } +void +bfd_elf32_arm_set_byteswap_code (struct bfd_link_info *info, + int byteswap_code) +{ + struct elf32_arm_link_hash_table *globals; + + globals = elf32_arm_hash_table (info); + globals->byteswap_code = byteswap_code; +} + /* Set the sizes of the dynamic sections. */ static bfd_boolean @@ -6748,6 +8614,19 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED, sym dynamic relocs. */ elf_link_hash_traverse (& htab->root, allocate_dynrelocs, info); + /* Here we rummage through the found bfds to collect glue information. */ + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + { + /* Initialise mapping tables for code/data. */ + bfd_elf32_arm_init_maps (ibfd); + + if (!bfd_elf32_arm_process_before_allocation (ibfd, info) + || !bfd_elf32_arm_vfp11_erratum_scan (ibfd, info)) + /* xgettext:c-format */ + _bfd_error_handler (_("Errors encountered processing file %s"), + ibfd->filename); + } + /* The check_relocs and adjust_dynamic_symbol entry points have determined the sizes of the various dynamic sections. Allocate memory for them. */ @@ -6769,7 +8648,7 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED, /* Remember whether there is a PLT. */ plt = s->size != 0; } - else if (strncmp (name, ".rel", 4) == 0) + else if (CONST_STRNEQ (name, ".rel")) { if (s->size != 0) { @@ -6783,7 +8662,7 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED, s->reloc_count = 0; } } - else if (strncmp (name, ".got", 4) != 0 + else if (! CONST_STRNEQ (name, ".got") && strcmp (name, ".dynbss") != 0) { /* It's not one of our sections, so don't allocate space. */ @@ -6910,16 +8789,17 @@ elf32_arm_finish_dynamic_symbol (bfd * output_bfd, struct bfd_link_info * info, /* Fill in the entry in the procedure linkage table. */ if (htab->symbian_p) { - unsigned i; - for (i = 0; i < htab->plt_entry_size / 4; ++i) - bfd_put_32 (output_bfd, - elf32_arm_symbian_plt_entry[i], - splt->contents + h->plt.offset + 4 * i); + put_arm_insn (htab, output_bfd, + elf32_arm_symbian_plt_entry[0], + splt->contents + h->plt.offset); + bfd_put_32 (output_bfd, + elf32_arm_symbian_plt_entry[1], + splt->contents + h->plt.offset + 4); /* Fill in the entry in the .rel.plt section. */ rel.r_offset = (splt->output_section->vma + splt->output_offset - + h->plt.offset + 4 * (i - 1)); + + h->plt.offset + 4); rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_GLOB_DAT); /* Get the index in the procedure linkage table which @@ -6934,6 +8814,7 @@ elf32_arm_finish_dynamic_symbol (bfd * output_bfd, struct bfd_link_info * info, bfd_vma got_offset, got_address, plt_address; bfd_vma got_displacement; asection * sgot; + bfd_byte * ptr; sgot = bfd_get_section_by_name (dynobj, ".got.plt"); BFD_ASSERT (sgot != NULL); @@ -6959,20 +8840,23 @@ elf32_arm_finish_dynamic_symbol (bfd * output_bfd, struct bfd_link_info * info, + splt->output_offset + h->plt.offset); + ptr = htab->splt->contents + h->plt.offset; if (htab->vxworks_p && info->shared) { unsigned int i; bfd_vma val; - for (i = 0; i != htab->plt_entry_size / 4; i++) + for (i = 0; i != htab->plt_entry_size / 4; i++, ptr += 4) { val = elf32_arm_vxworks_shared_plt_entry[i]; if (i == 2) val |= got_address - sgot->output_section->vma; if (i == 5) val |= plt_index * RELOC_SIZE (htab); - bfd_put_32 (output_bfd, val, - htab->splt->contents + h->plt.offset + i * 4); + if (i == 2 || i == 5) + bfd_put_32 (output_bfd, val, ptr); + else + put_arm_insn (htab, output_bfd, val, ptr); } } else if (htab->vxworks_p) @@ -6980,7 +8864,7 @@ elf32_arm_finish_dynamic_symbol (bfd * output_bfd, struct bfd_link_info * info, unsigned int i; bfd_vma val; - for (i = 0; i != htab->plt_entry_size / 4; i++) + for (i = 0; i != htab->plt_entry_size / 4; i++, ptr += 4) { val = elf32_arm_vxworks_exec_plt_entry[i]; if (i == 2) @@ -6989,8 +8873,10 @@ elf32_arm_finish_dynamic_symbol (bfd * output_bfd, struct bfd_link_info * info, val |= 0xffffff & -((h->plt.offset + i * 4 + 8) >> 2); if (i == 5) val |= plt_index * RELOC_SIZE (htab); - bfd_put_32 (output_bfd, val, - htab->splt->contents + h->plt.offset + i * 4); + if (i == 2 || i == 5) + bfd_put_32 (output_bfd, val, ptr); + else + put_arm_insn (htab, output_bfd, val, ptr); } loc = (htab->srelplt2->contents @@ -7023,27 +8909,26 @@ elf32_arm_finish_dynamic_symbol (bfd * output_bfd, struct bfd_link_info * info, if (!htab->use_blx && eh->plt_thumb_refcount > 0) { - bfd_put_16 (output_bfd, elf32_arm_plt_thumb_stub[0], - splt->contents + h->plt.offset - 4); - bfd_put_16 (output_bfd, elf32_arm_plt_thumb_stub[1], - splt->contents + h->plt.offset - 2); + put_thumb_insn (htab, output_bfd, + elf32_arm_plt_thumb_stub[0], ptr - 4); + put_thumb_insn (htab, output_bfd, + elf32_arm_plt_thumb_stub[1], ptr - 2); } - bfd_put_32 (output_bfd, - elf32_arm_plt_entry[0] - | ((got_displacement & 0x0ff00000) >> 20), - splt->contents + h->plt.offset + 0); - bfd_put_32 (output_bfd, - elf32_arm_plt_entry[1] - | ((got_displacement & 0x000ff000) >> 12), - splt->contents + h->plt.offset + 4); - bfd_put_32 (output_bfd, - elf32_arm_plt_entry[2] - | (got_displacement & 0x00000fff), - splt->contents + h->plt.offset + 8); + put_arm_insn (htab, output_bfd, + elf32_arm_plt_entry[0] + | ((got_displacement & 0x0ff00000) >> 20), + ptr + 0); + put_arm_insn (htab, output_bfd, + elf32_arm_plt_entry[1] + | ((got_displacement & 0x000ff000) >> 12), + ptr+ 4); + put_arm_insn (htab, output_bfd, + elf32_arm_plt_entry[2] + | (got_displacement & 0x00000fff), + ptr + 8); #ifdef FOUR_WORD_PLT - bfd_put_32 (output_bfd, elf32_arm_plt_entry[3], - splt->contents + h->plt.offset + 12); + bfd_put_32 (output_bfd, elf32_arm_plt_entry[3], ptr + 12); #endif } @@ -7353,9 +9238,12 @@ elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info Elf_Internal_Rela rel; plt0_entry = elf32_arm_vxworks_exec_plt0_entry; - bfd_put_32 (output_bfd, plt0_entry[0], splt->contents + 0); - bfd_put_32 (output_bfd, plt0_entry[1], splt->contents + 4); - bfd_put_32 (output_bfd, plt0_entry[2], splt->contents + 8); + put_arm_insn (htab, output_bfd, plt0_entry[0], + splt->contents + 0); + put_arm_insn (htab, output_bfd, plt0_entry[1], + splt->contents + 4); + put_arm_insn (htab, output_bfd, plt0_entry[2], + splt->contents + 8); bfd_put_32 (output_bfd, got_address, splt->contents + 12); /* Generate a relocation for _GLOBAL_OFFSET_TABLE_. */ @@ -7370,10 +9258,14 @@ elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info got_displacement = got_address - (plt_address + 16); plt0_entry = elf32_arm_plt0_entry; - bfd_put_32 (output_bfd, plt0_entry[0], splt->contents + 0); - bfd_put_32 (output_bfd, plt0_entry[1], splt->contents + 4); - bfd_put_32 (output_bfd, plt0_entry[2], splt->contents + 8); - bfd_put_32 (output_bfd, plt0_entry[3], splt->contents + 12); + put_arm_insn (htab, output_bfd, plt0_entry[0], + splt->contents + 0); + put_arm_insn (htab, output_bfd, plt0_entry[1], + splt->contents + 4); + put_arm_insn (htab, output_bfd, plt0_entry[2], + splt->contents + 8); + put_arm_insn (htab, output_bfd, plt0_entry[3], + splt->contents + 12); #ifdef FOUR_WORD_PLT /* The displacement value goes in the otherwise-unused @@ -7387,7 +9279,8 @@ elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info /* UnixWare sets the entsize of .plt to 4, although that doesn't really seem like the right value. */ - elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4; + if (splt->output_section->owner == output_bfd) + elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4; if (htab->vxworks_p && !info->shared && htab->splt->size > 0) { @@ -7498,12 +9391,8 @@ elf32_arm_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED static bfd_boolean is_arm_elf_unwind_section_name (bfd * abfd ATTRIBUTE_UNUSED, const char * name) { - size_t len1, len2; - - len1 = sizeof (ELF_STRING_ARM_unwind) - 1; - len2 = sizeof (ELF_STRING_ARM_unwind_once) - 1; - return (strncmp (name, ELF_STRING_ARM_unwind, len1) == 0 - || strncmp (name, ELF_STRING_ARM_unwind_once, len2) == 0); + return (CONST_STRNEQ (name, ELF_STRING_ARM_unwind) + || CONST_STRNEQ (name, ELF_STRING_ARM_unwind_once)); } @@ -7522,125 +9411,9 @@ elf32_arm_fake_sections (bfd * abfd, Elf_Internal_Shdr * hdr, asection * sec) hdr->sh_type = SHT_ARM_EXIDX; hdr->sh_flags |= SHF_LINK_ORDER; } - else if (strcmp(name, ".ARM.attributes") == 0) - { - hdr->sh_type = SHT_ARM_ATTRIBUTES; - } return TRUE; } -/* Parse an Arm EABI attributes section. */ -static void -elf32_arm_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr) -{ - bfd_byte *contents; - bfd_byte *p; - bfd_vma len; - - contents = bfd_malloc (hdr->sh_size); - if (!contents) - return; - if (!bfd_get_section_contents (abfd, hdr->bfd_section, contents, 0, - hdr->sh_size)) - { - free (contents); - return; - } - p = contents; - if (*(p++) == 'A') - { - len = hdr->sh_size - 1; - while (len > 0) - { - int namelen; - bfd_vma section_len; - - section_len = bfd_get_32 (abfd, p); - p += 4; - if (section_len > len) - section_len = len; - len -= section_len; - namelen = strlen ((char *)p) + 1; - section_len -= namelen + 4; - if (strcmp((char *)p, "aeabi") != 0) - { - /* Vendor section. Ignore it. */ - p += namelen + section_len; - } - else - { - p += namelen; - while (section_len > 0) - { - int tag; - unsigned int n; - unsigned int val; - bfd_vma subsection_len; - bfd_byte *end; - - tag = read_unsigned_leb128 (abfd, p, &n); - p += n; - subsection_len = bfd_get_32 (abfd, p); - p += 4; - if (subsection_len > section_len) - subsection_len = section_len; - section_len -= subsection_len; - subsection_len -= n + 4; - end = p + subsection_len; - switch (tag) - { - case Tag_File: - while (p < end) - { - bfd_boolean is_string; - - tag = read_unsigned_leb128 (abfd, p, &n); - p += n; - if (tag == 4 || tag == 5) - is_string = 1; - else if (tag < 32) - is_string = 0; - else - is_string = (tag & 1) != 0; - if (tag == Tag_compatibility) - { - val = read_unsigned_leb128 (abfd, p, &n); - p += n; - elf32_arm_add_eabi_attr_compat (abfd, val, - (char *)p); - p += strlen ((char *)p) + 1; - } - else if (is_string) - { - elf32_arm_add_eabi_attr_string (abfd, tag, - (char *)p); - p += strlen ((char *)p) + 1; - } - else - { - val = read_unsigned_leb128 (abfd, p, &n); - p += n; - elf32_arm_add_eabi_attr_int (abfd, tag, val); - } - } - break; - case Tag_Section: - case Tag_Symbol: - /* Don't have anywhere convenient to attach these. - Fall through for now. */ - default: - /* Ignore things we don't kow about. */ - p += subsection_len; - subsection_len = 0; - break; - } - } - } - } - } - free (contents); -} - /* Handle an ARM specific section when reading an object file. This is called when bfd_section_from_shdr finds a section with an unknown type. */ @@ -7670,8 +9443,6 @@ elf32_arm_section_from_shdr (bfd *abfd, if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex)) return FALSE; - if (hdr->sh_type == SHT_ARM_ATTRIBUTES) - elf32_arm_parse_attributes(abfd, hdr); return TRUE; } @@ -7776,61 +9547,218 @@ unrecord_section_with_arm_elf_section_data (asection * sec) } } -/* Called for each symbol. Builds a section map based on mapping symbols. - Does not alter any of the symbols. */ -static bfd_boolean -elf32_arm_output_symbol_hook (struct bfd_link_info *info, - const char *name, - Elf_Internal_Sym *elfsym, - asection *input_sec, - struct elf_link_hash_entry *h) +typedef struct { - int mapcount; - elf32_arm_section_map *map; - elf32_arm_section_map *newmap; - _arm_elf_section_data *arm_data; - struct elf32_arm_link_hash_table *globals; + void *finfo; + struct bfd_link_info *info; + asection *sec; + int sec_shndx; + bfd_boolean (*func) (void *, const char *, Elf_Internal_Sym *, + asection *, struct elf_link_hash_entry *); +} output_arch_syminfo; - globals = elf32_arm_hash_table (info); - if (globals->vxworks_p - && !elf_vxworks_link_output_symbol_hook (info, name, elfsym, - input_sec, h)) +enum map_symbol_type +{ + ARM_MAP_ARM, + ARM_MAP_THUMB, + ARM_MAP_DATA +}; + + +/* Output a single PLT mapping symbol. */ + +static bfd_boolean +elf32_arm_ouput_plt_map_sym (output_arch_syminfo *osi, + enum map_symbol_type type, + bfd_vma offset) +{ + static const char *names[3] = {"$a", "$t", "$d"}; + struct elf32_arm_link_hash_table *htab; + Elf_Internal_Sym sym; + + htab = elf32_arm_hash_table (osi->info); + sym.st_value = osi->sec->output_section->vma + + osi->sec->output_offset + + offset; + sym.st_size = 0; + sym.st_other = 0; + sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_NOTYPE); + sym.st_shndx = osi->sec_shndx; + if (!osi->func (osi->finfo, names[type], &sym, osi->sec, NULL)) return FALSE; + return TRUE; +} - /* Only do this on final link. */ - if (info->relocatable) - return TRUE; - /* Only build a map if we need to byteswap code. */ - if (!globals->byteswap_code) - return TRUE; +/* Output mapping symbols for PLT entries associated with H. */ - /* We only want mapping symbols. */ - if (! bfd_is_arm_mapping_symbol_name (name)) +static bfd_boolean +elf32_arm_output_plt_map (struct elf_link_hash_entry *h, void *inf) +{ + output_arch_syminfo *osi = (output_arch_syminfo *) inf; + struct elf32_arm_link_hash_table *htab; + struct elf32_arm_link_hash_entry *eh; + bfd_vma addr; + + htab = elf32_arm_hash_table (osi->info); + + if (h->root.type == bfd_link_hash_indirect) return TRUE; - /* If this section has not been allocated an _arm_elf_section_data - structure then we cannot record anything. */ - arm_data = get_arm_elf_section_data (input_sec); - if (arm_data == NULL) + if (h->root.type == bfd_link_hash_warning) + /* When warning symbols are created, they **replace** the "real" + entry in the hash table, thus we never get to see the real + symbol in a hash traversal. So look at it now. */ + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + if (h->plt.offset == (bfd_vma) -1) return TRUE; - mapcount = arm_data->mapcount + 1; - map = arm_data->map; + eh = (struct elf32_arm_link_hash_entry *) h; + addr = h->plt.offset; + if (htab->symbian_p) + { + if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_ARM, addr)) + return FALSE; + if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_DATA, addr + 4)) + return FALSE; + } + else if (htab->vxworks_p) + { + if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_ARM, addr)) + return FALSE; + if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_DATA, addr + 8)) + return FALSE; + if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_ARM, addr + 12)) + return FALSE; + if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_DATA, addr + 20)) + return FALSE; + } + else + { + bfd_boolean thumb_stub; + + thumb_stub = eh->plt_thumb_refcount > 0 && !htab->use_blx; + if (thumb_stub) + { + if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_THUMB, addr - 4)) + return FALSE; + } +#ifdef FOUR_WORD_PLT + if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_ARM, addr)) + return FALSE; + if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_DATA, addr + 12)) + return FALSE; +#else + /* A three-word PLT with no Thumb thunk contains only Arm code, + so only need to output a mapping symbol for the first PLT entry and + entries with thumb thunks. */ + if (thumb_stub || addr == 20) + { + if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_ARM, addr)) + return FALSE; + } +#endif + } - /* TODO: This may be inefficient, but we probably don't usually have many - mapping symbols per section. */ - newmap = bfd_realloc (map, mapcount * sizeof (* map)); - if (newmap != NULL) + return TRUE; +} + + +/* Output mapping symbols for linker generated sections. */ + +static bfd_boolean +elf32_arm_output_arch_local_syms (bfd *output_bfd, + struct bfd_link_info *info, + void *finfo, bfd_boolean (*func) (void *, const char *, + Elf_Internal_Sym *, + asection *, + struct elf_link_hash_entry *)) +{ + output_arch_syminfo osi; + struct elf32_arm_link_hash_table *htab; + bfd_vma offset; + bfd_size_type size; + + htab = elf32_arm_hash_table (info); + check_use_blx(htab); + + osi.finfo = finfo; + osi.info = info; + osi.func = func; + + /* ARM->Thumb glue. */ + if (htab->arm_glue_size > 0) { - arm_data->map = newmap; - arm_data->mapcount = mapcount; + osi.sec = bfd_get_section_by_name (htab->bfd_of_glue_owner, + ARM2THUMB_GLUE_SECTION_NAME); + + osi.sec_shndx = _bfd_elf_section_from_bfd_section + (output_bfd, osi.sec->output_section); + if (info->shared || htab->root.is_relocatable_executable + || htab->pic_veneer) + size = ARM2THUMB_PIC_GLUE_SIZE; + else if (htab->use_blx) + size = ARM2THUMB_V5_STATIC_GLUE_SIZE; + else + size = ARM2THUMB_STATIC_GLUE_SIZE; + + for (offset = 0; offset < htab->arm_glue_size; offset += size) + { + elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_ARM, offset); + elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_DATA, offset + size - 4); + } + } + + /* Thumb->ARM glue. */ + if (htab->thumb_glue_size > 0) + { + osi.sec = bfd_get_section_by_name (htab->bfd_of_glue_owner, + THUMB2ARM_GLUE_SECTION_NAME); + + osi.sec_shndx = _bfd_elf_section_from_bfd_section + (output_bfd, osi.sec->output_section); + size = THUMB2ARM_GLUE_SIZE; + + for (offset = 0; offset < htab->thumb_glue_size; offset += size) + { + elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_THUMB, offset); + elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_ARM, offset + 4); + } + } + + /* Finally, output mapping symbols for the PLT. */ + if (!htab->splt || htab->splt->size == 0) + return TRUE; - newmap[mapcount - 1].vma = elfsym->st_value; - newmap[mapcount - 1].type = name[1]; + osi.sec_shndx = _bfd_elf_section_from_bfd_section (output_bfd, + htab->splt->output_section); + osi.sec = htab->splt; + /* Output mapping symbols for the plt header. SymbianOS does not have a + plt header. */ + if (htab->vxworks_p) + { + /* VxWorks shared libraries have no PLT header. */ + if (!info->shared) + { + if (!elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_ARM, 0)) + return FALSE; + if (!elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_DATA, 12)) + return FALSE; + } + } + else if (!htab->symbian_p) + { + if (!elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_ARM, 0)) + return FALSE; +#ifndef FOUR_WORD_PLT + if (!elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_DATA, 16)) + return FALSE; +#endif } + elf_link_hash_traverse (&htab->root, elf32_arm_output_plt_map, (void *) &osi); return TRUE; } @@ -7839,13 +9767,16 @@ elf32_arm_output_symbol_hook (struct bfd_link_info *info, static bfd_boolean elf32_arm_new_section_hook (bfd *abfd, asection *sec) { - _arm_elf_section_data *sdata; - bfd_size_type amt = sizeof (*sdata); + if (!sec->used_by_bfd) + { + _arm_elf_section_data *sdata; + bfd_size_type amt = sizeof (*sdata); - sdata = bfd_zalloc (abfd, amt); - if (sdata == NULL) - return FALSE; - sec->used_by_bfd = sdata; + sdata = bfd_zalloc (abfd, amt); + if (sdata == NULL) + return FALSE; + sec->used_by_bfd = sdata; + } record_section_with_arm_elf_section_data (sec); @@ -7867,15 +9798,18 @@ elf32_arm_compare_mapping (const void * a, const void * b) written out as normal. */ static bfd_boolean -elf32_arm_write_section (bfd *output_bfd ATTRIBUTE_UNUSED, asection *sec, +elf32_arm_write_section (bfd *output_bfd, + struct bfd_link_info *link_info, asection *sec, bfd_byte *contents) { - int mapcount; + int mapcount, errcount; _arm_elf_section_data *arm_data; + struct elf32_arm_link_hash_table *globals = elf32_arm_hash_table (link_info); elf32_arm_section_map *map; + elf32_vfp11_erratum_list *errnode; bfd_vma ptr; bfd_vma end; - bfd_vma offset; + bfd_vma offset = sec->output_section->vma + sec->output_offset; bfd_byte tmp; int i; @@ -7887,57 +9821,136 @@ elf32_arm_write_section (bfd *output_bfd ATTRIBUTE_UNUSED, asection *sec, mapcount = arm_data->mapcount; map = arm_data->map; + errcount = arm_data->erratumcount; + + if (errcount != 0) + { + unsigned int endianflip = bfd_big_endian (output_bfd) ? 3 : 0; + + for (errnode = arm_data->erratumlist; errnode != 0; + errnode = errnode->next) + { + bfd_vma index = errnode->vma - offset; + + switch (errnode->type) + { + case VFP11_ERRATUM_BRANCH_TO_ARM_VENEER: + { + bfd_vma branch_to_veneer; + /* Original condition code of instruction, plus bit mask for + ARM B instruction. */ + unsigned int insn = (errnode->u.b.vfp_insn & 0xf0000000) + | 0x0a000000; + + /* The instruction is before the label. */ + index -= 4; + + /* Above offset included in -4 below. */ + branch_to_veneer = errnode->u.b.veneer->vma + - errnode->vma - 4; + + if ((signed) branch_to_veneer < -(1 << 25) + || (signed) branch_to_veneer >= (1 << 25)) + (*_bfd_error_handler) (_("%B: error: VFP11 veneer out of " + "range"), output_bfd); + + insn |= (branch_to_veneer >> 2) & 0xffffff; + contents[endianflip ^ index] = insn & 0xff; + contents[endianflip ^ (index + 1)] = (insn >> 8) & 0xff; + contents[endianflip ^ (index + 2)] = (insn >> 16) & 0xff; + contents[endianflip ^ (index + 3)] = (insn >> 24) & 0xff; + } + break; + + case VFP11_ERRATUM_ARM_VENEER: + { + bfd_vma branch_from_veneer; + unsigned int insn; + + /* Take size of veneer into account. */ + branch_from_veneer = errnode->u.v.branch->vma + - errnode->vma - 12; + + if ((signed) branch_from_veneer < -(1 << 25) + || (signed) branch_from_veneer >= (1 << 25)) + (*_bfd_error_handler) (_("%B: error: VFP11 veneer out of " + "range"), output_bfd); + + /* Original instruction. */ + insn = errnode->u.v.branch->u.b.vfp_insn; + contents[endianflip ^ index] = insn & 0xff; + contents[endianflip ^ (index + 1)] = (insn >> 8) & 0xff; + contents[endianflip ^ (index + 2)] = (insn >> 16) & 0xff; + contents[endianflip ^ (index + 3)] = (insn >> 24) & 0xff; + + /* Branch back to insn after original insn. */ + insn = 0xea000000 | ((branch_from_veneer >> 2) & 0xffffff); + contents[endianflip ^ (index + 4)] = insn & 0xff; + contents[endianflip ^ (index + 5)] = (insn >> 8) & 0xff; + contents[endianflip ^ (index + 6)] = (insn >> 16) & 0xff; + contents[endianflip ^ (index + 7)] = (insn >> 24) & 0xff; + } + break; + + default: + abort (); + } + } + } if (mapcount == 0) return FALSE; - qsort (map, mapcount, sizeof (* map), elf32_arm_compare_mapping); - - offset = sec->output_section->vma + sec->output_offset; - ptr = map[0].vma - offset; - for (i = 0; i < mapcount; i++) + if (globals->byteswap_code) { - if (i == mapcount - 1) - end = sec->size; - else - end = map[i + 1].vma - offset; + qsort (map, mapcount, sizeof (* map), elf32_arm_compare_mapping); - switch (map[i].type) - { - case 'a': - /* Byte swap code words. */ - while (ptr + 3 < end) - { - tmp = contents[ptr]; - contents[ptr] = contents[ptr + 3]; - contents[ptr + 3] = tmp; - tmp = contents[ptr + 1]; - contents[ptr + 1] = contents[ptr + 2]; - contents[ptr + 2] = tmp; - ptr += 4; - } - break; + ptr = map[0].vma; + for (i = 0; i < mapcount; i++) + { + if (i == mapcount - 1) + end = sec->size; + else + end = map[i + 1].vma; - case 't': - /* Byte swap code halfwords. */ - while (ptr + 1 < end) + switch (map[i].type) { - tmp = contents[ptr]; - contents[ptr] = contents[ptr + 1]; - contents[ptr + 1] = tmp; - ptr += 2; - } - break; + case 'a': + /* Byte swap code words. */ + while (ptr + 3 < end) + { + tmp = contents[ptr]; + contents[ptr] = contents[ptr + 3]; + contents[ptr + 3] = tmp; + tmp = contents[ptr + 1]; + contents[ptr + 1] = contents[ptr + 2]; + contents[ptr + 2] = tmp; + ptr += 4; + } + break; - case 'd': - /* Leave data alone. */ - break; - } - ptr = end; + case 't': + /* Byte swap code halfwords. */ + while (ptr + 1 < end) + { + tmp = contents[ptr]; + contents[ptr] = contents[ptr + 1]; + contents[ptr + 1] = tmp; + ptr += 2; + } + break; + + case 'd': + /* Leave data alone. */ + break; + } + ptr = end; + } } free (map); arm_data->mapcount = 0; + arm_data->mapsize = 0; arm_data->map = NULL; unrecord_section_with_arm_elf_section_data (sec); @@ -7955,11 +9968,25 @@ unrecord_section_via_map_over_sections (bfd * abfd ATTRIBUTE_UNUSED, static bfd_boolean elf32_arm_close_and_cleanup (bfd * abfd) { - bfd_map_over_sections (abfd, unrecord_section_via_map_over_sections, NULL); + if (abfd->sections) + bfd_map_over_sections (abfd, + unrecord_section_via_map_over_sections, + NULL); return _bfd_elf_close_and_cleanup (abfd); } +static bfd_boolean +elf32_arm_bfd_free_cached_info (bfd * abfd) +{ + if (abfd->sections) + bfd_map_over_sections (abfd, + unrecord_section_via_map_over_sections, + NULL); + + return _bfd_free_cached_info (abfd); +} + /* Display STT_ARM_TFUNC symbols as functions. */ static void @@ -7975,13 +10002,14 @@ elf32_arm_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, /* Mangle thumb function symbols as we read them in. */ -static void +static bfd_boolean elf32_arm_swap_symbol_in (bfd * abfd, const void *psrc, const void *pshn, Elf_Internal_Sym *dst) { - bfd_elf32_swap_symbol_in (abfd, psrc, pshn, dst); + if (!bfd_elf32_swap_symbol_in (abfd, psrc, pshn, dst)) + return FALSE; /* New EABI objects mark thumb function symbols by setting the low bit of the address. Turn these into STT_ARM_TFUNC. */ @@ -7991,6 +10019,7 @@ elf32_arm_swap_symbol_in (bfd * abfd, dst->st_info = ELF_ST_INFO (ELF_ST_BIND (dst->st_info), STT_ARM_TFUNC); dst->st_value &= ~(bfd_vma) 1; } + return TRUE; } @@ -8012,7 +10041,18 @@ elf32_arm_swap_symbol_out (bfd *abfd, { newsym = *src; newsym.st_info = ELF_ST_INFO (ELF_ST_BIND (src->st_info), STT_FUNC); - newsym.st_value |= 1; + if (newsym.st_shndx != SHN_UNDEF) + { + /* Do this only for defined symbols. At link type, the static + linker will simulate the work of dynamic linker of resolving + symbols and will carry over the thumbness of found symbols to + the output symbol table. It's not clear how it happens, but + the thumbness of undefined symbols can well be different at + runtime, and writing '1' for them will be confusing for users + and possibly for dynamic linker itself. + */ + newsym.st_value |= 1; + } src = &newsym; } @@ -8057,7 +10097,8 @@ elf32_arm_modify_segment_map (bfd *abfd, /* We may add a PT_ARM_EXIDX program header. */ static int -elf32_arm_additional_program_headers (bfd *abfd) +elf32_arm_additional_program_headers (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { asection *sec; @@ -8068,6 +10109,13 @@ elf32_arm_additional_program_headers (bfd *abfd) return 0; } +/* We have two function types: STT_FUNC and STT_ARM_TFUNC. */ +static bfd_boolean +elf32_arm_is_function_type (unsigned int type) +{ + return (type == STT_FUNC) || (type == STT_ARM_TFUNC); +} + /* We use this to override swap_symbol_in and swap_symbol_out. */ const struct elf_size_info elf32_arm_size_info = { sizeof (Elf32_External_Ehdr), @@ -8105,6 +10153,7 @@ const struct elf_size_info elf32_arm_size_info = { #define ELF_MAXPAGESIZE 0x8000 #endif #define ELF_MINPAGESIZE 0x1000 +#define ELF_COMMONPAGESIZE 0x1000 #define bfd_elf32_mkobject elf32_arm_mkobject @@ -8114,15 +10163,17 @@ const struct elf_size_info elf32_arm_size_info = { #define bfd_elf32_bfd_print_private_bfd_data elf32_arm_print_private_bfd_data #define bfd_elf32_bfd_link_hash_table_create elf32_arm_link_hash_table_create #define bfd_elf32_bfd_reloc_type_lookup elf32_arm_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup elf32_arm_reloc_name_lookup #define bfd_elf32_find_nearest_line elf32_arm_find_nearest_line #define bfd_elf32_find_inliner_info elf32_arm_find_inliner_info #define bfd_elf32_new_section_hook elf32_arm_new_section_hook #define bfd_elf32_bfd_is_target_special_symbol elf32_arm_is_target_special_symbol #define bfd_elf32_close_and_cleanup elf32_arm_close_and_cleanup -#define bfd_elf32_bfd_final_link elf32_arm_bfd_final_link +#define bfd_elf32_bfd_free_cached_info elf32_arm_bfd_free_cached_info #define elf_backend_get_symbol_type elf32_arm_get_symbol_type #define elf_backend_gc_mark_hook elf32_arm_gc_mark_hook +#define elf_backend_gc_mark_extra_sections elf32_arm_gc_mark_extra_sections #define elf_backend_gc_sweep_hook elf32_arm_gc_sweep_hook #define elf_backend_check_relocs elf32_arm_check_relocs #define elf_backend_relocate_section elf32_arm_relocate_section @@ -8131,8 +10182,8 @@ const struct elf_size_info elf32_arm_size_info = { #define elf_backend_create_dynamic_sections elf32_arm_create_dynamic_sections #define elf_backend_finish_dynamic_symbol elf32_arm_finish_dynamic_symbol #define elf_backend_finish_dynamic_sections elf32_arm_finish_dynamic_sections -#define elf_backend_link_output_symbol_hook elf32_arm_output_symbol_hook #define elf_backend_size_dynamic_sections elf32_arm_size_dynamic_sections +#define elf_backend_init_index_section _bfd_elf_init_2_index_sections #define elf_backend_post_process_headers elf32_arm_post_process_headers #define elf_backend_reloc_type_class elf32_arm_reloc_type_class #define elf_backend_object_p elf32_arm_object_p @@ -8146,6 +10197,11 @@ const struct elf_size_info elf32_arm_size_info = { #define elf_backend_modify_segment_map elf32_arm_modify_segment_map #define elf_backend_additional_program_headers \ elf32_arm_additional_program_headers +#define elf_backend_output_arch_local_syms \ + elf32_arm_output_arch_local_syms +#define elf_backend_begin_write_processing \ + elf32_arm_begin_write_processing +#define elf_backend_is_function_type elf32_arm_is_function_type #define elf_backend_can_refcount 1 #define elf_backend_can_gc_sections 1 @@ -8155,10 +10211,18 @@ const struct elf_size_info elf32_arm_size_info = { #define elf_backend_may_use_rel_p 1 #define elf_backend_may_use_rela_p 0 #define elf_backend_default_use_rela_p 0 -#define elf_backend_rela_normal 0 #define elf_backend_got_header_size 12 +#undef elf_backend_obj_attrs_vendor +#define elf_backend_obj_attrs_vendor "aeabi" +#undef elf_backend_obj_attrs_section +#define elf_backend_obj_attrs_section ".ARM.attributes" +#undef elf_backend_obj_attrs_arg_type +#define elf_backend_obj_attrs_arg_type elf32_arm_obj_attrs_arg_type +#undef elf_backend_obj_attrs_section_type +#define elf_backend_obj_attrs_section_type SHT_ARM_ATTRIBUTES + #include "elf32-target.h" /* VxWorks Targets */ @@ -8219,8 +10283,6 @@ elf32_arm_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker) #define elf_backend_may_use_rela_p 1 #undef elf_backend_default_use_rela_p #define elf_backend_default_use_rela_p 1 -#undef elf_backend_rela_normal -#define elf_backend_rela_normal 1 #undef elf_backend_want_plt_sym #define elf_backend_want_plt_sym 1 #undef ELF_MAXPAGESIZE @@ -8271,24 +10333,23 @@ elf32_arm_symbian_special_sections[] = the loadable read-only segment. The post-linker may wish to refer to these sections, but they are not part of the final program image. */ - { ".dynamic", 8, 0, SHT_DYNAMIC, 0 }, - { ".dynstr", 7, 0, SHT_STRTAB, 0 }, - { ".dynsym", 7, 0, SHT_DYNSYM, 0 }, - { ".got", 4, 0, SHT_PROGBITS, 0 }, - { ".hash", 5, 0, SHT_HASH, 0 }, + { STRING_COMMA_LEN (".dynamic"), 0, SHT_DYNAMIC, 0 }, + { STRING_COMMA_LEN (".dynstr"), 0, SHT_STRTAB, 0 }, + { STRING_COMMA_LEN (".dynsym"), 0, SHT_DYNSYM, 0 }, + { STRING_COMMA_LEN (".got"), 0, SHT_PROGBITS, 0 }, + { STRING_COMMA_LEN (".hash"), 0, SHT_HASH, 0 }, /* These sections do not need to be writable as the SymbianOS postlinker will arrange things so that no dynamic relocation is required. */ - { ".init_array", 11, 0, SHT_INIT_ARRAY, SHF_ALLOC }, - { ".fini_array", 11, 0, SHT_FINI_ARRAY, SHF_ALLOC }, - { ".preinit_array", 14, 0, SHT_PREINIT_ARRAY, SHF_ALLOC }, - { NULL, 0, 0, 0, 0 } + { STRING_COMMA_LEN (".init_array"), 0, SHT_INIT_ARRAY, SHF_ALLOC }, + { STRING_COMMA_LEN (".fini_array"), 0, SHT_FINI_ARRAY, SHF_ALLOC }, + { STRING_COMMA_LEN (".preinit_array"), 0, SHT_PREINIT_ARRAY, SHF_ALLOC }, + { NULL, 0, 0, 0, 0 } }; static void elf32_arm_symbian_begin_write_processing (bfd *abfd, - struct bfd_link_info *link_info - ATTRIBUTE_UNUSED) + struct bfd_link_info *link_info) { /* BPABI objects are never loaded directly by an OS kernel; they are processed by a postlinker first, into an OS-specific format. If @@ -8299,6 +10360,7 @@ elf32_arm_symbian_begin_write_processing (bfd *abfd, recognize that the program headers should not be mapped into any loadable segment. */ abfd->flags &= ~D_PAGED; + elf32_arm_begin_write_processing(abfd, link_info); } static bfd_boolean @@ -8315,9 +10377,16 @@ elf32_arm_symbian_modify_segment_map (bfd *abfd, dynsec = bfd_get_section_by_name (abfd, ".dynamic"); if (dynsec) { - m = _bfd_elf_make_dynamic_segment (abfd, dynsec); - m->next = elf_tdata (abfd)->segment_map; - elf_tdata (abfd)->segment_map = m; + for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next) + if (m->p_type == PT_DYNAMIC) + break; + + if (m == NULL) + { + m = _bfd_elf_make_dynamic_segment (abfd, dynsec); + m->next = elf_tdata (abfd)->segment_map; + elf_tdata (abfd)->segment_map = m; + } } /* Also call the generic arm routine. */ @@ -8366,8 +10435,6 @@ elf32_arm_symbian_modify_segment_map (bfd *abfd, #define elf_backend_may_use_rela_p 0 #undef elf_backend_default_use_rela_p #define elf_backend_default_use_rela_p 0 -#undef elf_backend_rela_normal -#define elf_backend_rela_normal 0 #undef elf_backend_want_plt_sym #define elf_backend_want_plt_sym 0 #undef ELF_MAXPAGESIZE diff --git a/contrib/binutils/bfd/elf32-avr.h b/contrib/binutils/bfd/elf32-avr.h new file mode 100644 index 000000000000..4b9035fa4753 --- /dev/null +++ b/contrib/binutils/bfd/elf32-avr.h @@ -0,0 +1,38 @@ +/* AVR-specific support for 32-bit ELF. + Copyright 2006 Free Software Foundation, Inc. + + Written by Bjoern Haase <bjoern.m.haase@web.de> + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, + Boston, MA 02110-1301, USA. */ + + +/* These four functions will be called from the ld back-end. */ + +extern void +elf32_avr_setup_params (struct bfd_link_info *, bfd *, asection *, + bfd_boolean, bfd_boolean, bfd_boolean, + bfd_vma, bfd_boolean); + +extern int +elf32_avr_setup_section_lists (bfd *, struct bfd_link_info *); + +extern bfd_boolean +elf32_avr_size_stubs (bfd *, struct bfd_link_info *, bfd_boolean); + +extern bfd_boolean +elf32_avr_build_stubs (struct bfd_link_info *); diff --git a/contrib/binutils/bfd/elf32-cr16.c b/contrib/binutils/bfd/elf32-cr16.c new file mode 100644 index 000000000000..197bff720085 --- /dev/null +++ b/contrib/binutils/bfd/elf32-cr16.c @@ -0,0 +1,1433 @@ +/* BFD back-end for National Semiconductor's CR16 ELF + Copyright 2007 Free Software Foundation, Inc. + Written by M R Swami Reddy. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "sysdep.h" +#include "bfd.h" +#include "bfdlink.h" +#include "libbfd.h" +#include "libiberty.h" +#include "elf-bfd.h" +#include "elf/cr16.h" + +/* cr16_reloc_map array maps BFD relocation enum into a CRGAS relocation type. */ + +struct cr16_reloc_map +{ + bfd_reloc_code_real_type bfd_reloc_enum; /* BFD relocation enum. */ + unsigned short cr16_reloc_type; /* CR16 relocation type. */ +}; + +static const struct cr16_reloc_map cr16_reloc_map[R_CR16_MAX] = +{ + {BFD_RELOC_NONE, R_CR16_NONE}, + {BFD_RELOC_CR16_NUM8, R_CR16_NUM8}, + {BFD_RELOC_CR16_NUM16, R_CR16_NUM16}, + {BFD_RELOC_CR16_NUM32, R_CR16_NUM32}, + {BFD_RELOC_CR16_NUM32a, R_CR16_NUM32a}, + {BFD_RELOC_CR16_REGREL4, R_CR16_REGREL4}, + {BFD_RELOC_CR16_REGREL4a, R_CR16_REGREL4a}, + {BFD_RELOC_CR16_REGREL14, R_CR16_REGREL14}, + {BFD_RELOC_CR16_REGREL14a, R_CR16_REGREL14a}, + {BFD_RELOC_CR16_REGREL16, R_CR16_REGREL16}, + {BFD_RELOC_CR16_REGREL20, R_CR16_REGREL20}, + {BFD_RELOC_CR16_REGREL20a, R_CR16_REGREL20a}, + {BFD_RELOC_CR16_ABS20, R_CR16_ABS20}, + {BFD_RELOC_CR16_ABS24, R_CR16_ABS24}, + {BFD_RELOC_CR16_IMM4, R_CR16_IMM4}, + {BFD_RELOC_CR16_IMM8, R_CR16_IMM8}, + {BFD_RELOC_CR16_IMM16, R_CR16_IMM16}, + {BFD_RELOC_CR16_IMM20, R_CR16_IMM20}, + {BFD_RELOC_CR16_IMM24, R_CR16_IMM24}, + {BFD_RELOC_CR16_IMM32, R_CR16_IMM32}, + {BFD_RELOC_CR16_IMM32a, R_CR16_IMM32a}, + {BFD_RELOC_CR16_DISP4, R_CR16_DISP4}, + {BFD_RELOC_CR16_DISP8, R_CR16_DISP8}, + {BFD_RELOC_CR16_DISP16, R_CR16_DISP16}, + {BFD_RELOC_CR16_DISP24, R_CR16_DISP24}, + {BFD_RELOC_CR16_DISP24a, R_CR16_DISP24a} +}; + +static reloc_howto_type cr16_elf_howto_table[] = +{ + HOWTO (R_CR16_NONE, /* type */ + 0, /* rightshift */ + 2, /* size */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CR16_NUM8, /* type */ + 0, /* rightshift */ + 0, /* size */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_NUM8", /* name */ + FALSE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CR16_NUM16, /* type */ + 0, /* rightshift */ + 1, /* size */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_NUM16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CR16_NUM32, /* type */ + 0, /* rightshift */ + 2, /* size */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_NUM32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CR16_NUM32a, /* type */ + 1, /* rightshift */ + 2, /* size */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_NUM32a", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CR16_REGREL4, /* type */ + 0, /* rightshift */ + 0, /* size */ + 4, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_REGREL4", /* name */ + FALSE, /* partial_inplace */ + 0xf, /* src_mask */ + 0xf, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CR16_REGREL4a, /* type */ + 0, /* rightshift */ + 0, /* size */ + 4, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_REGREL4a", /* name */ + FALSE, /* partial_inplace */ + 0xf, /* src_mask */ + 0xf, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CR16_REGREL14, /* type */ + 0, /* rightshift */ + 1, /* size */ + 14, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_REGREL14", /* name */ + FALSE, /* partial_inplace */ + 0x3fff, /* src_mask */ + 0x3fff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CR16_REGREL14a, /* type */ + 0, /* rightshift */ + 1, /* size */ + 14, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_REGREL14a", /* name */ + FALSE, /* partial_inplace */ + 0x3fff, /* src_mask */ + 0x3fff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CR16_REGREL16, /* type */ + 0, /* rightshift */ + 1, /* size */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_REGREL16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CR16_REGREL20, /* type */ + 0, /* rightshift */ + 2, /* size */ + 20, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_REGREL20", /* name */ + FALSE, /* partial_inplace */ + 0xfffff, /* src_mask */ + 0xfffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CR16_REGREL20a, /* type */ + 0, /* rightshift */ + 2, /* size */ + 20, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_REGREL20a", /* name */ + FALSE, /* partial_inplace */ + 0xfffff, /* src_mask */ + 0xfffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CR16_ABS20, /* type */ + 0, /* rightshift */ + 2, /* size */ + 20, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_ABS20", /* name */ + FALSE, /* partial_inplace */ + 0xfffff, /* src_mask */ + 0xfffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CR16_ABS24, /* type */ + 0, /* rightshift */ + 2, /* size */ + 24, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_ABS24", /* name */ + FALSE, /* partial_inplace */ + 0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CR16_IMM4, /* type */ + 0, /* rightshift */ + 0, /* size */ + 4, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_IMM4", /* name */ + FALSE, /* partial_inplace */ + 0xf, /* src_mask */ + 0xf, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CR16_IMM8, /* type */ + 0, /* rightshift */ + 0, /* size */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_IMM8", /* name */ + FALSE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CR16_IMM16, /* type */ + 0, /* rightshift */ + 1, /* size */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_IMM16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CR16_IMM20, /* type */ + 0, /* rightshift */ + 2, /* size */ + 20, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_IMM20", /* name */ + FALSE, /* partial_inplace */ + 0xfffff, /* src_mask */ + 0xfffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CR16_IMM24, /* type */ + 0, /* rightshift */ + 2, /* size */ + 24, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_IMM24", /* name */ + FALSE, /* partial_inplace */ + 0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CR16_IMM32, /* type */ + 0, /* rightshift */ + 2, /* size */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_IMM32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CR16_IMM32a, /* type */ + 1, /* rightshift */ + 2, /* size */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_IMM32a", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CR16_DISP4, /* type */ + 1, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 4, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_DISP4", /* name */ + FALSE, /* partial_inplace */ + 0xf, /* src_mask */ + 0xf, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CR16_DISP8, /* type */ + 1, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_DISP8", /* name */ + FALSE, /* partial_inplace */ + 0x1ff, /* src_mask */ + 0x1ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CR16_DISP16, /* type */ + 0, /* rightshift REVIITS: To sync with WinIDEA*/ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_DISP16", /* name */ + FALSE, /* partial_inplace */ + 0x1ffff, /* src_mask */ + 0x1ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + /* REVISIT: DISP24 should be left-shift by 2 as per ISA doc + but its not done, to sync with WinIDEA and CR16 4.1 tools */ + HOWTO (R_CR16_DISP24, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_DISP24", /* name */ + FALSE, /* partial_inplace */ + 0x1ffffff, /* src_mask */ + 0x1ffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CR16_DISP24a, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CR16_DISP24a", /* name */ + FALSE, /* partial_inplace */ + 0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ + FALSE) /* pcrel_offset */ +}; + +/* Retrieve a howto ptr using a BFD reloc_code. */ + +static reloc_howto_type * +elf_cr16_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) +{ + unsigned int i; + + for (i = 0; i < R_CR16_MAX; i++) + if (code == cr16_reloc_map[i].bfd_reloc_enum) + return &cr16_elf_howto_table[cr16_reloc_map[i].cr16_reloc_type]; + + _bfd_error_handler ("Unsupported CR16 relocation type: 0x%x\n", code); + return NULL; +} + +static reloc_howto_type * +elf_cr16_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; ARRAY_SIZE (cr16_elf_howto_table); i++) + if (cr16_elf_howto_table[i].name != NULL + && strcasecmp (cr16_elf_howto_table[i].name, r_name) == 0) + return cr16_elf_howto_table + i; + + return NULL; +} + +/* Retrieve a howto ptr using an internal relocation entry. */ + +static void +elf_cr16_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr, + Elf_Internal_Rela *dst) +{ + unsigned int r_type = ELF32_R_TYPE (dst->r_info); + + BFD_ASSERT (r_type < (unsigned int) R_CR16_MAX); + cache_ptr->howto = &cr16_elf_howto_table[r_type]; +} + +/* Perform a relocation as part of a final link. */ + +static bfd_reloc_status_type +cr16_elf_final_link_relocate (reloc_howto_type *howto, + bfd *input_bfd, + bfd *output_bfd ATTRIBUTE_UNUSED, + asection *input_section, + bfd_byte *contents, + bfd_vma offset, + bfd_vma Rvalue, + bfd_vma addend, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + asection *sec ATTRIBUTE_UNUSED, + int is_local ATTRIBUTE_UNUSED) +{ + unsigned short r_type = howto->type; + bfd_byte *hit_data = contents + offset; + bfd_vma reloc_bits, check, Rvalue1; + + switch (r_type) + { + case R_CR16_IMM4: + case R_CR16_IMM8: + case R_CR16_IMM16: + case R_CR16_IMM20: + case R_CR16_IMM32: + case R_CR16_IMM32a: + case R_CR16_REGREL4: + case R_CR16_REGREL4a: + case R_CR16_REGREL14: + case R_CR16_REGREL14a: + case R_CR16_REGREL16: + case R_CR16_REGREL20: + case R_CR16_ABS20: + case R_CR16_ABS24: + case R_CR16_DISP16: + case R_CR16_DISP24: + /* 'hit_data' is relative to the start of the instruction, not the + relocation offset. Advance it to account for the exact offset. */ + hit_data += 2; + break; + + case R_CR16_NONE: + return bfd_reloc_ok; + break; + + case R_CR16_DISP4: + case R_CR16_DISP8: + case R_CR16_DISP24a: + /* We only care about the addend, where the difference between + expressions is kept. */ + if (is_local) Rvalue -= -1; + + default: + break; + } + + if (howto->pc_relative) + { + /* Subtract the address of the section containing the location. */ + Rvalue -= (input_section->output_section->vma + + input_section->output_offset); + /* Subtract the position of the location within the section. */ + Rvalue -= offset; + } + + /* Add in supplied addend. */ + Rvalue += addend; + + /* Complain if the bitfield overflows, whether it is considered + as signed or unsigned. */ + check = Rvalue >> howto->rightshift; + + /* Assumes two's complement. This expression avoids + overflow if howto->bitsize is the number of bits in + bfd_vma. */ + reloc_bits = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1; + + if (((bfd_vma) check & ~reloc_bits) != 0 + && (((bfd_vma) check & ~reloc_bits) + != (-(bfd_vma) 1 & ~reloc_bits))) + { + /* The above right shift is incorrect for a signed + value. See if turning on the upper bits fixes the + overflow. */ + if (howto->rightshift && (bfd_signed_vma) Rvalue < 0) + { + check |= ((bfd_vma) - 1 + & ~((bfd_vma) - 1 + >> howto->rightshift)); + + if (((bfd_vma) check & ~reloc_bits) + != (-(bfd_vma) 1 & ~reloc_bits)) + return bfd_reloc_overflow; + } + else + return bfd_reloc_overflow; + } + + /* Drop unwanted bits from the value we are relocating to. */ + Rvalue >>= (bfd_vma) howto->rightshift; + + /* Apply dst_mask to select only relocatable part of the insn. */ + Rvalue &= howto->dst_mask; + + switch (howto->size) + { + case 0: + if ((r_type == R_CR16_IMM4) + || (r_type == R_CR16_DISP4) + || (r_type == R_CR16_DISP8)) + { + Rvalue1 = bfd_get_16 (input_bfd, hit_data); + Rvalue = ((Rvalue1 & 0xf000) | ((Rvalue << 4) & 0xf00) + | (Rvalue1 & 0x00f0) | (Rvalue & 0xf)); + bfd_put_16 (input_bfd, Rvalue, hit_data); + } + break; + + case 1: + if (r_type == R_CR16_DISP16) + { + Rvalue |= (bfd_get_16 (input_bfd, hit_data)); + Rvalue = ((Rvalue & 0xfffe) | ((Rvalue >> 16) & 0x1)); + + bfd_put_16 (input_bfd, Rvalue, hit_data); + } + break; + + case 2: + if (r_type == R_CR16_ABS20) + { + Rvalue |= (((bfd_get_16 (input_bfd, hit_data) << 16) + | (bfd_get_16 (input_bfd, hit_data + 2))) + & ~howto->dst_mask); + Rvalue |= (bfd_get_16 (input_bfd, hit_data + 2) << 16); + + /* Relocation on INSTRUCTIONS is different : Instructions are + word-addressable, that is, each word itself is arranged according + to little-endian convention, whereas the words are arranged with + respect to one another in BIG ENDIAN fashion. + When there is an immediate value that spans a word boundary, + it is split in a big-endian way with respect to the words. */ + bfd_put_16 (input_bfd, (Rvalue) & 0xffff, hit_data); + bfd_put_16 (input_bfd, (Rvalue >> 16)& 0xffff, hit_data + 2); + } + else if (r_type == R_CR16_ABS24) + { + Rvalue = ((((Rvalue >> 20)& 0xf) + | (((Rvalue >> 16) & 0xf) << 8) + | (bfd_get_16 (input_bfd, hit_data))) + | ((Rvalue & 0xffff) << 16)); + + bfd_put_32 (input_bfd, Rvalue, hit_data); + } + else if (r_type == R_CR16_DISP24) + { + Rvalue = ((((Rvalue >> 20)& 0xf) | (((Rvalue >> 16) & 0xf)<<8) + | (bfd_get_16 (input_bfd, hit_data))) + | (((Rvalue & 0xfffE) | ((Rvalue >> 24) & 0x1)) << 16)); + + bfd_put_32 (input_bfd, Rvalue, hit_data); + } + else if ((r_type == R_CR16_IMM32) || (r_type == R_CR16_IMM32a)) + { + Rvalue = (((Rvalue >> 16)& 0xffff) + | (bfd_get_16 (input_bfd, hit_data))) + | ((Rvalue & 0xffff) << 16); + bfd_put_32 (input_bfd, Rvalue, hit_data); + } + else if (r_type == R_CR16_DISP24a) + { + Rvalue = (((Rvalue & 0xfffffe) | (Rvalue >> 23))); + Rvalue = ((Rvalue >> 16) & 0xff) | ((Rvalue & 0xffff) << 16) + | (bfd_get_32 (input_bfd, hit_data)); + + bfd_put_32 (input_bfd, Rvalue, hit_data); + } + else if ((r_type == R_CR16_NUM32) || (r_type == R_CR16_NUM32a)) + { + bfd_put_32 (input_bfd, Rvalue, hit_data); + } + break; + + default: + return bfd_reloc_notsupported; + } + + return bfd_reloc_ok; +} + +/* Delete some bytes from a section while relaxing. */ + +static bfd_boolean +elf32_cr16_relax_delete_bytes (struct bfd_link_info *link_info, bfd *abfd, + asection *sec, bfd_vma addr, int count) +{ + Elf_Internal_Shdr *symtab_hdr; + unsigned int sec_shndx; + bfd_byte *contents; + Elf_Internal_Rela *irel, *irelend; + Elf_Internal_Rela *irelalign; + bfd_vma toaddr; + Elf_Internal_Sym *isym; + Elf_Internal_Sym *isymend; + struct elf_link_hash_entry **sym_hashes; + struct elf_link_hash_entry **end_hashes; + struct elf_link_hash_entry **start_hashes; + unsigned int symcount; + + sec_shndx = _bfd_elf_section_from_bfd_section (abfd, sec); + + contents = elf_section_data (sec)->this_hdr.contents; + + /* The deletion must stop at the next ALIGN reloc for an aligment + power larger than the number of bytes we are deleting. */ + irelalign = NULL; + toaddr = sec->size; + + irel = elf_section_data (sec)->relocs; + irelend = irel + sec->reloc_count; + + /* Actually delete the bytes. */ + memmove (contents + addr, contents + addr + count, + (size_t) (toaddr - addr - count)); + sec->size -= count; + + /* Adjust all the relocs. */ + for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++) + /* Get the new reloc address. */ + if ((irel->r_offset > addr && irel->r_offset < toaddr)) + irel->r_offset -= count; + + /* Adjust the local symbols defined in this section. */ + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + isym = (Elf_Internal_Sym *) symtab_hdr->contents; + for (isymend = isym + symtab_hdr->sh_info; isym < isymend; isym++) + { + if (isym->st_shndx == sec_shndx + && isym->st_value > addr + && isym->st_value < toaddr) + { + /* Adjust the addend of SWITCH relocations in this section, + which reference this local symbol. */ + for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++) + { + unsigned long r_symndx; + Elf_Internal_Sym *rsym; + bfd_vma addsym, subsym; + + r_symndx = ELF32_R_SYM (irel->r_info); + rsym = (Elf_Internal_Sym *) symtab_hdr->contents + r_symndx; + + /* Skip if not the local adjusted symbol. */ + if (rsym != isym) + continue; + + addsym = isym->st_value; + subsym = addsym - irel->r_addend; + + /* Fix the addend only when -->> (addsym > addr >= subsym). */ + if (subsym <= addr) + irel->r_addend -= count; + else + continue; + } + + isym->st_value -= count; + } + } + + /* Now adjust the global symbols defined in this section. */ + symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym) + - symtab_hdr->sh_info); + sym_hashes = start_hashes = elf_sym_hashes (abfd); + end_hashes = sym_hashes + symcount; + + for (; sym_hashes < end_hashes; sym_hashes++) + { + struct elf_link_hash_entry *sym_hash = *sym_hashes; + + /* The '--wrap SYMBOL' option is causing a pain when the object file, + containing the definition of __wrap_SYMBOL, includes a direct + call to SYMBOL as well. Since both __wrap_SYMBOL and SYMBOL reference + the same symbol (which is __wrap_SYMBOL), but still exist as two + different symbols in 'sym_hashes', we don't want to adjust + the global symbol __wrap_SYMBOL twice. + This check is only relevant when symbols are being wrapped. */ + if (link_info->wrap_hash != NULL) + { + struct elf_link_hash_entry **cur_sym_hashes; + + /* Loop only over the symbols whom been already checked. */ + for (cur_sym_hashes = start_hashes; cur_sym_hashes < sym_hashes; + cur_sym_hashes++) + /* If the current symbol is identical to 'sym_hash', that means + the symbol was already adjusted (or at least checked). */ + if (*cur_sym_hashes == sym_hash) + break; + + /* Don't adjust the symbol again. */ + if (cur_sym_hashes < sym_hashes) + continue; + } + + if ((sym_hash->root.type == bfd_link_hash_defined + || sym_hash->root.type == bfd_link_hash_defweak) + && sym_hash->root.u.def.section == sec + && sym_hash->root.u.def.value > addr + && sym_hash->root.u.def.value < toaddr) + sym_hash->root.u.def.value -= count; + } + + return TRUE; +} + +/* Relocate a CR16 ELF section. */ + +static bfd_boolean +elf32_cr16_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + bfd *input_bfd, asection *input_section, + bfd_byte *contents, Elf_Internal_Rela *relocs, + Elf_Internal_Sym *local_syms, + asection **local_sections) +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel, *relend; + + if (info->relocatable) + return TRUE; + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + int r_type; + reloc_howto_type *howto; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + struct elf_link_hash_entry *h; + bfd_vma relocation; + bfd_reloc_status_type r; + + r_symndx = ELF32_R_SYM (rel->r_info); + r_type = ELF32_R_TYPE (rel->r_info); + howto = cr16_elf_howto_table + (r_type); + + h = NULL; + sym = NULL; + sec = NULL; + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + } + else + { + bfd_boolean unresolved_reloc, warned; + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); + } + + r = cr16_elf_final_link_relocate (howto, input_bfd, output_bfd, + input_section, + contents, rel->r_offset, + relocation, rel->r_addend, + info, sec, h == NULL); + + if (r != bfd_reloc_ok) + { + const char *name; + const char *msg = NULL; + + if (h != NULL) + name = h->root.root.string; + else + { + name = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name)); + if (name == NULL || *name == '\0') + name = bfd_section_name (input_bfd, sec); + } + + switch (r) + { + case bfd_reloc_overflow: + if (!((*info->callbacks->reloc_overflow) + (info, (h ? &h->root : NULL), name, howto->name, + (bfd_vma) 0, input_bfd, input_section, + rel->r_offset))) + return FALSE; + break; + + case bfd_reloc_undefined: + if (!((*info->callbacks->undefined_symbol) + (info, name, input_bfd, input_section, + rel->r_offset, TRUE))) + return FALSE; + break; + + case bfd_reloc_outofrange: + msg = _("internal error: out of range error"); + goto common_error; + + case bfd_reloc_notsupported: + msg = _("internal error: unsupported relocation error"); + goto common_error; + + case bfd_reloc_dangerous: + msg = _("internal error: dangerous error"); + goto common_error; + + default: + msg = _("internal error: unknown error"); + /* Fall through. */ + + common_error: + if (!((*info->callbacks->warning) + (info, msg, name, input_bfd, input_section, + rel->r_offset))) + return FALSE; + break; + } + } + } + + return TRUE; +} + +/* This is a version of bfd_generic_get_relocated_section_contents + which uses elf32_cr16_relocate_section. */ + +static bfd_byte * +elf32_cr16_get_relocated_section_contents (bfd *output_bfd, + struct bfd_link_info *link_info, + struct bfd_link_order *link_order, + bfd_byte *data, + bfd_boolean relocatable, + asymbol **symbols) +{ + Elf_Internal_Shdr *symtab_hdr; + asection *input_section = link_order->u.indirect.section; + bfd *input_bfd = input_section->owner; + asection **sections = NULL; + Elf_Internal_Rela *internal_relocs = NULL; + Elf_Internal_Sym *isymbuf = NULL; + + /* We only need to handle the case of relaxing, or of having a + particular set of section contents, specially. */ + if (relocatable + || elf_section_data (input_section)->this_hdr.contents == NULL) + return bfd_generic_get_relocated_section_contents (output_bfd, link_info, + link_order, data, + relocatable, + symbols); + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + + memcpy (data, elf_section_data (input_section)->this_hdr.contents, + (size_t) input_section->size); + + if ((input_section->flags & SEC_RELOC) != 0 + && input_section->reloc_count > 0) + { + Elf_Internal_Sym *isym; + Elf_Internal_Sym *isymend; + asection **secpp; + bfd_size_type amt; + + internal_relocs = _bfd_elf_link_read_relocs (input_bfd, input_section, + NULL, NULL, FALSE); + if (internal_relocs == NULL) + goto error_return; + + if (symtab_hdr->sh_info != 0) + { + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == NULL) + goto error_return; + } + + amt = symtab_hdr->sh_info; + amt *= sizeof (asection *); + sections = bfd_malloc (amt); + if (sections == NULL && amt != 0) + goto error_return; + + isymend = isymbuf + symtab_hdr->sh_info; + for (isym = isymbuf, secpp = sections; isym < isymend; ++isym, ++secpp) + { + asection *isec; + + if (isym->st_shndx == SHN_UNDEF) + isec = bfd_und_section_ptr; + else if (isym->st_shndx == SHN_ABS) + isec = bfd_abs_section_ptr; + else if (isym->st_shndx == SHN_COMMON) + isec = bfd_com_section_ptr; + else + isec = bfd_section_from_elf_index (input_bfd, isym->st_shndx); + + *secpp = isec; + } + + if (! elf32_cr16_relocate_section (output_bfd, link_info, input_bfd, + input_section, data, internal_relocs, + isymbuf, sections)) + goto error_return; + + if (sections != NULL) + free (sections); + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + free (isymbuf); + if (elf_section_data (input_section)->relocs != internal_relocs) + free (internal_relocs); + } + + return data; + + error_return: + if (sections != NULL) + free (sections); + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + free (isymbuf); + if (internal_relocs != NULL + && elf_section_data (input_section)->relocs != internal_relocs) + free (internal_relocs); + return NULL; +} + +/* This function handles relaxing for the CR16. + + There's quite a few relaxing opportunites available on the CR16: + + * bcond:24 -> bcond:16 2 bytes + * bcond:16 -> bcond:8 2 bytes + * arithmetic imm32 -> arithmetic imm16 2 bytes + + Symbol- and reloc-reading infrastructure copied from elf-m10200.c. */ + +static bfd_boolean +elf32_cr16_relax_section (bfd *abfd, asection *sec, + struct bfd_link_info *link_info, bfd_boolean *again) +{ + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Rela *internal_relocs; + Elf_Internal_Rela *irel, *irelend; + bfd_byte *contents = NULL; + Elf_Internal_Sym *isymbuf = NULL; + + /* Assume nothing changes. */ + *again = FALSE; + + /* We don't have to do anything for a relocatable link, if + this section does not have relocs, or if this is not a + code section. */ + if (link_info->relocatable + || (sec->flags & SEC_RELOC) == 0 + || sec->reloc_count == 0 + || (sec->flags & SEC_CODE) == 0) + return TRUE; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + + /* Get a copy of the native relocations. */ + internal_relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL, + link_info->keep_memory); + if (internal_relocs == NULL) + goto error_return; + + /* Walk through them looking for relaxing opportunities. */ + irelend = internal_relocs + sec->reloc_count; + for (irel = internal_relocs; irel < irelend; irel++) + { + bfd_vma symval; + + /* If this isn't something that can be relaxed, then ignore + this reloc. */ + if (ELF32_R_TYPE (irel->r_info) != (int) R_CR16_DISP16 + && ELF32_R_TYPE (irel->r_info) != (int) R_CR16_DISP24) + continue; + + /* Get the section contents if we haven't done so already. */ + if (contents == NULL) + { + /* Get cached copy if it exists. */ + if (elf_section_data (sec)->this_hdr.contents != NULL) + contents = elf_section_data (sec)->this_hdr.contents; + /* Go get them off disk. */ + else if (!bfd_malloc_and_get_section (abfd, sec, &contents)) + goto error_return; + } + + /* Read this BFD's local symbols if we haven't done so already. */ + if (isymbuf == NULL && symtab_hdr->sh_info != 0) + { + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == NULL) + goto error_return; + } + + /* Get the value of the symbol referred to by the reloc. */ + if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) + { + /* A local symbol. */ + Elf_Internal_Sym *isym; + asection *sym_sec; + + isym = isymbuf + ELF32_R_SYM (irel->r_info); + if (isym->st_shndx == SHN_UNDEF) + sym_sec = bfd_und_section_ptr; + else if (isym->st_shndx == SHN_ABS) + sym_sec = bfd_abs_section_ptr; + else if (isym->st_shndx == SHN_COMMON) + sym_sec = bfd_com_section_ptr; + else + sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx); + symval = (isym->st_value + + sym_sec->output_section->vma + + sym_sec->output_offset); + } + else + { + unsigned long indx; + struct elf_link_hash_entry *h; + + /* An external symbol. */ + indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info; + h = elf_sym_hashes (abfd)[indx]; + BFD_ASSERT (h != NULL); + + if (h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + /* This appears to be a reference to an undefined + symbol. Just ignore it--it will be caught by the + regular reloc processing. */ + continue; + + symval = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + } + + /* For simplicity of coding, we are going to modify the section + contents, the section relocs, and the BFD symbol table. We + must tell the rest of the code not to free up this + information. It would be possible to instead create a table + of changes which have to be made, as is done in coff-mips.c; + that would be more work, but would require less memory when + the linker is run. */ + + /* Try to turn a 24 branch/call into a 16bit relative + * branch/call. */ + if (ELF32_R_TYPE (irel->r_info) == (int) R_CR16_DISP24) + { + bfd_vma value = symval; + + /* Deal with pc-relative gunk. */ + value -= (sec->output_section->vma + sec->output_offset); + value -= irel->r_offset; + value += irel->r_addend; + + /* See if the value will fit in 16 bits, note the high value is + 0xfffe + 2 as the target will be two bytes closer if we are + able to relax. */ + if ((long) value < 0x10000 && (long) value > -0x10002) + { + unsigned int code; + + /* Get the opcode. */ + code = (unsigned int) bfd_get_32 (abfd, contents + irel->r_offset); + + /* Verify it's a 'bcond' and fix the opcode. */ + if ((code & 0xffff) == 0x0010) + { + bfd_put_16 (abfd, 0x1800 | ((0xf & (code >>20))<<4), contents + irel->r_offset); + bfd_put_16 (abfd, value, contents + irel->r_offset+2); + } + else + continue; + + /* Note that we've changed the relocs, section contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_CR16_DISP16); + + /* Delete two bytes of data. */ + if (!elf32_cr16_relax_delete_bytes (link_info, abfd, sec, + irel->r_offset + 2, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + } + } + + /* Try to turn a 16bit pc-relative branch into an + 8bit pc-relative branch. */ + if (ELF32_R_TYPE (irel->r_info) == (int) R_CR16_DISP16) + { + bfd_vma value = symval; + + /* Deal with pc-relative gunk. */ + value -= (sec->output_section->vma + sec->output_offset); + value -= irel->r_offset; + value += irel->r_addend; + + /* See if the value will fit in 8 bits, note the high value is + 0xfc + 2 as the target will be two bytes closer if we are + able to relax. */ + if ((long) value < 0xfe && (long) value > -0x100) + { + unsigned short code; + + /* Get the opcode. */ + code = (unsigned short) bfd_get_16 (abfd, contents + irel->r_offset); + + /* Verify it's a 'bcond' opcode. */ + if ((code & 0xff00) == 0x1800) + { + bfd_put_8 (abfd, 0x1 | ((0xf & (code>>4))<<4), contents + irel->r_offset); + bfd_put_8 (abfd, value, contents + irel->r_offset+2); + } + else + continue; + + /* Note that we've changed the relocs, section contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_CR16_DISP8); + + /* Delete two bytes of data. */ + if (!elf32_cr16_relax_delete_bytes (link_info, abfd, sec, + irel->r_offset + 2, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + } + } + +#if 0 // REVISIT: To support IMM relaxation in CR16 target + /* Try to turn a 32bit immediate address into + a 20bit immediate address. */ + if (ELF32_R_TYPE (irel->r_info) == (int) R_CR16_IMM32) + { + bfd_vma value = symval; + + /* See if the value will fit in 20 bits. */ + if ((long) value < 0x7ffff && (long) value > -0x80000) + { + unsigned short code; + + /* Get the opcode. */ + code = (unsigned short) bfd_get_16 (abfd, contents + irel->r_offset); + + /* Verify it's a 'arithmetic double'. */ + if ((code & 0xfff0) != 0x0070) + continue; + + /* Note that we've changed the relocs, section contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Fix the opcode. */ + bfd_put_8 (abfd, (code & 0xff) - 0x10, contents + irel->r_offset); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_CR16_IMM20); + + /* Delete two bytes of data. */ + if (!elf32_cr16_relax_delete_bytes (link_info, abfd, sec, + irel->r_offset + 2, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + } + } + /* Try to turn a 20bit/16bit immediate address into + a 4bit immediate address. */ + if ((ELF32_R_TYPE (irel->r_info) == (int) R_CR16_IMM20) + || (ELF32_R_TYPE (irel->r_info) == (int) R_CR16_IMM16)) + { + bfd_vma value = symval; + + /* See if the value will fit in 4 bits. */ + if ((long) value < 0x7 && (long) value > -0x8) + { + unsigned short code; + + /* Get the opcode. */ + code = (unsigned short) bfd_get_8 (abfd, contents + irel->r_offset); + + /* Verify it's a 'arithmetic double'. */ + if (((code & 0xff) != 0x50) || ((code & 0xff) != 0x45)) + continue; + + /* Note that we've changed the relocs, section contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Fix the opcode. */ + bfd_put_8 (abfd, (code & 0xff) - 0x10, contents + irel->r_offset); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_CR16_IMM4); + + /* Delete two bytes of data. */ + if (!elf32_cr16_relax_delete_bytes (link_info, abfd, sec, + irel->r_offset + 2, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + } + } +#endif + } + + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + { + if (! link_info->keep_memory) + free (isymbuf); + else + { + /* Cache the symbols for elf_link_input_bfd. */ + symtab_hdr->contents = (unsigned char *) isymbuf; + } + } + + if (contents != NULL + && elf_section_data (sec)->this_hdr.contents != contents) + { + if (! link_info->keep_memory) + free (contents); + else + { + /* Cache the section contents for elf_link_input_bfd. */ + elf_section_data (sec)->this_hdr.contents = contents; + } + } + + if (internal_relocs != NULL + && elf_section_data (sec)->relocs != internal_relocs) + free (internal_relocs); + + return TRUE; + + error_return: + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + free (isymbuf); + if (contents != NULL + && elf_section_data (sec)->this_hdr.contents != contents) + free (contents); + if (internal_relocs != NULL + && elf_section_data (sec)->relocs != internal_relocs) + free (internal_relocs); + + return FALSE; +} + +static asection * +elf32_cr16_gc_mark_hook (asection *sec, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + Elf_Internal_Rela *rel ATTRIBUTE_UNUSED, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) +{ + if (h == NULL) + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + + default: + return NULL; + } +} + +/* Update the got entry reference counts for the section being removed. */ + +static bfd_boolean +elf32_cr16_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + asection *sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED) +{ + /* We don't support garbage collection of GOT and PLT relocs yet. */ + return TRUE; +} + +/* Definitions for setting CR16 target vector. */ +#define TARGET_LITTLE_SYM bfd_elf32_cr16_vec +#define TARGET_LITTLE_NAME "elf32-cr16" +#define ELF_ARCH bfd_arch_cr16 +#define ELF_MACHINE_CODE EM_CR16 +#define ELF_MAXPAGESIZE 0x1 +#define elf_symbol_leading_char '_' + +#define bfd_elf32_bfd_reloc_type_lookup elf_cr16_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup elf_cr16_reloc_name_lookup +#define elf_info_to_howto elf_cr16_info_to_howto +#define elf_info_to_howto_rel 0 +#define elf_backend_relocate_section elf32_cr16_relocate_section +#define bfd_elf32_bfd_relax_section elf32_cr16_relax_section +#define bfd_elf32_bfd_get_relocated_section_contents \ + elf32_cr16_get_relocated_section_contents +#define elf_backend_gc_mark_hook elf32_cr16_gc_mark_hook +#define elf_backend_gc_sweep_hook elf32_cr16_gc_sweep_hook +#define elf_backend_can_gc_sections 1 +#define elf_backend_rela_normal 1 + +#include "elf32-target.h" diff --git a/contrib/binutils/bfd/elf32-gen.c b/contrib/binutils/bfd/elf32-gen.c index 23c74767799e..ef7d4e2308d7 100644 --- a/contrib/binutils/bfd/elf32-gen.c +++ b/contrib/binutils/bfd/elf32-gen.c @@ -1,5 +1,5 @@ /* Generic support for 32-bit ELF - Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004, 2005 + Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004, 2005, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,8 +18,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "elf-bfd.h" @@ -94,6 +94,7 @@ elf32_generic_link_add_symbols (bfd *abfd, struct bfd_link_info *info) #define ELF_MACHINE_CODE EM_NONE #define ELF_MAXPAGESIZE 0x1 #define bfd_elf32_bfd_reloc_type_lookup bfd_default_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup #define bfd_elf32_bfd_link_add_symbols elf32_generic_link_add_symbols #define elf_info_to_howto elf_generic_info_to_howto #define elf_info_to_howto_rel elf_generic_info_to_howto_rel diff --git a/contrib/binutils/bfd/elf32-i386.c b/contrib/binutils/bfd/elf32-i386.c index 754aa52254d5..0e023df4ad0d 100644 --- a/contrib/binutils/bfd/elf32-i386.c +++ b/contrib/binutils/bfd/elf32-i386.c @@ -1,6 +1,6 @@ /* Intel 80386/80486-specific support for 32-bit ELF Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,8 +18,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "bfdlink.h" #include "libbfd.h" #include "elf-bfd.h" @@ -330,6 +330,20 @@ elf_i386_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return 0; } +static reloc_howto_type * +elf_i386_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; i < sizeof (elf_howto_table) / sizeof (elf_howto_table[0]); i++) + if (elf_howto_table[i].name != NULL + && strcasecmp (elf_howto_table[i].name, r_name) == 0) + return &elf_howto_table[i]; + + return NULL; +} + static void elf_i386_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr, @@ -582,10 +596,6 @@ struct elf_i386_link_hash_entry #define GOT_TLS_IE_NEG 6 #define GOT_TLS_IE_BOTH 7 #define GOT_TLS_GDESC 8 -#define GOT_TLS_MASK 0x0f -#define GOT_TLS_IE_IE 0x10 -#define GOT_TLS_IE_GD 0x20 -#define GOT_TLS_IE_MASK 0x30 #define GOT_TLS_GD_BOTH_P(type) \ ((type) == (GOT_TLS_GD | GOT_TLS_GDESC)) #define GOT_TLS_GD_P(type) \ @@ -626,11 +636,14 @@ struct elf_i386_obj_tdata static bfd_boolean elf_i386_mkobject (bfd *abfd) { - bfd_size_type amt = sizeof (struct elf_i386_obj_tdata); - abfd->tdata.any = bfd_zalloc (abfd, amt); if (abfd->tdata.any == NULL) - return FALSE; - return TRUE; + { + bfd_size_type amt = sizeof (struct elf_i386_obj_tdata); + abfd->tdata.any = bfd_zalloc (abfd, amt); + if (abfd->tdata.any == NULL) + return FALSE; + } + return bfd_elf_mkobject (abfd); } /* i386 ELF linker hash table. */ @@ -1011,25 +1024,12 @@ elf_i386_check_relocs (bfd *abfd, case R_386_TLS_IE_32: if (ELF32_R_TYPE (rel->r_info) == r_type) tls_type = GOT_TLS_IE_NEG; - else if (h - && ELF32_R_TYPE (rel->r_info) == R_386_TLS_GD) - /* If this is a GD->IE transition, we may use either - of R_386_TLS_TPOFF and R_386_TLS_TPOFF32. But if - we may have both R_386_TLS_IE and R_386_TLS_GD, - we can't share the same R_386_TLS_TPOFF since - they require different offsets. So we remember - it comes from R_386_TLS_GD. */ - tls_type = GOT_TLS_IE | GOT_TLS_IE_GD; else + /* If this is a GD->IE transition, we may use either of + R_386_TLS_TPOFF and R_386_TLS_TPOFF32. */ tls_type = GOT_TLS_IE; break; case R_386_TLS_IE: - if (h) - { - /* We remember it comes from R_386_TLS_IE. */ - tls_type = GOT_TLS_IE_POS | GOT_TLS_IE_IE; - break; - } case R_386_TLS_GOTIE: tls_type = GOT_TLS_IE_POS; break; } @@ -1069,8 +1069,7 @@ elf_i386_check_relocs (bfd *abfd, tls_type |= old_tls_type; /* If a TLS symbol is accessed using IE at least once, there is no point to use dynamic model for it. */ - else if (old_tls_type != tls_type - && old_tls_type != GOT_UNKNOWN + else if (old_tls_type != tls_type && old_tls_type != GOT_UNKNOWN && (! GOT_TLS_GD_ANY_P (old_tls_type) || (tls_type & GOT_TLS_IE) == 0)) { @@ -1165,7 +1164,7 @@ elf_i386_check_relocs (bfd *abfd, && (sec->flags & SEC_ALLOC) != 0 && (r_type != R_386_PC32 || (h != NULL - && (! info->symbolic + && (! SYMBOLIC_BIND (info, h) || h->root.type == bfd_link_hash_defweak || !h->def_regular)))) || (ELIMINATE_COPY_RELOCS @@ -1192,7 +1191,7 @@ elf_i386_check_relocs (bfd *abfd, if (name == NULL) return FALSE; - if (strncmp (name, ".rel", 4) != 0 + if (! CONST_STRNEQ (name, ".rel") || strcmp (bfd_get_section_name (abfd, sec), name + 4) != 0) { @@ -1294,38 +1293,20 @@ elf_i386_check_relocs (bfd *abfd, static asection * elf_i386_gc_mark_hook (asection *sec, - struct bfd_link_info *info ATTRIBUTE_UNUSED, + struct bfd_link_info *info, Elf_Internal_Rela *rel, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { if (h != NULL) - { - switch (ELF32_R_TYPE (rel->r_info)) - { - case R_386_GNU_VTINHERIT: - case R_386_GNU_VTENTRY: - break; - - default: - switch (h->root.type) - { - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - return h->root.u.def.section; - - case bfd_link_hash_common: - return h->root.u.c.p->section; - - default: - break; - } - } - } - else - return bfd_section_from_elf_index (sec->owner, sym->st_shndx); - - return NULL; + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_386_GNU_VTINHERIT: + case R_386_GNU_VTENTRY: + return NULL; + } + + return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym); } /* Update the got entry reference counts for the section being removed. */ @@ -1438,7 +1419,6 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info, { struct elf_i386_link_hash_table *htab; asection *s; - unsigned int power_of_two; /* If this is a function, put it in the procedure linkage table. We will fill in the contents of the procedure linkage table later, @@ -1558,29 +1538,9 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info, h->needs_copy = 1; } - /* We need to figure out the alignment required for this symbol. I - have no idea how ELF linkers handle this. */ - power_of_two = bfd_log2 (h->size); - if (power_of_two > 3) - power_of_two = 3; - - /* Apply the required alignment. */ s = htab->sdynbss; - s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); - if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s)) - { - if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two)) - return FALSE; - } - - /* Define the symbol as being at this point in the section. */ - h->root.u.def.section = s; - h->root.u.def.value = s->size; - - /* Increment the section size to make room for the symbol. */ - s->size += h->size; - return TRUE; + return _bfd_elf_adjust_dynamic_copy (h, s); } /* Allocate space in .plt, .got and associated reloc sections for @@ -1700,14 +1660,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) asection *s; bfd_boolean dyn; int tls_type = elf_i386_hash_entry(h)->tls_type; - - /* If we have both R_386_TLS_IE and R_386_TLS_GD, GOT_TLS_IE_BOTH - should be used. */ - if ((tls_type & GOT_TLS_IE_MASK) - == (GOT_TLS_IE_IE | GOT_TLS_IE_GD)) - tls_type = GOT_TLS_IE_BOTH; - else - tls_type &= GOT_TLS_MASK; /* Make sure this symbol is output as a dynamic symbol. Undefined weak syms won't yet be marked as dynamic. */ @@ -2052,7 +2004,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, if (htab->elf.hplt != NULL) strip_section = FALSE; } - else if (strncmp (bfd_get_section_name (dynobj, s), ".rel", 4) == 0) + else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rel")) { if (s->size != 0 && s != htab->srelplt && s != htab->srelplt2) relocs = TRUE; @@ -2305,51 +2257,6 @@ elf_i386_relocate_section (bfd *output_bfd, howto = elf_howto_table + indx; r_symndx = ELF32_R_SYM (rel->r_info); - - if (info->relocatable) - { - bfd_vma val; - bfd_byte *where; - - /* This is a relocatable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx >= symtab_hdr->sh_info) - continue; - - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) != STT_SECTION) - continue; - - sec = local_sections[r_symndx]; - val = sec->output_offset; - if (val == 0) - continue; - - where = contents + rel->r_offset; - switch (howto->size) - { - /* FIXME: overflow checks. */ - case 0: - val += bfd_get_8 (input_bfd, where); - bfd_put_8 (input_bfd, val, where); - break; - case 1: - val += bfd_get_16 (input_bfd, where); - bfd_put_16 (input_bfd, val, where); - break; - case 2: - val += bfd_get_32 (input_bfd, where); - bfd_put_32 (input_bfd, val, where); - break; - default: - abort (); - } - continue; - } - - /* This is a final link. */ h = NULL; sym = NULL; sec = NULL; @@ -2361,10 +2268,12 @@ elf_i386_relocate_section (bfd *output_bfd, relocation = (sec->output_section->vma + sec->output_offset + sym->st_value); - if ((sec->flags & SEC_MERGE) - && ELF_ST_TYPE (sym->st_info) == STT_SECTION) + + if (ELF_ST_TYPE (sym->st_info) == STT_SECTION + && ((sec->flags & SEC_MERGE) != 0 + || (info->relocatable + && sec->output_offset != 0))) { - asection *msec; bfd_vma addend; bfd_byte *where = contents + rel->r_offset; @@ -2398,10 +2307,16 @@ elf_i386_relocate_section (bfd *output_bfd, abort (); } - msec = sec; - addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend); - addend -= relocation; - addend += msec->output_section->vma + msec->output_offset; + if (info->relocatable) + addend += sec->output_offset; + else + { + asection *msec = sec; + addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec, + addend); + addend -= relocation; + addend += msec->output_section->vma + msec->output_offset; + } switch (howto->size) { @@ -2434,21 +2349,20 @@ elf_i386_relocate_section (bfd *output_bfd, unresolved_reloc, warned); } - if (r_symndx == 0) + if (sec != NULL && elf_discarded_section (sec)) { - /* r_symndx will be zero only for relocs against symbols from - removed linkonce sections, or sections discarded by a linker - script. For these relocs, we just want the section contents - zeroed. Avoid any special processing in the switch below. */ - r_type = R_386_NONE; - - relocation = 0; - if (howto->pc_relative) - relocation = (input_section->output_section->vma - + input_section->output_offset - + rel->r_offset); + /* For relocs against symbols from removed linkonce sections, + or sections discarded by a linker script, we just want the + section contents zeroed. Avoid any special processing. */ + _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset); + rel->r_info = 0; + rel->r_addend = 0; + continue; } + if (info->relocatable) + continue; + switch (r_type) { case R_386_GOT32: @@ -2652,7 +2566,7 @@ elf_i386_relocate_section (bfd *output_bfd, && h->dynindx != -1 && (r_type == R_386_PC32 || !info->shared - || !info->symbolic + || !SYMBOLIC_BIND (info, h) || !h->def_regular)) outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); else @@ -2711,13 +2625,6 @@ elf_i386_relocate_section (bfd *output_bfd, else if (h != NULL) { tls_type = elf_i386_hash_entry(h)->tls_type; - /* If we have both R_386_TLS_IE and R_386_TLS_GD, - GOT_TLS_IE_BOTH should be used. */ - if ((tls_type & GOT_TLS_IE_MASK) - == (GOT_TLS_IE_IE | GOT_TLS_IE_GD)) - tls_type = GOT_TLS_IE_BOTH; - else - tls_type &= GOT_TLS_MASK; if (!info->shared && h->dynindx == -1 && (tls_type & GOT_TLS_IE)) r_type = R_386_TLS_LE_32; } @@ -2851,8 +2758,9 @@ elf_i386_relocate_section (bfd *output_bfd, val = bfd_get_8 (input_bfd, contents + roff + 1); BFD_ASSERT (val == 0x10); - /* Now modify the instruction as appropriate. */ - bfd_put_8 (output_bfd, 0x90, contents + roff); + /* Now modify the instruction as appropriate. Use + xchg %ax,%ax instead of 2 nops. */ + bfd_put_8 (output_bfd, 0x66, contents + roff); bfd_put_8 (output_bfd, 0x90, contents + roff + 1); continue; } @@ -3172,12 +3080,8 @@ elf_i386_relocate_section (bfd *output_bfd, subl $foo@gottpoff(%reg), %eax into: addl $foo@gotntpoff(%reg), %eax. */ - if (r_type == R_386_TLS_GOTIE) - { - contents[roff + 6] = 0x03; - if (tls_type == GOT_TLS_IE_BOTH) - off += 4; - } + if (tls_type == GOT_TLS_IE_POS) + contents[roff + 6] = 0x03; bfd_put_32 (output_bfd, htab->sgot->output_section->vma + htab->sgot->output_offset + off @@ -3261,8 +3165,8 @@ elf_i386_relocate_section (bfd *output_bfd, /* Now modify the instruction as appropriate. */ if (tls_type != GOT_TLS_IE_NEG) { - /* nop; nop */ - bfd_put_8 (output_bfd, 0x90, contents + roff); + /* xchg %ax,%ax */ + bfd_put_8 (output_bfd, 0x66, contents + roff); bfd_put_8 (output_bfd, 0x90, contents + roff + 1); } else @@ -3872,6 +3776,18 @@ elf_i386_plt_sym_val (bfd_vma i, const asection *plt, return plt->vma + (i + 1) * PLT_ENTRY_SIZE; } +/* Return TRUE if symbol should be hashed in the `.gnu.hash' section. */ + +static bfd_boolean +elf_i386_hash_symbol (struct elf_link_hash_entry *h) +{ + if (h->plt.offset != (bfd_vma) -1 + && !h->def_regular + && !h->pointer_equality_needed) + return FALSE; + + return _bfd_elf_hash_symbol (h); +} #define TARGET_LITTLE_SYM bfd_elf32_i386_vec #define TARGET_LITTLE_NAME "elf32-i386" @@ -3895,6 +3811,7 @@ elf_i386_plt_sym_val (bfd_vma i, const asection *plt, #define bfd_elf32_bfd_is_local_label_name elf_i386_is_local_label_name #define bfd_elf32_bfd_link_hash_table_create elf_i386_link_hash_table_create #define bfd_elf32_bfd_reloc_type_lookup elf_i386_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup elf_i386_reloc_name_lookup #define elf_backend_adjust_dynamic_symbol elf_i386_adjust_dynamic_symbol #define elf_backend_check_relocs elf_i386_check_relocs @@ -3911,7 +3828,10 @@ elf_i386_plt_sym_val (bfd_vma i, const asection *plt, #define elf_backend_relocate_section elf_i386_relocate_section #define elf_backend_size_dynamic_sections elf_i386_size_dynamic_sections #define elf_backend_always_size_sections elf_i386_always_size_sections +#define elf_backend_omit_section_dynsym \ + ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true) #define elf_backend_plt_sym_val elf_i386_plt_sym_val +#define elf_backend_hash_symbol elf_i386_hash_symbol #include "elf32-target.h" @@ -3921,6 +3841,8 @@ elf_i386_plt_sym_val (bfd_vma i, const asection *plt, #define TARGET_LITTLE_SYM bfd_elf32_i386_freebsd_vec #undef TARGET_LITTLE_NAME #define TARGET_LITTLE_NAME "elf32-i386-freebsd" +#undef ELF_OSABI +#define ELF_OSABI ELFOSABI_FREEBSD /* The kernel recognizes executables as valid only if they carry a "FreeBSD" label in the ELF header. So we put this label on all @@ -3935,7 +3857,7 @@ elf_i386_post_process_headers (bfd *abfd, i_ehdrp = elf_elfheader (abfd); /* Put an ABI label supported by FreeBSD >= 4.1. */ - i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD; + i_ehdrp->e_ident[EI_OSABI] = get_elf_backend_data (abfd)->elf_osabi; #ifdef OLD_FREEBSD_ABI_LABEL /* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard. */ memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8); @@ -3955,7 +3877,7 @@ elf_i386_post_process_headers (bfd *abfd, #define TARGET_LITTLE_SYM bfd_elf32_i386_vxworks_vec #undef TARGET_LITTLE_NAME #define TARGET_LITTLE_NAME "elf32-i386-vxworks" - +#undef ELF_OSABI /* Like elf_i386_link_hash_table_create but with tweaks for VxWorks. */ diff --git a/contrib/binutils/bfd/elf32-mep.c b/contrib/binutils/bfd/elf32-mep.c new file mode 100644 index 000000000000..169da4454bc3 --- /dev/null +++ b/contrib/binutils/bfd/elf32-mep.c @@ -0,0 +1,959 @@ +/* MeP-specific support for 32-bit ELF. + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 + Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "sysdep.h" +#include "bfd.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/mep.h" +#include "libiberty.h" + +/* Forward declarations. */ + +/* Private relocation functions. */ + +#define MEPREL(type, size, bits, right, left, pcrel, overflow, mask) \ + {(unsigned)type, right, size, bits, pcrel, left, overflow, mep_reloc, #type, FALSE, 0, mask, 0 } + +#define N complain_overflow_dont +#define S complain_overflow_signed +#define U complain_overflow_unsigned + +static bfd_reloc_status_type mep_reloc (bfd *, arelent *, struct bfd_symbol *, + void *, asection *, bfd *, char **); + +static reloc_howto_type mep_elf_howto_table [] = +{ + /* type, size, bits, leftshift, rightshift, pcrel, OD/OS/OU, mask. */ + MEPREL (R_MEP_NONE, 0, 0, 0, 0, 0, N, 0), + MEPREL (R_RELC, 0, 0, 0, 0, 0, N, 0), + /* MEPRELOC:HOWTO */ + /* This section generated from bfd/mep-relocs.pl from include/elf/mep.h. */ + MEPREL (R_MEP_8, 0, 8, 0, 0, 0, U, 0xff), + MEPREL (R_MEP_16, 1, 16, 0, 0, 0, U, 0xffff), + MEPREL (R_MEP_32, 2, 32, 0, 0, 0, U, 0xffffffff), + MEPREL (R_MEP_PCREL8A2, 1, 8, 1, 1, 1, S, 0x00fe), + MEPREL (R_MEP_PCREL12A2,1, 12, 1, 1, 1, S, 0x0ffe), + MEPREL (R_MEP_PCREL17A2,2, 17, 0, 1, 1, S, 0x0000ffff), + MEPREL (R_MEP_PCREL24A2,2, 24, 0, 1, 1, S, 0x07f0ffff), + MEPREL (R_MEP_PCABS24A2,2, 24, 0, 1, 0, U, 0x07f0ffff), + MEPREL (R_MEP_LOW16, 2, 16, 0, 0, 0, N, 0x0000ffff), + MEPREL (R_MEP_HI16U, 2, 32, 0,16, 0, N, 0x0000ffff), + MEPREL (R_MEP_HI16S, 2, 32, 0,16, 0, N, 0x0000ffff), + MEPREL (R_MEP_GPREL, 2, 16, 0, 0, 0, S, 0x0000ffff), + MEPREL (R_MEP_TPREL, 2, 16, 0, 0, 0, S, 0x0000ffff), + MEPREL (R_MEP_TPREL7, 1, 7, 0, 0, 0, U, 0x007f), + MEPREL (R_MEP_TPREL7A2, 1, 7, 1, 1, 0, U, 0x007e), + MEPREL (R_MEP_TPREL7A4, 1, 7, 2, 2, 0, U, 0x007c), + MEPREL (R_MEP_UIMM24, 2, 24, 0, 0, 0, U, 0x00ffffff), + MEPREL (R_MEP_ADDR24A4, 2, 24, 0, 2, 0, U, 0x00fcffff), + MEPREL (R_MEP_GNU_VTINHERIT,1, 0,16,32, 0, N, 0x0000), + MEPREL (R_MEP_GNU_VTENTRY,1, 0,16,32, 0, N, 0x0000), + /* MEPRELOC:END */ +}; + +#define VALID_MEP_RELOC(N) ((N) >= 0 \ + && (N) < ARRAY_SIZE (mep_elf_howto_table) + +#undef N +#undef S +#undef U + +static bfd_reloc_status_type +mep_reloc + (bfd * abfd ATTRIBUTE_UNUSED, + arelent * reloc_entry ATTRIBUTE_UNUSED, + struct bfd_symbol * symbol ATTRIBUTE_UNUSED, + void * data ATTRIBUTE_UNUSED, + asection * input_section ATTRIBUTE_UNUSED, + bfd * output_bfd ATTRIBUTE_UNUSED, + char ** error_message ATTRIBUTE_UNUSED) +{ + return bfd_reloc_ok; +} + + + +#define BFD_RELOC_MEP_NONE BFD_RELOC_NONE +#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) +#define MAP(n) case BFD_RELOC_MEP_##n: type = R_MEP_##n; break +#else +#define MAP(n) case BFD_RELOC_MEP_/**/n: type = R_MEP_/**/n; break +#endif + +static reloc_howto_type * +mep_reloc_type_lookup + (bfd * abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) +{ + unsigned int type = 0; + + switch (code) + { + MAP(NONE); + case BFD_RELOC_8: + type = R_MEP_8; + break; + case BFD_RELOC_16: + type = R_MEP_16; + break; + case BFD_RELOC_32: + type = R_MEP_32; + break; + case BFD_RELOC_VTABLE_ENTRY: + type = R_MEP_GNU_VTENTRY; + break; + case BFD_RELOC_VTABLE_INHERIT: + type = R_MEP_GNU_VTINHERIT; + break; + case BFD_RELOC_RELC: + type = R_RELC; + break; + + /* MEPRELOC:MAP */ + /* This section generated from bfd/mep-relocs.pl from include/elf/mep.h. */ + MAP(8); + MAP(16); + MAP(32); + MAP(PCREL8A2); + MAP(PCREL12A2); + MAP(PCREL17A2); + MAP(PCREL24A2); + MAP(PCABS24A2); + MAP(LOW16); + MAP(HI16U); + MAP(HI16S); + MAP(GPREL); + MAP(TPREL); + MAP(TPREL7); + MAP(TPREL7A2); + MAP(TPREL7A4); + MAP(UIMM24); + MAP(ADDR24A4); + MAP(GNU_VTINHERIT); + MAP(GNU_VTENTRY); + /* MEPRELOC:END */ + + default: + /* Pacify gcc -Wall. */ + fprintf (stderr, "mep: no reloc for code %d\n", code); + return NULL; + } + + if (mep_elf_howto_table[type].type != type) + { + fprintf (stderr, "MeP: howto %d has type %d\n", type, mep_elf_howto_table[type].type); + abort (); + } + + return mep_elf_howto_table + type; +} + +#undef MAP + +static reloc_howto_type * +mep_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (mep_elf_howto_table) / sizeof (mep_elf_howto_table[0]); + i++) + if (mep_elf_howto_table[i].name != NULL + && strcasecmp (mep_elf_howto_table[i].name, r_name) == 0) + return &mep_elf_howto_table[i]; + + return NULL; +} + +/* Perform a single relocation. */ + +static struct bfd_link_info *mep_info; +static int warn_tp = 0, warn_sda = 0; + +static bfd_vma +mep_lookup_global + (char * name, + bfd_vma ofs, + bfd_vma * cache, + int * warn) +{ + struct bfd_link_hash_entry *h; + + if (*cache || *warn) + return *cache; + + h = bfd_link_hash_lookup (mep_info->hash, name, FALSE, FALSE, TRUE); + if (h == 0 || h->type != bfd_link_hash_defined) + { + *warn = ofs + 1; + return 0; + } + *cache = (h->u.def.value + + h->u.def.section->output_section->vma + + h->u.def.section->output_offset); + return *cache; +} + +static bfd_vma +mep_tpoff_base (bfd_vma ofs) +{ + static bfd_vma cache = 0; + return mep_lookup_global ("__tpbase", ofs, &cache, &warn_tp); +} + +static bfd_vma +mep_sdaoff_base (bfd_vma ofs) +{ + static bfd_vma cache = 0; + return mep_lookup_global ("__sdabase", ofs, &cache, &warn_sda); +} + +static bfd_reloc_status_type +mep_final_link_relocate + (reloc_howto_type * howto, + bfd * input_bfd, + asection * input_section, + bfd_byte * contents, + Elf_Internal_Rela * rel, + bfd_vma relocation) +{ + unsigned long u; + long s; + unsigned char *byte; + bfd_vma pc; + bfd_reloc_status_type r = bfd_reloc_ok; + int e2, e4; + + if (bfd_big_endian (input_bfd)) + { + e2 = 0; + e4 = 0; + } + else + { + e2 = 1; + e4 = 3; + } + + pc = (input_section->output_section->vma + + input_section->output_offset + + rel->r_offset); + + s = relocation + rel->r_addend; + + byte = (unsigned char *)contents + rel->r_offset; + + if (howto->type == R_MEP_PCREL24A2 + && s == 0 + && pc >= 0x800000) + { + /* This is an unreachable branch to an undefined weak function. + Silently ignore it, since the opcode can't do that but should + never be executed anyway. */ + return bfd_reloc_ok; + } + + if (howto->pc_relative) + s -= pc; + + u = (unsigned long) s; + + switch (howto->type) + { + /* MEPRELOC:APPLY */ + /* This section generated from bfd/mep-relocs.pl from include/elf/mep.h. */ + case R_MEP_8: /* 76543210 */ + if (u > 255) r = bfd_reloc_overflow; + byte[0] = (u & 0xff); + break; + case R_MEP_16: /* fedcba9876543210 */ + if (u > 65535) r = bfd_reloc_overflow; + byte[0^e2] = ((u >> 8) & 0xff); + byte[1^e2] = (u & 0xff); + break; + case R_MEP_32: /* vutsrqponmlkjihgfedcba9876543210 */ + byte[0^e4] = ((u >> 24) & 0xff); + byte[1^e4] = ((u >> 16) & 0xff); + byte[2^e4] = ((u >> 8) & 0xff); + byte[3^e4] = (u & 0xff); + break; + case R_MEP_PCREL8A2: /* --------7654321- */ + if (-128 > s || s > 127) r = bfd_reloc_overflow; + byte[1^e2] = (byte[1^e2] & 0x01) | (s & 0xfe); + break; + case R_MEP_PCREL12A2: /* ----ba987654321- */ + if (-2048 > s || s > 2047) r = bfd_reloc_overflow; + byte[0^e2] = (byte[0^e2] & 0xf0) | ((s >> 8) & 0x0f); + byte[1^e2] = (byte[1^e2] & 0x01) | (s & 0xfe); + break; + case R_MEP_PCREL17A2: /* ----------------gfedcba987654321 */ + if (-65536 > s || s > 65535) r = bfd_reloc_overflow; + byte[2^e2] = ((s >> 9) & 0xff); + byte[3^e2] = ((s >> 1) & 0xff); + break; + case R_MEP_PCREL24A2: /* -----7654321----nmlkjihgfedcba98 */ + if (-8388608 > s || s > 8388607) r = bfd_reloc_overflow; + byte[0^e2] = (byte[0^e2] & 0xf8) | ((s >> 5) & 0x07); + byte[1^e2] = (byte[1^e2] & 0x0f) | ((s << 3) & 0xf0); + byte[2^e2] = ((s >> 16) & 0xff); + byte[3^e2] = ((s >> 8) & 0xff); + break; + case R_MEP_PCABS24A2: /* -----7654321----nmlkjihgfedcba98 */ + if (u > 16777215) r = bfd_reloc_overflow; + byte[0^e2] = (byte[0^e2] & 0xf8) | ((u >> 5) & 0x07); + byte[1^e2] = (byte[1^e2] & 0x0f) | ((u << 3) & 0xf0); + byte[2^e2] = ((u >> 16) & 0xff); + byte[3^e2] = ((u >> 8) & 0xff); + break; + case R_MEP_LOW16: /* ----------------fedcba9876543210 */ + byte[2^e2] = ((u >> 8) & 0xff); + byte[3^e2] = (u & 0xff); + break; + case R_MEP_HI16U: /* ----------------vutsrqponmlkjihg */ + byte[2^e2] = ((u >> 24) & 0xff); + byte[3^e2] = ((u >> 16) & 0xff); + break; + case R_MEP_HI16S: /* ----------------vutsrqponmlkjihg */ + byte[2^e2] = ((s >> 24) & 0xff); + byte[3^e2] = ((s >> 16) & 0xff); + break; + case R_MEP_GPREL: /* ----------------fedcba9876543210 */ + s -= mep_sdaoff_base(rel->r_offset); + if (-32768 > s || s > 32767) r = bfd_reloc_overflow; + byte[2^e2] = ((s >> 8) & 0xff); + byte[3^e2] = (s & 0xff); + break; + case R_MEP_TPREL: /* ----------------fedcba9876543210 */ + s -= mep_tpoff_base(rel->r_offset); + if (-32768 > s || s > 32767) r = bfd_reloc_overflow; + byte[2^e2] = ((s >> 8) & 0xff); + byte[3^e2] = (s & 0xff); + break; + case R_MEP_TPREL7: /* ---------6543210 */ + u -= mep_tpoff_base(rel->r_offset); + if (u > 127) r = bfd_reloc_overflow; + byte[1^e2] = (byte[1^e2] & 0x80) | (u & 0x7f); + break; + case R_MEP_TPREL7A2: /* ---------654321- */ + u -= mep_tpoff_base(rel->r_offset); + if (u > 127) r = bfd_reloc_overflow; + byte[1^e2] = (byte[1^e2] & 0x81) | (u & 0x7e); + break; + case R_MEP_TPREL7A4: /* ---------65432-- */ + u -= mep_tpoff_base(rel->r_offset); + if (u > 127) r = bfd_reloc_overflow; + byte[1^e2] = (byte[1^e2] & 0x83) | (u & 0x7c); + break; + case R_MEP_UIMM24: /* --------76543210nmlkjihgfedcba98 */ + if (u > 16777215) r = bfd_reloc_overflow; + byte[1^e2] = (u & 0xff); + byte[2^e2] = ((u >> 16) & 0xff); + byte[3^e2] = ((u >> 8) & 0xff); + break; + case R_MEP_ADDR24A4: /* --------765432--nmlkjihgfedcba98 */ + if (u > 16777215) r = bfd_reloc_overflow; + byte[1^e2] = (byte[1^e2] & 0x03) | (u & 0xfc); + byte[2^e2] = ((u >> 16) & 0xff); + byte[3^e2] = ((u >> 8) & 0xff); + break; + case R_MEP_GNU_VTINHERIT: /* ---------------- */ + break; + case R_MEP_GNU_VTENTRY: /* ---------------- */ + break; + /* MEPRELOC:END */ + default: + abort (); + } + + return r; +} + +/* Set the howto pointer for a MEP ELF reloc. */ + +static void +mep_info_to_howto_rela + (bfd * abfd ATTRIBUTE_UNUSED, + arelent * cache_ptr, + Elf_Internal_Rela * dst) +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + cache_ptr->howto = & mep_elf_howto_table [r_type]; +} + +/* Look through the relocs for a section during the first phase. + Since we don't do .gots or .plts, we just need to consider the + virtual table relocs for gc. */ + +static bfd_boolean +mep_elf_check_relocs + (bfd * abfd, + struct bfd_link_info * info, + asection * sec, + const Elf_Internal_Rela * relocs) +{ + Elf_Internal_Shdr * symtab_hdr; + struct elf_link_hash_entry ** sym_hashes; + struct elf_link_hash_entry ** sym_hashes_end; + const Elf_Internal_Rela * rel; + const Elf_Internal_Rela * rel_end; + + if (info->relocatable) + return TRUE; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + sym_hashes_end = sym_hashes + symtab_hdr->sh_size / sizeof (Elf32_External_Sym); + if (!elf_bad_symtab (abfd)) + sym_hashes_end -= symtab_hdr->sh_info; + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + struct elf_link_hash_entry *h; + unsigned long r_symndx; + + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + } + return TRUE; +} + + +/* Relocate a MEP ELF section. + There is some attempt to make this function usable for many architectures, + both USE_REL and USE_RELA ['twould be nice if such a critter existed], + if only to serve as a learning tool. + + The RELOCATE_SECTION function is called by the new ELF backend linker + to handle the relocations for a section. + + The relocs are always passed as Rela structures; if the section + actually uses Rel structures, the r_addend field will always be + zero. + + This function is responsible for adjusting the section contents as + necessary, and (if using Rela relocs and generating a relocatable + output file) adjusting the reloc addend as necessary. + + This function does not have to worry about setting the reloc + address or the reloc symbol index. + + LOCAL_SYMS is a pointer to the swapped in local symbols. + + LOCAL_SECTIONS is an array giving the section in the input file + corresponding to the st_shndx field of each local symbol. + + The global hash table entry for the global symbols can be found + via elf_sym_hashes (input_bfd). + + When generating relocatable output, this function must handle + STB_LOCAL/STT_SECTION symbols specially. The output symbol is + going to be the section symbol corresponding to the output + section, which means that the addend must be adjusted + accordingly. */ + +static bfd_boolean +mep_elf_relocate_section + (bfd * output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info * info, + bfd * input_bfd, + asection * input_section, + bfd_byte * contents, + Elf_Internal_Rela * relocs, + Elf_Internal_Sym * local_syms, + asection ** local_sections) +{ + Elf_Internal_Shdr * symtab_hdr; + struct elf_link_hash_entry ** sym_hashes; + Elf_Internal_Rela * rel; + Elf_Internal_Rela * relend; + + symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + relend = relocs + input_section->reloc_count; + + mep_info = info; + + for (rel = relocs; rel < relend; rel ++) + { + reloc_howto_type * howto; + unsigned long r_symndx; + Elf_Internal_Sym * sym; + asection * sec; + struct elf_link_hash_entry * h; + bfd_vma relocation; + bfd_reloc_status_type r; + const char * name = NULL; + int r_type; + + r_type = ELF32_R_TYPE (rel->r_info); + + r_symndx = ELF32_R_SYM (rel->r_info); + + /* Is this a complex relocation? */ + if (!info->relocatable && ELF32_R_TYPE (rel->r_info) == R_RELC) + { + bfd_elf_perform_complex_relocation (output_bfd, info, + input_bfd, input_section, contents, + rel, local_syms, local_sections); + continue; + } + + howto = mep_elf_howto_table + ELF32_R_TYPE (rel->r_info); + h = NULL; + sym = NULL; + sec = NULL; + + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections [r_symndx]; + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + + name = bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name); + name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; +#if 0 + fprintf (stderr, "local: sec: %s, sym: %s (%d), value: %x + %x + %x addend %x\n", + sec->name, name, sym->st_name, + sec->output_section->vma, sec->output_offset, + sym->st_value, rel->r_addend); +#endif + } + else + { + relocation = 0; + h = sym_hashes [r_symndx]; + + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + name = h->root.root.string; + + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + sec = h->root.u.def.section; + relocation = (h->root.u.def.value + + sec->output_section->vma + + sec->output_offset); +#if 0 + fprintf (stderr, + "defined: sec: %s, name: %s, value: %x + %x + %x gives: %x\n", + sec->name, name, h->root.u.def.value, + sec->output_section->vma, sec->output_offset, relocation); +#endif + } + else if (h->root.type == bfd_link_hash_undefweak) + { +#if 0 + fprintf (stderr, "undefined: sec: %s, name: %s\n", + sec->name, name); +#endif + } + else if (!info->relocatable) + { + if (! ((*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, + input_section, rel->r_offset, + (!info->shared && info->unresolved_syms_in_objects == RM_GENERATE_ERROR)))) + return FALSE; +#if 0 + fprintf (stderr, "unknown: name: %s\n", name); +#endif + } + } + + if (sec != NULL && elf_discarded_section (sec)) + { + /* For relocs against symbols from removed linkonce sections, + or sections discarded by a linker script, we just want the + section contents zeroed. Avoid any special processing. */ + _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset); + rel->r_info = 0; + rel->r_addend = 0; + continue; + } + + if (info->relocatable) + { + /* This is a relocatable link. We don't have to change + anything, unless the reloc is against a section symbol, + in which case we have to adjust according to where the + section symbol winds up in the output section. */ + if (sym != NULL && ELF_ST_TYPE (sym->st_info) == STT_SECTION) + rel->r_addend += sec->output_offset; + continue; + } + + switch (r_type) + { + default: + r = mep_final_link_relocate (howto, input_bfd, input_section, + contents, rel, relocation); + break; + } + + if (r != bfd_reloc_ok) + { + const char * msg = (const char *) NULL; + + switch (r) + { + case bfd_reloc_overflow: + r = info->callbacks->reloc_overflow + (info, (h ? &h->root : NULL), name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset); + break; + + case bfd_reloc_undefined: + r = info->callbacks->undefined_symbol + (info, name, input_bfd, input_section, rel->r_offset, TRUE); + break; + + case bfd_reloc_outofrange: + msg = _("internal error: out of range error"); + break; + + case bfd_reloc_notsupported: + msg = _("internal error: unsupported relocation error"); + break; + + case bfd_reloc_dangerous: + msg = _("internal error: dangerous relocation"); + break; + + default: + msg = _("internal error: unknown error"); + break; + } + + if (msg) + r = info->callbacks->warning + (info, msg, name, input_bfd, input_section, rel->r_offset); + + if (! r) + return FALSE; + } + } + + if (warn_tp) + info->callbacks->undefined_symbol + (info, "__tpbase", input_bfd, input_section, warn_tp-1, TRUE); + if (warn_sda) + info->callbacks->undefined_symbol + (info, "__sdabase", input_bfd, input_section, warn_sda-1, TRUE); + if (warn_sda || warn_tp) + return FALSE; + + return TRUE; +} + + +/* Update the got entry reference counts for the section being + removed. */ + +static bfd_boolean +mep_elf_gc_sweep_hook + (bfd * abfd ATTRIBUTE_UNUSED, + struct bfd_link_info * info ATTRIBUTE_UNUSED, + asection * sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela * relocs ATTRIBUTE_UNUSED) +{ + return TRUE; +} + +/* Return the section that should be marked against GC for a given + relocation. */ + +static asection * +mep_elf_gc_mark_hook + (asection * sec, + struct bfd_link_info * info ATTRIBUTE_UNUSED, + Elf_Internal_Rela * rel, + struct elf_link_hash_entry * h, + Elf_Internal_Sym * sym) +{ + if (h != NULL) + { + switch (ELF32_R_TYPE (rel->r_info)) + { + default: + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + + default: + break; + } + } + } + else + { + if (!(elf_bad_symtab (sec->owner) + && ELF_ST_BIND (sym->st_info) != STB_LOCAL) + && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE) + && sym->st_shndx != SHN_COMMON)) + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + } + + return NULL; +} + + +/* Function to set the ELF flag bits. */ + +static bfd_boolean +mep_elf_set_private_flags (bfd * abfd, + flagword flags) +{ + elf_elfheader (abfd)->e_flags = flags; + elf_flags_init (abfd) = TRUE; + return TRUE; +} + +static bfd_boolean +mep_elf_copy_private_bfd_data (bfd * ibfd, bfd * obfd) +{ + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags; + elf_flags_init (obfd) = TRUE; + + /* Copy object attributes. */ + _bfd_elf_copy_obj_attributes (ibfd, obfd); + + return TRUE; +} + +/* Merge backend specific data from an object file to the output + object file when linking. */ + +static bfd_boolean +mep_elf_merge_private_bfd_data (bfd * ibfd, bfd * obfd) +{ + static bfd *last_ibfd = 0; + flagword old_flags, new_flags; + flagword old_partial, new_partial; + + /* Check if we have the same endianess. */ + if (_bfd_generic_verify_endian_match (ibfd, obfd) == FALSE) + return FALSE; + + new_flags = elf_elfheader (ibfd)->e_flags; + old_flags = elf_elfheader (obfd)->e_flags; + +#ifdef DEBUG + _bfd_error_handler ("%B: old_flags = 0x%.8lx, new_flags = 0x%.8lx, init = %s", + ibfd, old_flags, new_flags, elf_flags_init (obfd) ? "yes" : "no"); +#endif + + /* First call, no flags set. */ + if (!elf_flags_init (obfd)) + { + elf_flags_init (obfd) = TRUE; + old_flags = new_flags; + } + else if ((new_flags | old_flags) & EF_MEP_LIBRARY) + { + /* Non-library flags trump library flags. The choice doesn't really + matter if both OLD_FLAGS and NEW_FLAGS have EF_MEP_LIBRARY set. */ + if (old_flags & EF_MEP_LIBRARY) + old_flags = new_flags; + } + else + { + /* Make sure they're for the same mach. Allow upgrade from the "mep" + mach. */ + new_partial = (new_flags & EF_MEP_CPU_MASK); + old_partial = (old_flags & EF_MEP_CPU_MASK); + if (new_partial == old_partial) + ; + else if (new_partial == EF_MEP_CPU_MEP) + ; + else if (old_partial == EF_MEP_CPU_MEP) + old_flags = (old_flags & ~EF_MEP_CPU_MASK) | new_partial; + else + { + _bfd_error_handler (_("%B and %B are for different cores"), last_ibfd, ibfd); + bfd_set_error (bfd_error_invalid_target); + return FALSE; + } + + /* Make sure they're for the same me_module. Allow basic config to + mix with any other. */ + new_partial = (new_flags & EF_MEP_INDEX_MASK); + old_partial = (old_flags & EF_MEP_INDEX_MASK); + if (new_partial == old_partial) + ; + else if (new_partial == 0) + ; + else if (old_partial == 0) + old_flags = (old_flags & ~EF_MEP_INDEX_MASK) | new_partial; + else + { + _bfd_error_handler (_("%B and %B are for different configurations"), last_ibfd, ibfd); + bfd_set_error (bfd_error_invalid_target); + return FALSE; + } + } + + elf_elfheader (obfd)->e_flags = old_flags; + last_ibfd = ibfd; + return TRUE; +} + +/* This will be edited by the MeP configration tool. */ +static const char * config_names[] = +{ + "basic" + /* start-mepcfgtool */ + ,"simple" + ,"fmax" + /* end-mepcfgtool */ +}; + +static const char * core_names[] = +{ + "MeP", "MeP-c2", "MeP-c3", "MeP-h1" +}; + +static bfd_boolean +mep_elf_print_private_bfd_data (bfd * abfd, void * ptr) +{ + FILE * file = (FILE *) ptr; + flagword flags, partial_flags; + + BFD_ASSERT (abfd != NULL && ptr != NULL); + + /* Print normal ELF private data. */ + _bfd_elf_print_private_bfd_data (abfd, ptr); + + flags = elf_elfheader (abfd)->e_flags; + fprintf (file, _("private flags = 0x%lx"), (long)flags); + + partial_flags = (flags & EF_MEP_CPU_MASK) >> 24; + if (partial_flags < ARRAY_SIZE (core_names)) + fprintf (file, " core: %s", core_names[(long)partial_flags]); + + partial_flags = flags & EF_MEP_INDEX_MASK; + if (partial_flags < ARRAY_SIZE (config_names)) + fprintf (file, " me_module: %s", config_names[(long)partial_flags]); + + fputc ('\n', file); + + return TRUE; +} + +/* Return the machine subcode from the ELF e_flags header. */ + +static int +elf32_mep_machine (bfd * abfd) +{ + switch (elf_elfheader (abfd)->e_flags & EF_MEP_CPU_MASK) + { + default: break; + case EF_MEP_CPU_C2: return bfd_mach_mep; + case EF_MEP_CPU_C3: return bfd_mach_mep; + case EF_MEP_CPU_C4: return bfd_mach_mep; + case EF_MEP_CPU_H1: return bfd_mach_mep_h1; + } + + return bfd_mach_mep; +} + +static bfd_boolean +mep_elf_object_p (bfd * abfd) +{ + /* Irix 5 and 6 is broken. Object file symbol tables are not always + sorted correctly such that local symbols preceed global symbols, + and the sh_info field in the symbol table is not always right. */ + /* This is needed for the RELC support code. */ + elf_bad_symtab (abfd) = TRUE; + bfd_default_set_arch_mach (abfd, bfd_arch_mep, elf32_mep_machine (abfd)); + return TRUE; +} + +static bfd_boolean +mep_elf_section_flags (flagword * flags, const Elf_Internal_Shdr * hdr) +{ + if (hdr->sh_flags & SHF_MEP_VLIW) + * flags |= SEC_MEP_VLIW; + return TRUE; +} + +static bfd_boolean +mep_elf_fake_sections (bfd * abfd ATTRIBUTE_UNUSED, + Elf_Internal_Shdr * hdr, + asection * sec) +{ + if (sec->flags & SEC_MEP_VLIW) + hdr->sh_flags |= SHF_MEP_VLIW; + return TRUE; +} + + +#define ELF_ARCH bfd_arch_mep +#define ELF_MACHINE_CODE EM_CYGNUS_MEP +#define ELF_MAXPAGESIZE 0x1000 + +#define TARGET_BIG_SYM bfd_elf32_mep_vec +#define TARGET_BIG_NAME "elf32-mep" + +#define TARGET_LITTLE_SYM bfd_elf32_mep_little_vec +#define TARGET_LITTLE_NAME "elf32-mep-little" + +#define elf_info_to_howto_rel NULL +#define elf_info_to_howto mep_info_to_howto_rela +#define elf_backend_relocate_section mep_elf_relocate_section +#define elf_backend_gc_mark_hook mep_elf_gc_mark_hook +#define elf_backend_gc_sweep_hook mep_elf_gc_sweep_hook +#define elf_backend_check_relocs mep_elf_check_relocs +#define elf_backend_object_p mep_elf_object_p +#define elf_backend_section_flags mep_elf_section_flags +#define elf_backend_fake_sections mep_elf_fake_sections + +#define elf_backend_can_gc_sections 1 + +#define bfd_elf32_bfd_reloc_type_lookup mep_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup mep_reloc_name_lookup +#define bfd_elf32_bfd_set_private_flags mep_elf_set_private_flags +#define bfd_elf32_bfd_copy_private_bfd_data mep_elf_copy_private_bfd_data +#define bfd_elf32_bfd_merge_private_bfd_data mep_elf_merge_private_bfd_data +#define bfd_elf32_bfd_print_private_bfd_data mep_elf_print_private_bfd_data + +/* We use only the RELA entries. */ +#define USE_RELA + +#include "elf32-target.h" diff --git a/contrib/binutils/bfd/elf32-mips.c b/contrib/binutils/bfd/elf32-mips.c index 6ed4ad35f627..3843b856e16a 100644 --- a/contrib/binutils/bfd/elf32-mips.c +++ b/contrib/binutils/bfd/elf32-mips.c @@ -1,6 +1,6 @@ /* MIPS-specific support for 32-bit ELF Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005 Free Software Foundation, Inc. + 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Most of the information added by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>. @@ -29,8 +29,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. different MIPS ELF from other targets. This matters when linking. This file supports both, switching at runtime. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "bfdlink.h" #include "genlink.h" @@ -68,8 +68,6 @@ static bfd_boolean mips_elf32_object_p (bfd *); static bfd_boolean mips_elf_is_local_label_name (bfd *, const char *); -static bfd_reloc_status_type mips16_jump_reloc - (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips16_gprel_reloc (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf_final_gp @@ -702,6 +700,21 @@ static reloc_howto_type elf_mips_howto_table_rel[] = 0x0000ffff, /* src_mask */ 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ + + /* 32 bit relocation with no addend. */ + HOWTO (R_MIPS_GLOB_DAT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_mips_elf_generic_reloc, /* special_function */ + "R_MIPS_GLOB_DAT", /* name */ + FALSE, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ }; /* The reloc used for BFD_RELOC_CTOR when doing a 64 bit link. This @@ -734,7 +747,7 @@ static reloc_howto_type elf_mips16_howto_table_rel[] = /* This needs complex overflow detection, because the upper four bits must match the PC. */ - mips16_jump_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS16_26", /* name */ TRUE, /* partial_inplace */ 0x3ffffff, /* src_mask */ @@ -1112,36 +1125,6 @@ mips32_64bit_reloc (bfd *abfd, arelent *reloc_entry, return r; } -/* Handle a mips16 jump. */ - -static bfd_reloc_status_type -mips16_jump_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, - asymbol *symbol, void *data ATTRIBUTE_UNUSED, - asection *input_section, bfd *output_bfd, - char **error_message ATTRIBUTE_UNUSED) -{ - if (output_bfd != NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - /* FIXME. */ - { - static bfd_boolean warned; - - if (! warned) - (*_bfd_error_handler) - (_("Linking mips16 objects into %s format is not supported"), - bfd_get_target (input_section->output_section->owner)); - warned = TRUE; - } - - return bfd_reloc_undefined; -} - /* Handle a mips16 GP relative reloc. */ static bfd_reloc_status_type @@ -1291,6 +1274,40 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code) } } +static reloc_howto_type * +bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (elf_mips_howto_table_rel) + / sizeof (elf_mips_howto_table_rel[0])); + i++) + if (elf_mips_howto_table_rel[i].name != NULL + && strcasecmp (elf_mips_howto_table_rel[i].name, r_name) == 0) + return &elf_mips_howto_table_rel[i]; + + for (i = 0; + i < (sizeof (elf_mips16_howto_table_rel) + / sizeof (elf_mips16_howto_table_rel[0])); + i++) + if (elf_mips16_howto_table_rel[i].name != NULL + && strcasecmp (elf_mips16_howto_table_rel[i].name, r_name) == 0) + return &elf_mips16_howto_table_rel[i]; + + if (strcasecmp (elf_mips_gnu_pcrel32.name, r_name) == 0) + return &elf_mips_gnu_pcrel32; + if (strcasecmp (elf_mips_gnu_rel16_s2.name, r_name) == 0) + return &elf_mips_gnu_rel16_s2; + if (strcasecmp (elf_mips_gnu_vtinherit_howto.name, r_name) == 0) + return &elf_mips_gnu_vtinherit_howto; + if (strcasecmp (elf_mips_gnu_vtentry_howto.name, r_name) == 0) + return &elf_mips_gnu_vtentry_howto; + + return NULL; +} + /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */ static reloc_howto_type * @@ -1537,12 +1554,15 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { #define elf_backend_create_dynamic_sections \ _bfd_mips_elf_create_dynamic_sections #define elf_backend_check_relocs _bfd_mips_elf_check_relocs +#define elf_backend_merge_symbol_attribute \ + _bfd_mips_elf_merge_symbol_attribute #define elf_backend_adjust_dynamic_symbol \ _bfd_mips_elf_adjust_dynamic_symbol #define elf_backend_always_size_sections \ _bfd_mips_elf_always_size_sections #define elf_backend_size_dynamic_sections \ _bfd_mips_elf_size_dynamic_sections +#define elf_backend_init_index_section _bfd_elf_init_1_index_section #define elf_backend_relocate_section _bfd_mips_elf_relocate_section #define elf_backend_finish_dynamic_symbol \ _bfd_mips_elf_finish_dynamic_symbol @@ -1599,6 +1619,7 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { /* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses a value of 0x1000, and we are compatible. */ #define ELF_MAXPAGESIZE 0x1000 +#define ELF_COMMONPAGESIZE 0x1000 #include "elf32-target.h" @@ -1609,15 +1630,20 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { #undef TARGET_BIG_NAME #undef ELF_MAXPAGESIZE +#undef ELF_COMMONPAGESIZE #define TARGET_LITTLE_SYM bfd_elf32_tradlittlemips_vec #define TARGET_LITTLE_NAME "elf32-tradlittlemips" #define TARGET_BIG_SYM bfd_elf32_tradbigmips_vec #define TARGET_BIG_NAME "elf32-tradbigmips" -/* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses - page sizes of up to that limit, so we need to respect it. */ +/* The MIPS ABI says at Page 5-1: + Virtual addresses and file offsets for MIPS segments are congruent + modulo 64 KByte (0x10000) or larger powers of 2. Because 64 KBytes + is the maximum page size, the files are suitable for paging + regardless of physical page size. */ #define ELF_MAXPAGESIZE 0x10000 +#define ELF_COMMONPAGESIZE 0x1000 #define elf32_bed elf32_tradbed /* Include the target file again for this target. */ @@ -1672,6 +1698,17 @@ mips_vxworks_bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code) } } +static reloc_howto_type * +mips_vxworks_bfd_reloc_name_lookup (bfd *abfd, const char *r_name) +{ + if (strcasecmp (mips_vxworks_copy_howto_rela.name, r_name) == 0) + return &mips_vxworks_copy_howto_rela; + if (strcasecmp (mips_vxworks_jump_slot_howto_rela.name, r_name) == 0) + return &mips_vxworks_jump_slot_howto_rela; + + return bfd_elf32_bfd_reloc_name_lookup (abfd, r_name); +} + /* Implement elf_backend_mips_rtype_to_lookup for VxWorks. */ static reloc_howto_type * @@ -1702,6 +1739,9 @@ mips_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker) #undef TARGET_BIG_SYM #undef TARGET_BIG_NAME +#undef ELF_MAXPAGESIZE +#undef ELF_COMMONPAGESIZE + #define TARGET_LITTLE_SYM bfd_elf32_littlemips_vxworks_vec #define TARGET_LITTLE_NAME "elf32-littlemips-vxworks" #define TARGET_BIG_SYM bfd_elf32_bigmips_vxworks_vec @@ -1710,8 +1750,8 @@ mips_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker) #undef elf32_bed #define elf32_bed elf32_mips_vxworks_bed -#undef ELF_MAXPAGESIZE #define ELF_MAXPAGESIZE 0x1000 +#define ELF_COMMONPAGESIZE 0x1000 #undef elf_backend_want_got_plt #define elf_backend_want_got_plt 1 @@ -1735,6 +1775,9 @@ mips_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker) #undef bfd_elf32_bfd_reloc_type_lookup #define bfd_elf32_bfd_reloc_type_lookup \ mips_vxworks_bfd_reloc_type_lookup +#undef bfd_elf32_bfd_reloc_name_lookup +#define bfd_elf32_bfd_reloc_name_lookup \ + mips_vxworks_bfd_reloc_name_lookup #undef elf_backend_mips_rtype_to_howto #define elf_backend_mips_rtype_to_howto \ mips_vxworks_rtype_to_howto diff --git a/contrib/binutils/bfd/elf32-ppc.c b/contrib/binutils/bfd/elf32-ppc.c index 53d1046bb8cb..d67ad866a6f0 100644 --- a/contrib/binutils/bfd/elf32-ppc.c +++ b/contrib/binutils/bfd/elf32-ppc.c @@ -1,6 +1,6 @@ /* PowerPC-specific support for 32-bit ELF Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, - 2004, 2005, 2006 Free Software Foundation, Inc. + 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -25,8 +25,9 @@ suggestions from the in-progress Embedded PowerPC ABI, and that information may also not match. */ -#include "bfd.h" #include "sysdep.h" +#include <stdarg.h> +#include "bfd.h" #include "bfdlink.h" #include "libbfd.h" #include "elf-bfd.h" @@ -1577,6 +1578,22 @@ ppc_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return ppc_elf_howto_table[r]; }; +static reloc_howto_type * +ppc_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (ppc_elf_howto_raw) / sizeof (ppc_elf_howto_raw[0]); + i++) + if (ppc_elf_howto_raw[i].name != NULL + && strcasecmp (ppc_elf_howto_raw[i].name, r_name) == 0) + return &ppc_elf_howto_raw[i]; + + return NULL; +} + /* Set the howto pointer for a PowerPC ELF reloc. */ static void @@ -1590,6 +1607,17 @@ ppc_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, BFD_ASSERT (ELF32_R_TYPE (dst->r_info) < (unsigned int) R_PPC_max); cache_ptr->howto = ppc_elf_howto_table[ELF32_R_TYPE (dst->r_info)]; + + /* Just because the above assert didn't trigger doesn't mean that + ELF32_R_TYPE (dst->r_info) is necessarily a valid relocation. */ + if (!cache_ptr->howto) + { + (*_bfd_error_handler) (_("%B: invalid relocation type %d"), + abfd, ELF32_R_TYPE (dst->r_info)); + bfd_set_error (bfd_error_bad_value); + + cache_ptr->howto = ppc_elf_howto_table[R_PPC_NONE]; + } } /* Handle the R_PPC_ADDR16_HA and R_PPC_REL16_HA relocs. */ @@ -1695,6 +1723,10 @@ struct ppc_elf_obj_tdata /* A mapping from local symbols to offsets into the various linker sections added. This is index by the symbol index. */ elf_linker_section_pointers_t **linker_section_pointers; + + /* Flags used to auto-detect plt type. */ + unsigned int makes_plt_call : 1; + unsigned int has_rel16 : 1; }; #define ppc_elf_tdata(bfd) \ @@ -1708,11 +1740,14 @@ struct ppc_elf_obj_tdata static bfd_boolean ppc_elf_mkobject (bfd *abfd) { - bfd_size_type amt = sizeof (struct ppc_elf_obj_tdata); - abfd->tdata.any = bfd_zalloc (abfd, amt); if (abfd->tdata.any == NULL) - return FALSE; - return TRUE; + { + bfd_size_type amt = sizeof (struct ppc_elf_obj_tdata); + abfd->tdata.any = bfd_zalloc (abfd, amt); + if (abfd->tdata.any == NULL) + return FALSE; + } + return bfd_elf_mkobject (abfd); } /* Fix bad default arch selected for a 32 bit input bfd when the @@ -1810,6 +1845,52 @@ ppc_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) return TRUE; } +static char * +ppc_elf_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type, ...) +{ + switch (note_type) + { + default: + return NULL; + + case NT_PRPSINFO: + { + char data[128]; + va_list ap; + + va_start (ap, note_type); + memset (data, 0, 32); + strncpy (data + 32, va_arg (ap, const char *), 16); + strncpy (data + 48, va_arg (ap, const char *), 80); + va_end (ap); + return elfcore_write_note (abfd, buf, bufsiz, + "CORE", note_type, data, sizeof (data)); + } + + case NT_PRSTATUS: + { + char data[268]; + va_list ap; + long pid; + int cursig; + const void *greg; + + va_start (ap, note_type); + memset (data, 0, 72); + pid = va_arg (ap, long); + bfd_put_32 (abfd, pid, data + 24); + cursig = va_arg (ap, int); + bfd_put_16 (abfd, cursig, data + 12); + greg = va_arg (ap, const void *); + memcpy (data + 72, greg, 192); + memset (data + 264, 0, 4); + va_end (ap); + return elfcore_write_note (abfd, buf, bufsiz, + "CORE", note_type, data, sizeof (data)); + } + } +} + /* Return address for Ith PLT stub in section PLT, for relocation REL or (bfd_vma) -1 if it should not be included. */ @@ -1869,7 +1950,8 @@ ppc_elf_fake_sections (bfd *abfd ATTRIBUTE_UNUSED, need to bump up the number of section headers. */ static int -ppc_elf_additional_program_headers (bfd *abfd) +ppc_elf_additional_program_headers (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { asection *s; int ret = 0; @@ -1892,21 +1974,21 @@ ppc_elf_additional_program_headers (bfd *abfd) static const struct bfd_elf_special_section ppc_elf_special_sections[] = { - { ".plt", 4, 0, SHT_NOBITS, SHF_ALLOC + SHF_EXECINSTR }, - { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, - { ".sbss2", 6, -2, SHT_PROGBITS, SHF_ALLOC }, - { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".sdata2", 7, -2, SHT_PROGBITS, SHF_ALLOC }, - { ".tags", 5, 0, SHT_ORDERED, SHF_ALLOC }, - { ".PPC.EMB.apuinfo", 16, 0, SHT_NOTE, 0 }, - { ".PPC.EMB.sbss0", 14, 0, SHT_PROGBITS, SHF_ALLOC }, - { ".PPC.EMB.sdata0", 15, 0, SHT_PROGBITS, SHF_ALLOC }, - { NULL, 0, 0, 0, 0 } + { STRING_COMMA_LEN (".plt"), 0, SHT_NOBITS, SHF_ALLOC + SHF_EXECINSTR }, + { STRING_COMMA_LEN (".sbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { STRING_COMMA_LEN (".sbss2"), -2, SHT_PROGBITS, SHF_ALLOC }, + { STRING_COMMA_LEN (".sdata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { STRING_COMMA_LEN (".sdata2"), -2, SHT_PROGBITS, SHF_ALLOC }, + { STRING_COMMA_LEN (".tags"), 0, SHT_ORDERED, SHF_ALLOC }, + { STRING_COMMA_LEN (".PPC.EMB.apuinfo"), 0, SHT_NOTE, 0 }, + { STRING_COMMA_LEN (".PPC.EMB.sbss0"), 0, SHT_PROGBITS, SHF_ALLOC }, + { STRING_COMMA_LEN (".PPC.EMB.sdata0"), 0, SHT_PROGBITS, SHF_ALLOC }, + { NULL, 0, 0, 0, 0 } }; /* This is what we want for new plt/got. */ static struct bfd_elf_special_section ppc_alt_plt = - { ".plt", 4, 0, SHT_PROGBITS, SHF_ALLOC }; + { STRING_COMMA_LEN (".plt"), 0, SHT_PROGBITS, SHF_ALLOC }; static const struct bfd_elf_special_section * ppc_elf_get_sec_type_attr (bfd *abfd ATTRIBUTE_UNUSED, asection *sec) @@ -2147,6 +2229,7 @@ ppc_elf_begin_write_processing (bfd *abfd, struct bfd_link_info *link_info) static bfd_boolean ppc_elf_write_section (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *link_info ATTRIBUTE_UNUSED, asection *asec, bfd_byte *contents ATTRIBUTE_UNUSED) { @@ -2313,13 +2396,6 @@ struct ppc_elf_link_hash_entry #define ppc_elf_hash_entry(ent) ((struct ppc_elf_link_hash_entry *) (ent)) -enum ppc_elf_plt_type { - PLT_UNSET, - PLT_OLD, - PLT_NEW, - PLT_VXWORKS -}; - /* PPC ELF linker hash table. */ struct ppc_elf_link_hash_table @@ -2339,9 +2415,18 @@ struct ppc_elf_link_hash_table elf_linker_section_t sdata[2]; asection *sbss; + /* The (unloaded but important) .rela.plt.unloaded on VxWorks. */ + asection *srelplt2; + + /* The .got.plt section (VxWorks only)*/ + asection *sgotplt; + /* Shortcut to .__tls_get_addr. */ struct elf_link_hash_entry *tls_get_addr; + /* The bfd that forced an old-style PLT. */ + bfd *old_bfd; + /* TLS local dynamic got entry handling. */ union { bfd_signed_vma refcount; @@ -2359,23 +2444,11 @@ struct ppc_elf_link_hash_table /* The type of PLT we have chosen to use. */ enum ppc_elf_plt_type plt_type; - /* Whether we can use the new PLT layout. */ - unsigned int can_use_new_plt:1; - /* Set if we should emit symbols for stubs. */ unsigned int emit_stub_syms:1; - /* Small local sym to section mapping cache. */ - struct sym_sec_cache sym_sec; - - /* The (unloaded but important) .rela.plt.unloaded on VxWorks. */ - asection *srelplt2; - - /* The .got.plt section (VxWorks only)*/ - asection *sgotplt; - /* True if the target system is VxWorks. */ - int is_vxworks; + unsigned int is_vxworks:1; /* The size of PLT entries. */ int plt_entry_size; @@ -2383,6 +2456,9 @@ struct ppc_elf_link_hash_table int plt_slot_size; /* The size of the first PLT entry. */ int plt_initial_entry_size; + + /* Small local sym to section mapping cache. */ + struct sym_sec_cache sym_sec; }; /* Get the PPC ELF linker hash table from a link_info structure. */ @@ -2454,8 +2530,6 @@ ppc_elf_link_hash_table_create (bfd *abfd) ret->plt_entry_size = 12; ret->plt_slot_size = 8; ret->plt_initial_entry_size = 72; - - ret->is_vxworks = 0; return &ret->elf.root; } @@ -3225,8 +3299,13 @@ ppc_elf_check_relocs (bfd *abfd, } else { - bfd_vma addend = r_type == R_PPC_PLTREL24 ? rel->r_addend : 0; + bfd_vma addend = 0; + if (r_type == R_PPC_PLTREL24) + { + ppc_elf_tdata (abfd)->makes_plt_call = 1; + addend = rel->r_addend; + } h->needs_plt = 1; if (!update_plt_info (abfd, h, got2, addend)) return FALSE; @@ -3251,7 +3330,7 @@ ppc_elf_check_relocs (bfd *abfd, case R_PPC_REL16_LO: case R_PPC_REL16_HI: case R_PPC_REL16_HA: - htab->can_use_new_plt = 1; + ppc_elf_tdata (abfd)->has_rel16 = 1; break; /* These are just markers. */ @@ -3280,7 +3359,10 @@ ppc_elf_check_relocs (bfd *abfd, /* This refers only to functions defined in the shared library. */ case R_PPC_LOCAL24PC: if (h && h == htab->elf.hgot && htab->plt_type == PLT_UNSET) - htab->plt_type = PLT_OLD; + { + htab->plt_type = PLT_OLD; + htab->old_bfd = abfd; + } break; /* This relocation describes the C++ object vtable hierarchy. @@ -3334,7 +3416,10 @@ ppc_elf_check_relocs (bfd *abfd, s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, sec, r_symndx); if (s == got2) - htab->plt_type = PLT_OLD; + { + htab->plt_type = PLT_OLD; + htab->old_bfd = abfd; + } } if (h == NULL || h == htab->elf.hgot) break; @@ -3349,7 +3434,10 @@ ppc_elf_check_relocs (bfd *abfd, if (h == htab->elf.hgot) { if (htab->plt_type == PLT_UNSET) - htab->plt_type = PLT_OLD; + { + htab->plt_type = PLT_OLD; + htab->old_bfd = abfd; + } break; } /* fall through */ @@ -3432,7 +3520,7 @@ ppc_elf_check_relocs (bfd *abfd, if (name == NULL) return FALSE; - BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + BFD_ASSERT (CONST_STRNEQ (name, ".rela") && strcmp (bfd_get_section_name (abfd, sec), name + 5) == 0); @@ -3506,6 +3594,62 @@ ppc_elf_check_relocs (bfd *abfd, return TRUE; } + +/* Merge object attributes from IBFD into OBFD. Raise an error if + there are conflicting attributes. */ +static bfd_boolean +ppc_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd) +{ + obj_attribute *in_attr; + obj_attribute *out_attr; + + if (!elf_known_obj_attributes_proc (obfd)[0].i) + { + /* This is the first object. Copy the attributes. */ + _bfd_elf_copy_obj_attributes (ibfd, obfd); + + /* Use the Tag_null value to indicate the attributes have been + initialized. */ + elf_known_obj_attributes_proc (obfd)[0].i = 1; + + return TRUE; + } + + /* Check for conflicting Tag_GNU_Power_ABI_FP attributes and merge + non-conflicting ones. */ + in_attr = elf_known_obj_attributes (ibfd)[OBJ_ATTR_GNU]; + out_attr = elf_known_obj_attributes (obfd)[OBJ_ATTR_GNU]; + if (in_attr[Tag_GNU_Power_ABI_FP].i != out_attr[Tag_GNU_Power_ABI_FP].i) + { + out_attr[Tag_GNU_Power_ABI_FP].type = 1; + if (out_attr[Tag_GNU_Power_ABI_FP].i == 0) + out_attr[Tag_GNU_Power_ABI_FP].i = in_attr[Tag_GNU_Power_ABI_FP].i; + else if (in_attr[Tag_GNU_Power_ABI_FP].i == 0) + ; + else if (out_attr[Tag_GNU_Power_ABI_FP].i == 1 + && in_attr[Tag_GNU_Power_ABI_FP].i == 2) + _bfd_error_handler + (_("Warning: %B uses hard float, %B uses soft float"), obfd, ibfd); + else if (out_attr[Tag_GNU_Power_ABI_FP].i == 2 + && in_attr[Tag_GNU_Power_ABI_FP].i == 1) + _bfd_error_handler + (_("Warning: %B uses hard float, %B uses soft float"), ibfd, obfd); + else if (in_attr[Tag_GNU_Power_ABI_FP].i > 2) + _bfd_error_handler + (_("Warning: %B uses unknown floating point ABI %d"), ibfd, + in_attr[Tag_GNU_Power_ABI_FP].i); + else + _bfd_error_handler + (_("Warning: %B uses unknown floating point ABI %d"), obfd, + out_attr[Tag_GNU_Power_ABI_FP].i); + } + + /* Merge Tag_compatibility attributes and any common GNU ones. */ + _bfd_elf_merge_object_attributes (ibfd, obfd); + + return TRUE; +} + /* Merge backend specific data from an object file to the output object file when linking. */ @@ -3524,6 +3668,9 @@ ppc_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) if (! _bfd_generic_verify_endian_match (ibfd, obfd)) return FALSE; + if (!ppc_elf_merge_obj_attributes (ibfd, obfd)) + return FALSE; + new_flags = elf_elfheader (ibfd)->e_flags; old_flags = elf_elfheader (obfd)->e_flags; if (!elf_flags_init (obfd)) @@ -3603,7 +3750,7 @@ ppc_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) int ppc_elf_select_plt_layout (bfd *output_bfd ATTRIBUTE_UNUSED, struct bfd_link_info *info, - int force_old_plt, + enum ppc_elf_plt_type plt_style, int emit_stub_syms) { struct ppc_elf_link_hash_table *htab; @@ -3612,8 +3759,37 @@ ppc_elf_select_plt_layout (bfd *output_bfd ATTRIBUTE_UNUSED, htab = ppc_elf_hash_table (info); if (htab->plt_type == PLT_UNSET) - htab->plt_type = (force_old_plt || !htab->can_use_new_plt - ? PLT_OLD : PLT_NEW); + { + if (plt_style == PLT_OLD) + htab->plt_type = PLT_OLD; + else + { + bfd *ibfd; + enum ppc_elf_plt_type plt_type = plt_style; + + /* Look through the reloc flags left by ppc_elf_check_relocs. + Use the old style bss plt if a file makes plt calls + without using the new relocs, and if ld isn't given + --secure-plt and we never see REL16 relocs. */ + if (plt_type == PLT_UNSET) + plt_type = PLT_OLD; + for (ibfd = info->input_bfds; ibfd; ibfd = ibfd->link_next) + if (is_ppc_elf_target (ibfd->xvec)) + { + if (ppc_elf_tdata (ibfd)->has_rel16) + plt_type = PLT_NEW; + else if (ppc_elf_tdata (ibfd)->makes_plt_call) + { + plt_type = PLT_OLD; + htab->old_bfd = ibfd; + break; + } + } + htab->plt_type = plt_type; + } + } + if (htab->plt_type == PLT_OLD && plt_style == PLT_NEW) + info->callbacks->info (_("Using bss-plt due to %B"), htab->old_bfd); htab->emit_stub_syms = emit_stub_syms; @@ -3649,38 +3825,20 @@ ppc_elf_select_plt_layout (bfd *output_bfd ATTRIBUTE_UNUSED, static asection * ppc_elf_gc_mark_hook (asection *sec, - struct bfd_link_info *info ATTRIBUTE_UNUSED, + struct bfd_link_info *info, Elf_Internal_Rela *rel, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { if (h != NULL) - { - switch (ELF32_R_TYPE (rel->r_info)) - { - case R_PPC_GNU_VTINHERIT: - case R_PPC_GNU_VTENTRY: - break; - - default: - switch (h->root.type) - { - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - return h->root.u.def.section; - - case bfd_link_hash_common: - return h->root.u.c.p->section; - - default: - break; - } - } - } - else - return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_PPC_GNU_VTINHERIT: + case R_PPC_GNU_VTENTRY: + return NULL; + } - return NULL; + return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym); } /* Update the got, plt and dynamic reloc reference counts for the @@ -4048,7 +4206,6 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info, { struct ppc_elf_link_hash_table *htab; asection *s; - unsigned int power_of_two; #ifdef DEBUG fprintf (stderr, "ppc_elf_adjust_dynamic_symbol called for %s\n", @@ -4190,28 +4347,7 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info, h->needs_copy = 1; } - /* We need to figure out the alignment required for this symbol. I - have no idea how ELF linkers handle this. */ - power_of_two = bfd_log2 (h->size); - if (power_of_two > 4) - power_of_two = 4; - - /* Apply the required alignment. */ - s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); - if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s)) - { - if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two)) - return FALSE; - } - - /* Define the symbol as being at this point in the section. */ - h->root.u.def.section = s; - h->root.u.def.value = s->size; - - /* Increment the section size to make room for the symbol. */ - s->size += h->size; - - return TRUE; + return _bfd_elf_adjust_dynamic_copy (h, s); } /* Generate a symbol to mark plt call stubs. For non-PIC code the sym is @@ -4450,13 +4586,15 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) } else ent->plt.offset = (bfd_vma) -1; - - if (!doneone) - { - h->plt.plist = NULL; - h->needs_plt = 0; - } } + else + ent->plt.offset = (bfd_vma) -1; + + if (!doneone) + { + h->plt.plist = NULL; + h->needs_plt = 0; + } } else { @@ -4860,7 +4998,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, { /* Strip these too. */ } - else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0) + else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela")) { if (s->size != 0) { @@ -5518,6 +5656,7 @@ ppc_elf_relocate_section (bfd *output_bfd, asection *got2, *sreloc = NULL; bfd_vma *local_got_offsets; bfd_boolean ret = TRUE; + bfd_vma d_offset = (bfd_big_endian (output_bfd) ? 2 : 0); #ifdef DEBUG _bfd_error_handler ("ppc_elf_relocate_section called for %B section %A, " @@ -5529,29 +5668,6 @@ ppc_elf_relocate_section (bfd *output_bfd, got2 = bfd_get_section_by_name (input_bfd, ".got2"); - if (info->relocatable) - { - if (got2 == NULL) - return TRUE; - - rel = relocs; - relend = relocs + input_section->reloc_count; - for (; rel < relend; rel++) - { - enum elf_ppc_reloc_type r_type; - - r_type = ELF32_R_TYPE (rel->r_info); - if (r_type == R_PPC_PLTREL24 - && rel->r_addend >= 32768) - { - /* R_PPC_PLTREL24 is rather special. If non-zero, the - addend specifies the GOT pointer offset within .got2. */ - rel->r_addend += got2->output_offset; - } - } - return TRUE; - } - /* Initialize howto table if not already done. */ if (!ppc_elf_howto_table[R_PPC_ADDR32]) ppc_elf_howto_init (); @@ -5605,6 +5721,33 @@ ppc_elf_relocate_section (bfd *output_bfd, sym_name = h->root.root.string; } + if (sec != NULL && elf_discarded_section (sec)) + { + /* For relocs against symbols from removed linkonce sections, + or sections discarded by a linker script, we just want the + section contents zeroed. Avoid any special processing. */ + howto = NULL; + if (r_type < R_PPC_max) + howto = ppc_elf_howto_table[r_type]; + _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset); + rel->r_info = 0; + rel->r_addend = 0; + continue; + } + + if (info->relocatable) + { + if (got2 != NULL + && r_type == R_PPC_PLTREL24 + && rel->r_addend >= 32768) + { + /* R_PPC_PLTREL24 is rather special. If non-zero, the + addend specifies the GOT pointer offset within .got2. */ + rel->r_addend += got2->output_offset; + } + continue; + } + /* TLS optimizations. Replace instruction sequences and relocs based on information we collected in tls_optimize. We edit RELOCS so that --emit-relocs will output something sensible @@ -5644,10 +5787,10 @@ ppc_elf_relocate_section (bfd *output_bfd, && (tls_mask & TLS_TPREL) == 0) { bfd_vma insn; - insn = bfd_get_32 (output_bfd, contents + rel->r_offset - 2); + insn = bfd_get_32 (output_bfd, contents + rel->r_offset - d_offset); insn &= 31 << 21; insn |= 0x3c020000; /* addis 0,2,0 */ - bfd_put_32 (output_bfd, insn, contents + rel->r_offset - 2); + bfd_put_32 (output_bfd, insn, contents + rel->r_offset - d_offset); r_type = R_PPC_TPREL16_HA; rel->r_info = ELF32_R_INFO (r_symndx, r_type); } @@ -5691,9 +5834,10 @@ ppc_elf_relocate_section (bfd *output_bfd, bfd_put_32 (output_bfd, insn, contents + rel->r_offset); r_type = R_PPC_TPREL16_LO; rel->r_info = ELF32_R_INFO (r_symndx, r_type); + /* Was PPC_TLS which sits on insn boundary, now - PPC_TPREL16_LO which is at insn+2. */ - rel->r_offset += 2; + PPC_TPREL16_LO which is at low-order half-word. */ + rel->r_offset += d_offset; } break; @@ -5715,7 +5859,7 @@ ppc_elf_relocate_section (bfd *output_bfd, else { bfd_put_32 (output_bfd, NOP, contents + rel->r_offset); - rel->r_offset -= 2; + rel->r_offset -= d_offset; r_type = R_PPC_NONE; } rel->r_info = ELF32_R_INFO (r_symndx, r_type); @@ -5764,7 +5908,7 @@ ppc_elf_relocate_section (bfd *output_bfd, /* OK, it checks out. Replace the call. */ offset = rel[1].r_offset; insn1 = bfd_get_32 (output_bfd, - contents + rel->r_offset - 2); + contents + rel->r_offset - d_offset); if ((tls_mask & tls_gd) != 0) { /* IE */ @@ -5792,10 +5936,10 @@ ppc_elf_relocate_section (bfd *output_bfd, rel->r_info = ELF32_R_INFO (r_symndx, r_type); rel[1].r_info = ELF32_R_INFO (r_symndx, R_PPC_TPREL16_LO); - rel[1].r_offset += 2; + rel[1].r_offset += d_offset; rel[1].r_addend = rel->r_addend; } - bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - 2); + bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - d_offset); bfd_put_32 (output_bfd, insn2, contents + offset); if (tls_gd == 0) { @@ -6189,14 +6333,7 @@ ppc_elf_relocate_section (bfd *output_bfd, case R_PPC_ADDR14_BRNTAKEN: case R_PPC_UADDR32: case R_PPC_UADDR16: - /* r_symndx will be zero only for relocs against symbols - from removed linkonce sections, or sections discarded by - a linker script. */ dodyn: - if (r_symndx == 0) - break; - /* Fall thru. */ - if ((input_section->flags & SEC_ALLOC) == 0) break; /* Fall thru. */ @@ -6238,7 +6375,7 @@ ppc_elf_relocate_section (bfd *output_bfd, if (name == NULL) return FALSE; - BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + BFD_ASSERT (CONST_STRNEQ (name, ".rela") && strcmp (bfd_get_section_name (input_bfd, input_section), name + 5) == 0); @@ -6294,10 +6431,15 @@ ppc_elf_relocate_section (bfd *output_bfd, but ld.so expects buggy relocs. */ osec = sec->output_section; indx = elf_section_data (osec)->dynindx; - BFD_ASSERT (indx > 0); + if (indx == 0) + { + osec = htab->elf.text_index_section; + indx = elf_section_data (osec)->dynindx; + } + BFD_ASSERT (indx != 0); #ifdef DEBUG - if (indx <= 0) - printf ("indx=%d section=%s flags=%08x name=%s\n", + if (indx == 0) + printf ("indx=%ld section=%s flags=%08x name=%s\n", indx, osec->name, osec->flags, h->root.root.string); #endif @@ -6441,9 +6583,9 @@ ppc_elf_relocate_section (bfd *output_bfd, BFD_ASSERT (sec != NULL); name = bfd_get_section_name (abfd, sec->output_section); - if (! ((strncmp (name, ".sdata", 6) == 0 + if (! ((CONST_STRNEQ (name, ".sdata") && (name[6] == 0 || name[6] == '.')) - || (strncmp (name, ".sbss", 5) == 0 + || (CONST_STRNEQ (name, ".sbss") && (name[5] == 0 || name[5] == '.')))) { (*_bfd_error_handler) @@ -6469,8 +6611,8 @@ ppc_elf_relocate_section (bfd *output_bfd, BFD_ASSERT (sec != NULL); name = bfd_get_section_name (abfd, sec->output_section); - if (! (strncmp (name, ".sdata2", 7) == 0 - || strncmp (name, ".sbss2", 6) == 0)) + if (! (CONST_STRNEQ (name, ".sdata2") + || CONST_STRNEQ (name, ".sbss2"))) { (*_bfd_error_handler) (_("%B: the target (%s) of a %s relocation is " @@ -6501,9 +6643,9 @@ ppc_elf_relocate_section (bfd *output_bfd, BFD_ASSERT (sec != NULL); name = bfd_get_section_name (abfd, sec->output_section); - if (((strncmp (name, ".sdata", 6) == 0 + if (((CONST_STRNEQ (name, ".sdata") && (name[6] == 0 || name[6] == '.')) - || (strncmp (name, ".sbss", 5) == 0 + || (CONST_STRNEQ (name, ".sbss") && (name[5] == 0 || name[5] == '.')))) { reg = 13; @@ -6513,8 +6655,8 @@ ppc_elf_relocate_section (bfd *output_bfd, + sh->root.u.def.section->output_section->vma); } - else if (strncmp (name, ".sdata2", 7) == 0 - || strncmp (name, ".sbss2", 6) == 0) + else if (CONST_STRNEQ (name, ".sdata2") + || CONST_STRNEQ (name, ".sbss2")) { reg = 2; sh = htab->sdata[1].sym; @@ -6605,25 +6747,28 @@ ppc_elf_relocate_section (bfd *output_bfd, case R_PPC_ADDR16_HA: case R_PPC_REL16_HA: - case R_PPC_GOT16_HA: - case R_PPC_PLT16_HA: case R_PPC_SECTOFF_HA: case R_PPC_TPREL16_HA: case R_PPC_DTPREL16_HA: - case R_PPC_GOT_TLSGD16_HA: - case R_PPC_GOT_TLSLD16_HA: - case R_PPC_GOT_TPREL16_HA: - case R_PPC_GOT_DTPREL16_HA: case R_PPC_EMB_NADDR16_HA: case R_PPC_EMB_RELST_HA: /* It's just possible that this symbol is a weak symbol that's not actually defined anywhere. In that case, 'sec' would be NULL, and we should leave the symbol alone (it will be set to zero elsewhere in the link). */ - if (sec != NULL) - /* Add 0x10000 if sign bit in 0:15 is set. - Bits 0:15 are not used. */ - addend += 0x8000; + if (sec == NULL) + break; + /* Fall thru */ + + case R_PPC_PLT16_HA: + case R_PPC_GOT16_HA: + case R_PPC_GOT_TLSGD16_HA: + case R_PPC_GOT_TLSLD16_HA: + case R_PPC_GOT_TPREL16_HA: + case R_PPC_GOT_DTPREL16_HA: + /* Add 0x10000 if sign bit in 0:15 is set. + Bits 0:15 are not used. */ + addend += 0x8000; break; } @@ -7436,6 +7581,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, #define ELF_MAXPAGESIZE 0x10000 #endif #define ELF_MINPAGESIZE 0x1000 +#define ELF_COMMONPAGESIZE 0x1000 #define elf_info_to_howto ppc_elf_info_to_howto #ifdef EM_CYGNUS_POWERPC @@ -7455,6 +7601,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, #define bfd_elf32_bfd_merge_private_bfd_data ppc_elf_merge_private_bfd_data #define bfd_elf32_bfd_relax_section ppc_elf_relax_section #define bfd_elf32_bfd_reloc_type_lookup ppc_elf_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup ppc_elf_reloc_name_lookup #define bfd_elf32_bfd_set_private_flags ppc_elf_set_private_flags #define bfd_elf32_bfd_link_hash_table_create ppc_elf_link_hash_table_create @@ -7475,6 +7622,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, #define elf_backend_additional_program_headers ppc_elf_additional_program_headers #define elf_backend_grok_prstatus ppc_elf_grok_prstatus #define elf_backend_grok_psinfo ppc_elf_grok_psinfo +#define elf_backend_write_core_note ppc_elf_write_core_note #define elf_backend_reloc_type_class ppc_elf_reloc_type_class #define elf_backend_begin_write_processing ppc_elf_begin_write_processing #define elf_backend_final_write_processing ppc_elf_final_write_processing @@ -7482,6 +7630,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, #define elf_backend_get_sec_type_attr ppc_elf_get_sec_type_attr #define elf_backend_plt_sym_val ppc_elf_plt_sym_val #define elf_backend_action_discarded ppc_elf_action_discarded +#define elf_backend_init_index_section _bfd_elf_init_1_index_section #include "elf32-target.h" diff --git a/contrib/binutils/bfd/elf32-ppc.h b/contrib/binutils/bfd/elf32-ppc.h index 5f8f63a38a59..f5383a7bb587 100644 --- a/contrib/binutils/bfd/elf32-ppc.h +++ b/contrib/binutils/bfd/elf32-ppc.h @@ -1,5 +1,5 @@ /* PowerPC-specific support for 64-bit ELF. - Copyright 2003, 2005 Free Software Foundation, Inc. + Copyright 2003, 2005, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -17,7 +17,15 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -int ppc_elf_select_plt_layout (bfd *, struct bfd_link_info *, int, int); +enum ppc_elf_plt_type { + PLT_UNSET, + PLT_OLD, + PLT_NEW, + PLT_VXWORKS +}; + +int ppc_elf_select_plt_layout (bfd *, struct bfd_link_info *, + enum ppc_elf_plt_type, int); asection *ppc_elf_tls_setup (bfd *, struct bfd_link_info *); bfd_boolean ppc_elf_tls_optimize (bfd *, struct bfd_link_info *); void ppc_elf_set_sdata_syms (bfd *, struct bfd_link_info *); diff --git a/contrib/binutils/bfd/elf32-s390.c b/contrib/binutils/bfd/elf32-s390.c index eb8e1724fc19..9e36a5d57465 100644 --- a/contrib/binutils/bfd/elf32-s390.c +++ b/contrib/binutils/bfd/elf32-s390.c @@ -1,5 +1,5 @@ /* IBM S/390-specific support for 32-bit ELF - Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Contributed by Carl B. Pedersen and Martin Schwidefsky. @@ -20,8 +20,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "bfdlink.h" #include "libbfd.h" #include "elf-bfd.h" @@ -46,12 +46,6 @@ static void elf_s390_copy_indirect_symbol static bfd_boolean elf_s390_check_relocs PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *)); -static asection *elf_s390_gc_mark_hook - PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, - struct elf_link_hash_entry *, Elf_Internal_Sym *)); -static bfd_boolean elf_s390_gc_sweep_hook - PARAMS ((bfd *, struct bfd_link_info *, asection *, - const Elf_Internal_Rela *)); struct elf_s390_link_hash_entry; static void elf_s390_adjust_gotplt PARAMS ((struct elf_s390_link_hash_entry *)); @@ -73,8 +67,6 @@ static enum elf_reloc_type_class elf_s390_reloc_type_class PARAMS ((const Elf_Internal_Rela *)); static bfd_boolean elf_s390_finish_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_boolean elf_s390_mkobject - PARAMS ((bfd *)); static bfd_boolean elf_s390_object_p PARAMS ((bfd *)); static bfd_boolean elf_s390_grok_prstatus @@ -342,6 +334,25 @@ elf_s390_reloc_type_lookup (abfd, code) return 0; } +static reloc_howto_type * +elf_s390_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; i < sizeof (elf_howto_table) / sizeof (elf_howto_table[0]); i++) + if (elf_howto_table[i].name != NULL + && strcasecmp (elf_howto_table[i].name, r_name) == 0) + return &elf_howto_table[i]; + + if (strcasecmp (elf32_s390_vtinherit_howto.name, r_name) == 0) + return &elf32_s390_vtinherit_howto; + if (strcasecmp (elf32_s390_vtentry_howto.name, r_name) == 0) + return &elf32_s390_vtentry_howto; + + return NULL; +} + /* We need to use ELF32_R_TYPE so we have our own copy of this function, and elf32-s390.c has its own copy. */ @@ -678,14 +689,16 @@ struct elf_s390_obj_tdata (elf_s390_tdata (abfd)->local_got_tls_type) static bfd_boolean -elf_s390_mkobject (abfd) - bfd *abfd; +elf_s390_mkobject (bfd *abfd) { - bfd_size_type amt = sizeof (struct elf_s390_obj_tdata); - abfd->tdata.any = bfd_zalloc (abfd, amt); if (abfd->tdata.any == NULL) - return FALSE; - return TRUE; + { + bfd_size_type amt = sizeof (struct elf_s390_obj_tdata); + abfd->tdata.any = bfd_zalloc (abfd, amt); + if (abfd->tdata.any == NULL) + return FALSE; + } + return bfd_elf_mkobject (abfd); } static bfd_boolean @@ -1273,7 +1286,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs) if (name == NULL) return FALSE; - if (strncmp (name, ".rela", 5) != 0 + if (! CONST_STRNEQ (name, ".rela") || strcmp (bfd_get_section_name (abfd, sec), name + 5) != 0) { @@ -1379,50 +1392,30 @@ elf_s390_check_relocs (abfd, info, sec, relocs) relocation. */ static asection * -elf_s390_gc_mark_hook (sec, info, rel, h, sym) - asection *sec; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - Elf_Internal_Rela *rel; - struct elf_link_hash_entry *h; - Elf_Internal_Sym *sym; +elf_s390_gc_mark_hook (asection *sec, + struct bfd_link_info *info, + Elf_Internal_Rela *rel, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) { if (h != NULL) - { - switch (ELF32_R_TYPE (rel->r_info)) - { - case R_390_GNU_VTINHERIT: - case R_390_GNU_VTENTRY: - break; - - default: - switch (h->root.type) - { - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - return h->root.u.def.section; + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_390_GNU_VTINHERIT: + case R_390_GNU_VTENTRY: + return NULL; + } + return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym); - case bfd_link_hash_common: - return h->root.u.c.p->section; - - default: - break; - } - } - } - else - return bfd_section_from_elf_index (sec->owner, sym->st_shndx); - - return NULL; } /* Update the got entry reference counts for the section being removed. */ static bfd_boolean -elf_s390_gc_sweep_hook (abfd, info, sec, relocs) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - const Elf_Internal_Rela *relocs; +elf_s390_gc_sweep_hook (bfd *abfd, + struct bfd_link_info *info, + asection *sec, + const Elf_Internal_Rela *relocs) { Elf_Internal_Shdr *symtab_hdr; struct elf_link_hash_entry **sym_hashes; @@ -1589,7 +1582,6 @@ elf_s390_adjust_dynamic_symbol (info, h) { struct elf_s390_link_hash_table *htab; asection *s; - unsigned int power_of_two; /* If this is a function, put it in the procedure linkage table. We will fill in the contents of the procedure linkage table later @@ -1710,29 +1702,9 @@ elf_s390_adjust_dynamic_symbol (info, h) h->needs_copy = 1; } - /* We need to figure out the alignment required for this symbol. I - have no idea how ELF linkers handle this. */ - power_of_two = bfd_log2 (h->size); - if (power_of_two > 3) - power_of_two = 3; - - /* Apply the required alignment. */ s = htab->sdynbss; - s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); - if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s)) - { - if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two)) - return FALSE; - } - - /* Define the symbol as being at this point in the section. */ - h->root.u.def.section = s; - h->root.u.def.value = s->size; - /* Increment the section size to make room for the symbol. */ - s->size += h->size; - - return TRUE; + return _bfd_elf_adjust_dynamic_copy (h, s); } /* Allocate space in .plt, .got and associated reloc sections for @@ -2126,7 +2098,7 @@ elf_s390_size_dynamic_sections (output_bfd, info) /* Strip this section if we don't need it; see the comment below. */ } - else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0) + else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela")) { if (s->size != 0) relocs = TRUE; @@ -2268,6 +2240,7 @@ invalid_tls_insn (input_bfd, input_section, rel) input_section, (long) rel->r_offset, howto->name); + bfd_set_error (bfd_error_bad_value); } /* Relocate a 390 ELF section. */ @@ -2291,9 +2264,6 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - if (info->relocatable) - return TRUE; - htab = elf_s390_hash_table (info); symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); @@ -2328,7 +2298,6 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, howto = elf_howto_table + r_type; r_symndx = ELF32_R_SYM (rel->r_info); - /* This is a final link. */ h = NULL; sym = NULL; sec = NULL; @@ -2349,6 +2318,20 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, unresolved_reloc, warned); } + if (sec != NULL && elf_discarded_section (sec)) + { + /* For relocs against symbols from removed linkonce sections, + or sections discarded by a linker script, we just want the + section contents zeroed. Avoid any special processing. */ + _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset); + rel->r_info = 0; + rel->r_addend = 0; + continue; + } + + if (info->relocatable) + continue; + switch (r_type) { case R_390_GOTPLT12: @@ -2565,11 +2548,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, case R_390_PC16DBL: case R_390_PC32DBL: case R_390_PC32: - /* r_symndx will be zero only for relocs against symbols - from removed linkonce sections, or sections discarded by - a linker script. */ - if (r_symndx == 0 - || (input_section->flags & SEC_ALLOC) == 0) + if ((input_section->flags & SEC_ALLOC) == 0) break; if ((info->shared @@ -2655,14 +2634,18 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, osec = sec->output_section; sindx = elf_section_data (osec)->dynindx; - BFD_ASSERT (sindx > 0); + if (sindx == 0) + { + osec = htab->elf.text_index_section; + sindx = elf_section_data (osec)->dynindx; + } + BFD_ASSERT (sindx != 0); /* We are turning this relocation into one against a section symbol, so subtract out the output section's address but not the offset of the input section in the output section. */ - outrel.r_addend -= osec->vma; } outrel.r_info = ELF32_R_INFO (sindx, r_type); @@ -2926,7 +2909,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, continue; case R_390_TLS_LDO32: - if (info->shared || (input_section->flags & SEC_CODE) == 0) + if (info->shared) relocation -= dtpoff_base (info); else /* When converting LDO to LE, we must negate. */ @@ -2982,16 +2965,44 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, unsigned int insn; insn = bfd_get_32 (input_bfd, contents + rel->r_offset); - if ((insn & 0xff000fff) != 0x4d000000) + if ((insn & 0xff000fff) != 0x4d000000 && + (insn & 0xffff0000) != 0xc0e50000) invalid_tls_insn (input_bfd, input_section, rel); if (!info->shared && (h == NULL || h->dynindx == -1)) - /* GD->LE transition. - bas %r14,0(%rx,%r13) -> bc 0,0 */ - insn = 0x47000000; + { + if ((insn & 0xff000000) == 0x4d000000) + { + /* GD->LE transition. + bas %r14,0(%rx,%r13) -> bc 0,0 */ + insn = 0x47000000; + } + else + { + /* GD->LE transition. + brasl %r14,_tls_get_addr@plt -> brcl 0,. */ + insn = 0xc0040000; + bfd_put_16 (output_bfd, 0x0000, + contents + rel->r_offset + 4); + } + } else - /* GD->IE transition. - bas %r14,0(%rx,%r13) -> l %r2,0(%r2,%r12) */ - insn = 0x5822c000; + { + if ((insn & 0xff000000) == 0x4d000000) + { + /* GD->IE transition. + bas %r14,0(%rx,%r13) -> l %r2,0(%r2,%r12) */ + insn = 0x5822c000; + } + else + { + /* GD->IE transition. + brasl %r14,__tls_get_addr@plt -> + l %r2,0(%r2,%r12) ; bcr 0,0 */ + insn = 0x5822c000; + bfd_put_16 (output_bfd, 0x0700, + contents + rel->r_offset + 4); + } + } bfd_put_32 (output_bfd, insn, contents + rel->r_offset); } else if (r_type == R_390_TLS_LDCALL) @@ -3001,11 +3012,23 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, unsigned int insn; insn = bfd_get_32 (input_bfd, contents + rel->r_offset); - if ((insn & 0xff000fff) != 0x4d000000) + if ((insn & 0xff000fff) != 0x4d000000 && + (insn & 0xffff0000) != 0xc0e50000) invalid_tls_insn (input_bfd, input_section, rel); - /* LD->LE transition. - bas %r14,0(%rx,%r13) -> bc 0,0 */ - insn = 0x47000000; + if ((insn & 0xff000000) == 0x4d000000) + { + /* LD->LE transition. + bas %r14,0(%rx,%r13) -> bc 0,0 */ + insn = 0x47000000; + } + else + { + /* LD->LE transition. + brasl %r14,__tls_get_addr@plt -> brcl 0,. */ + insn = 0xc0040000; + bfd_put_16 (output_bfd, 0x0000, + contents + rel->r_offset + 4); + } bfd_put_32 (output_bfd, insn, contents + rel->r_offset); } } @@ -3515,6 +3538,7 @@ elf_s390_plt_sym_val (bfd_vma i, const asection *plt, #define bfd_elf32_bfd_is_local_label_name elf_s390_is_local_label_name #define bfd_elf32_bfd_link_hash_table_create elf_s390_link_hash_table_create #define bfd_elf32_bfd_reloc_type_lookup elf_s390_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup elf_s390_reloc_name_lookup #define elf_backend_adjust_dynamic_symbol elf_s390_adjust_dynamic_symbol #define elf_backend_check_relocs elf_s390_check_relocs @@ -3527,6 +3551,7 @@ elf_s390_plt_sym_val (bfd_vma i, const asection *plt, #define elf_backend_reloc_type_class elf_s390_reloc_type_class #define elf_backend_relocate_section elf_s390_relocate_section #define elf_backend_size_dynamic_sections elf_s390_size_dynamic_sections +#define elf_backend_init_index_section _bfd_elf_init_1_index_section #define elf_backend_reloc_type_class elf_s390_reloc_type_class #define elf_backend_grok_prstatus elf_s390_grok_prstatus #define elf_backend_plt_sym_val elf_s390_plt_sym_val diff --git a/contrib/binutils/bfd/elf32-score.c b/contrib/binutils/bfd/elf32-score.c new file mode 100644 index 000000000000..070177b15075 --- /dev/null +++ b/contrib/binutils/bfd/elf32-score.c @@ -0,0 +1,3883 @@ +/* 32-bit ELF support for S+core. + Copyright 2006, 2007 Free Software Foundation, Inc. + Contributed by + Mei Ligang (ligang@sunnorth.com.cn) + Pei-Lin Tsai (pltsai@sunplus.com) + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "sysdep.h" +#include "bfd.h" +#include "libbfd.h" +#include "libiberty.h" +#include "elf-bfd.h" +#include "elf/score.h" +#include "elf/common.h" +#include "elf/internal.h" +#include "hashtab.h" + + +/* Score ELF linker hash table. */ + +struct score_elf_link_hash_table +{ + /* The main hash table. */ + struct elf_link_hash_table root; +}; + +/* The SCORE ELF linker needs additional information for each symbol in + the global hash table. */ + +struct score_elf_link_hash_entry +{ + struct elf_link_hash_entry root; + + /* Number of R_SCORE_ABS32, R_SCORE_REL32 relocs against this symbol. */ + unsigned int possibly_dynamic_relocs; + + /* If the R_SCORE_ABS32, R_SCORE_REL32 reloc is against a readonly section. */ + bfd_boolean readonly_reloc; + + /* We must not create a stub for a symbol that has relocations related to + taking the function's address, i.e. any but R_SCORE_CALL15 ones. */ + bfd_boolean no_fn_stub; + + /* Are we forced local? This will only be set if we have converted + the initial global GOT entry to a local GOT entry. */ + bfd_boolean forced_local; +}; + +/* Traverse a score ELF linker hash table. */ +#define score_elf_link_hash_traverse(table, func, info) \ + (elf_link_hash_traverse \ + (&(table)->root, \ + (bfd_boolean (*) (struct elf_link_hash_entry *, void *)) (func), \ + (info))) + +/* Get the SCORE elf linker hash table from a link_info structure. */ +#define score_elf_hash_table(info) \ + ((struct score_elf_link_hash_table *) ((info)->hash)) + +/* This structure is used to hold .got entries while estimating got sizes. */ +struct score_got_entry +{ + /* The input bfd in which the symbol is defined. */ + bfd *abfd; + /* The index of the symbol, as stored in the relocation r_info, if + we have a local symbol; -1 otherwise. */ + long symndx; + union + { + /* If abfd == NULL, an address that must be stored in the got. */ + bfd_vma address; + /* If abfd != NULL && symndx != -1, the addend of the relocation + that should be added to the symbol value. */ + bfd_vma addend; + /* If abfd != NULL && symndx == -1, the hash table entry + corresponding to a global symbol in the got (or, local, if + h->forced_local). */ + struct score_elf_link_hash_entry *h; + } d; + + /* The offset from the beginning of the .got section to the entry + corresponding to this symbol+addend. If it's a global symbol + whose offset is yet to be decided, it's going to be -1. */ + long gotidx; +}; + +/* This structure is passed to score_elf_sort_hash_table_f when sorting + the dynamic symbols. */ + +struct score_elf_hash_sort_data +{ + /* The symbol in the global GOT with the lowest dynamic symbol table index. */ + struct elf_link_hash_entry *low; + /* The least dynamic symbol table index corresponding to a symbol with a GOT entry. */ + long min_got_dynindx; + /* The greatest dynamic symbol table index corresponding to a symbol + with a GOT entry that is not referenced (e.g., a dynamic symbol + with dynamic relocations pointing to it from non-primary GOTs). */ + long max_unref_got_dynindx; + /* The greatest dynamic symbol table index not corresponding to a + symbol without a GOT entry. */ + long max_non_got_dynindx; +}; + +struct score_got_info +{ + /* The global symbol in the GOT with the lowest index in the dynamic + symbol table. */ + struct elf_link_hash_entry *global_gotsym; + /* The number of global .got entries. */ + unsigned int global_gotno; + /* The number of local .got entries. */ + unsigned int local_gotno; + /* The number of local .got entries we have used. */ + unsigned int assigned_gotno; + /* A hash table holding members of the got. */ + struct htab *got_entries; + /* In multi-got links, a pointer to the next got (err, rather, most + of the time, it points to the previous got). */ + struct score_got_info *next; +}; + +/* A structure used to count GOT entries, for GOT entry or ELF symbol table traversal. */ +struct _score_elf_section_data +{ + struct bfd_elf_section_data elf; + union + { + struct score_got_info *got_info; + bfd_byte *tdata; + } + u; +}; + +#define score_elf_section_data(sec) \ + ((struct _score_elf_section_data *) elf_section_data (sec)) + +/* The size of a symbol-table entry. */ +#define SCORE_ELF_SYM_SIZE(abfd) \ + (get_elf_backend_data (abfd)->s->sizeof_sym) + +/* In case we're on a 32-bit machine, construct a 64-bit "-1" value + from smaller values. Start with zero, widen, *then* decrement. */ +#define MINUS_ONE (((bfd_vma)0) - 1) +#define MINUS_TWO (((bfd_vma)0) - 2) + +#define PDR_SIZE 32 + + +/* The number of local .got entries we reserve. */ +#define SCORE_RESERVED_GOTNO (2) +#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" + +/* The offset of $gp from the beginning of the .got section. */ +#define ELF_SCORE_GP_OFFSET(abfd) (0x3ff0) +/* The maximum size of the GOT for it to be addressable using 15-bit offsets from $gp. */ +#define SCORE_ELF_GOT_MAX_SIZE(abfd) (ELF_SCORE_GP_OFFSET(abfd) + 0x3fff) + +#define SCORE_ELF_STUB_SECTION_NAME (".SCORE.stub") +#define SCORE_FUNCTION_STUB_SIZE (16) + +#define STUB_LW 0xc3bcc010 /* lw r29, [r28, -0x3ff0] */ +#define STUB_MOVE 0x8363bc56 /* mv r27, r3 */ +#define STUB_LI16 0x87548000 /* ori r26, .dynsym_index */ +#define STUB_BRL 0x801dbc09 /* brl r29 */ + +#define SCORE_ELF_GOT_SIZE(abfd) \ + (get_elf_backend_data (abfd)->s->arch_size / 8) + +#define SCORE_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \ + (_bfd_elf_add_dynamic_entry (info, (bfd_vma) tag, (bfd_vma) val)) + +/* The size of an external dynamic table entry. */ +#define SCORE_ELF_DYN_SIZE(abfd) \ + (get_elf_backend_data (abfd)->s->sizeof_dyn) + +/* The size of an external REL relocation. */ +#define SCORE_ELF_REL_SIZE(abfd) \ + (get_elf_backend_data (abfd)->s->sizeof_rel) + +/* The default alignment for sections, as a power of two. */ +#define SCORE_ELF_LOG_FILE_ALIGN(abfd)\ + (get_elf_backend_data (abfd)->s->log_file_align) + +#ifndef NUM_ELEM +#define NUM_ELEM(a) (sizeof (a) / (sizeof (a)[0])) +#endif + +static bfd_byte *hi16_rel_addr; + +/* This will be used when we sort the dynamic relocation records. */ +static bfd *reldyn_sorting_bfd; + +/* SCORE ELF uses two common sections. One is the usual one, and the + other is for small objects. All the small objects are kept + together, and then referenced via the gp pointer, which yields + faster assembler code. This is what we use for the small common + section. This approach is copied from ecoff.c. */ +static asection score_elf_scom_section; +static asymbol score_elf_scom_symbol; +static asymbol *score_elf_scom_symbol_ptr; + +static bfd_reloc_status_type +score_elf_hi16_reloc (bfd *abfd ATTRIBUTE_UNUSED, + arelent *reloc_entry, + asymbol *symbol ATTRIBUTE_UNUSED, + void * data, + asection *input_section ATTRIBUTE_UNUSED, + bfd *output_bfd ATTRIBUTE_UNUSED, + char **error_message ATTRIBUTE_UNUSED) +{ + hi16_rel_addr = (bfd_byte *) data + reloc_entry->address; + return bfd_reloc_ok; +} + +static bfd_reloc_status_type +score_elf_lo16_reloc (bfd *abfd, + arelent *reloc_entry, + asymbol *symbol ATTRIBUTE_UNUSED, + void * data, + asection *input_section, + bfd *output_bfd ATTRIBUTE_UNUSED, + char **error_message ATTRIBUTE_UNUSED) +{ + bfd_vma addend = 0, offset = 0; + unsigned long val; + unsigned long hi16_offset, hi16_value, uvalue; + + hi16_value = bfd_get_32 (abfd, hi16_rel_addr); + hi16_offset = ((((hi16_value >> 16) & 0x3) << 15) | (hi16_value & 0x7fff)) >> 1; + addend = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); + offset = ((((addend >> 16) & 0x3) << 15) | (addend & 0x7fff)) >> 1; + val = reloc_entry->addend; + if (reloc_entry->address > input_section->size) + return bfd_reloc_outofrange; + uvalue = ((hi16_offset << 16) | (offset & 0xffff)) + val; + hi16_offset = (uvalue >> 16) << 1; + hi16_value = (hi16_value & ~0x37fff) | (hi16_offset & 0x7fff) | ((hi16_offset << 1) & 0x30000); + bfd_put_32 (abfd, hi16_value, hi16_rel_addr); + offset = (uvalue & 0xffff) << 1; + addend = (addend & ~0x37fff) | (offset & 0x7fff) | ((offset << 1) & 0x30000); + bfd_put_32 (abfd, addend, (bfd_byte *) data + reloc_entry->address); + return bfd_reloc_ok; +} + +/* Set the GP value for OUTPUT_BFD. Returns FALSE if this is a + dangerous relocation. */ + +static bfd_boolean +score_elf_assign_gp (bfd *output_bfd, bfd_vma *pgp) +{ + unsigned int count; + asymbol **sym; + unsigned int i; + + /* If we've already figured out what GP will be, just return it. */ + *pgp = _bfd_get_gp_value (output_bfd); + if (*pgp) + return TRUE; + + count = bfd_get_symcount (output_bfd); + sym = bfd_get_outsymbols (output_bfd); + + /* The linker script will have created a symbol named `_gp' with the + appropriate value. */ + if (sym == NULL) + i = count; + else + { + for (i = 0; i < count; i++, sym++) + { + const char *name; + + name = bfd_asymbol_name (*sym); + if (*name == '_' && strcmp (name, "_gp") == 0) + { + *pgp = bfd_asymbol_value (*sym); + _bfd_set_gp_value (output_bfd, *pgp); + break; + } + } + } + + if (i >= count) + { + /* Only get the error once. */ + *pgp = 4; + _bfd_set_gp_value (output_bfd, *pgp); + return FALSE; + } + + return TRUE; +} + +/* We have to figure out the gp value, so that we can adjust the + symbol value correctly. We look up the symbol _gp in the output + BFD. If we can't find it, we're stuck. We cache it in the ELF + target data. We don't need to adjust the symbol value for an + external symbol if we are producing relocatable output. */ + +static bfd_reloc_status_type +score_elf_final_gp (bfd *output_bfd, + asymbol *symbol, + bfd_boolean relocatable, + char **error_message, + bfd_vma *pgp) +{ + if (bfd_is_und_section (symbol->section) + && ! relocatable) + { + *pgp = 0; + return bfd_reloc_undefined; + } + + *pgp = _bfd_get_gp_value (output_bfd); + if (*pgp == 0 + && (! relocatable + || (symbol->flags & BSF_SECTION_SYM) != 0)) + { + if (relocatable) + { + /* Make up a value. */ + *pgp = symbol->section->output_section->vma + 0x4000; + _bfd_set_gp_value (output_bfd, *pgp); + } + else if (!score_elf_assign_gp (output_bfd, pgp)) + { + *error_message = + (char *) _("GP relative relocation when _gp not defined"); + return bfd_reloc_dangerous; + } + } + + return bfd_reloc_ok; +} + +static bfd_reloc_status_type +score_elf_gprel15_with_gp (bfd *abfd, + asymbol *symbol, + arelent *reloc_entry, + asection *input_section, + bfd_boolean relocateable, + void * data, + bfd_vma gp ATTRIBUTE_UNUSED) +{ + bfd_vma relocation; + unsigned long insn; + + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value; + + relocation += symbol->section->output_section->vma; + relocation += symbol->section->output_offset; + if (reloc_entry->address > input_section->size) + return bfd_reloc_outofrange; + + insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); + if (((reloc_entry->addend & 0xffffc000) != 0) + && ((reloc_entry->addend & 0xffffc000) != 0xffffc000)) + return bfd_reloc_overflow; + + insn = (insn & ~0x7fff) | (reloc_entry->addend & 0x7fff); + bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); + if (relocateable) + reloc_entry->address += input_section->output_offset; + + return bfd_reloc_ok; +} + +static bfd_reloc_status_type +gprel32_with_gp (bfd *abfd, asymbol *symbol, arelent *reloc_entry, + asection *input_section, bfd_boolean relocatable, + void *data, bfd_vma gp) +{ + bfd_vma relocation; + bfd_vma val; + + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value; + + relocation += symbol->section->output_section->vma; + relocation += symbol->section->output_offset; + + if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)) + return bfd_reloc_outofrange; + + /* Set val to the offset into the section or symbol. */ + val = reloc_entry->addend; + + if (reloc_entry->howto->partial_inplace) + val += bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); + + /* Adjust val for the final section location and GP value. If we + are producing relocatable output, we don't want to do this for + an external symbol. */ + if (! relocatable + || (symbol->flags & BSF_SECTION_SYM) != 0) + val += relocation - gp; + + if (reloc_entry->howto->partial_inplace) + bfd_put_32 (abfd, val, (bfd_byte *) data + reloc_entry->address); + else + reloc_entry->addend = val; + + if (relocatable) + reloc_entry->address += input_section->output_offset; + + return bfd_reloc_ok; +} + +static bfd_reloc_status_type +score_elf_gprel15_reloc (bfd *abfd, + arelent *reloc_entry, + asymbol *symbol, + void * data, + asection *input_section, + bfd *output_bfd, + char **error_message) +{ + bfd_boolean relocateable; + bfd_reloc_status_type ret; + bfd_vma gp; + + if (output_bfd != (bfd *) NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 && reloc_entry->addend == 0) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + if (output_bfd != (bfd *) NULL) + relocateable = TRUE; + else + { + relocateable = FALSE; + output_bfd = symbol->section->output_section->owner; + } + + ret = score_elf_final_gp (output_bfd, symbol, relocateable, error_message, &gp); + if (ret != bfd_reloc_ok) + return ret; + + return score_elf_gprel15_with_gp (abfd, symbol, reloc_entry, + input_section, relocateable, data, gp); +} + +/* Do a R_SCORE_GPREL32 relocation. This is a 32 bit value which must + become the offset from the gp register. */ + +static bfd_reloc_status_type +score_elf_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) +{ + bfd_boolean relocatable; + bfd_reloc_status_type ret; + bfd_vma gp; + + /* R_SCORE_GPREL32 relocations are defined for local symbols only. */ + if (output_bfd != NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && (symbol->flags & BSF_LOCAL) != 0) + { + *error_message = (char *) + _("32bits gp relative relocation occurs for an external symbol"); + return bfd_reloc_outofrange; + } + + if (output_bfd != NULL) + relocatable = TRUE; + else + { + relocatable = FALSE; + output_bfd = symbol->section->output_section->owner; + } + + ret = score_elf_final_gp (output_bfd, symbol, relocatable, error_message, &gp); + if (ret != bfd_reloc_ok) + return ret; + + gp = 0; /* FIXME. */ + return gprel32_with_gp (abfd, symbol, reloc_entry, input_section, + relocatable, data, gp); +} + +/* A howto special_function for R_SCORE_GOT15 relocations. This is just + like any other 16-bit relocation when applied to global symbols, but is + treated in the same as R_SCORE_HI16 when applied to local symbols. */ + +static bfd_reloc_status_type +score_elf_got15_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, + bfd *output_bfd, char **error_message) +{ + if ((symbol->flags & (BSF_GLOBAL | BSF_WEAK)) != 0 + || bfd_is_und_section (bfd_get_section (symbol)) + || bfd_is_com_section (bfd_get_section (symbol))) + /* The relocation is against a global symbol. */ + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, + error_message); + + return score_elf_hi16_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); +} + +static bfd_reloc_status_type +score_elf_got_lo16_reloc (bfd *abfd, + arelent *reloc_entry, + asymbol *symbol ATTRIBUTE_UNUSED, + void * data, + asection *input_section, + bfd *output_bfd ATTRIBUTE_UNUSED, + char **error_message ATTRIBUTE_UNUSED) +{ + bfd_vma addend = 0, offset = 0; + signed long val; + signed long hi16_offset, hi16_value, uvalue; + + hi16_value = bfd_get_32 (abfd, hi16_rel_addr); + hi16_offset = ((((hi16_value >> 16) & 0x3) << 15) | (hi16_value & 0x7fff)) >> 1; + addend = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); + offset = ((((addend >> 16) & 0x3) << 15) | (addend & 0x7fff)) >> 1; + val = reloc_entry->addend; + if (reloc_entry->address > input_section->size) + return bfd_reloc_outofrange; + uvalue = ((hi16_offset << 16) | (offset & 0xffff)) + val; + if ((uvalue > -0x8000) && (uvalue < 0x7fff)) + hi16_offset = 0; + else + hi16_offset = (uvalue >> 16) & 0x7fff; + hi16_value = (hi16_value & ~0x37fff) | (hi16_offset & 0x7fff) | ((hi16_offset << 1) & 0x30000); + bfd_put_32 (abfd, hi16_value, hi16_rel_addr); + offset = (uvalue & 0xffff) << 1; + addend = (addend & ~0x37fff) | (offset & 0x7fff) | ((offset << 1) & 0x30000); + bfd_put_32 (abfd, addend, (bfd_byte *) data + reloc_entry->address); + return bfd_reloc_ok; +} + +static reloc_howto_type elf32_score_howto_table[] = +{ + /* No relocation. */ + HOWTO (R_SCORE_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 */ + bfd_elf_generic_reloc, /* special_function */ + "R_SCORE_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* R_SCORE_HI16 */ + HOWTO (R_SCORE_HI16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 1, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + score_elf_hi16_reloc, /* special_function */ + "R_SCORE_HI16", /* name */ + TRUE, /* partial_inplace */ + 0x37fff, /* src_mask */ + 0x37fff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* R_SCORE_LO16 */ + HOWTO (R_SCORE_LO16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 1, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + score_elf_lo16_reloc, /* special_function */ + "R_SCORE_LO16", /* name */ + TRUE, /* partial_inplace */ + 0x37fff, /* src_mask */ + 0x37fff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* R_SCORE_DUMMY1 */ + HOWTO (R_SCORE_DUMMY1, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 1, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SCORE_DUMMY1", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /*R_SCORE_24 */ + HOWTO (R_SCORE_24, /* type */ + 1, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + FALSE, /* pc_relative */ + 1, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SCORE_24", /* name */ + FALSE, /* partial_inplace */ + 0x3ff7fff, /* src_mask */ + 0x3ff7fff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /*R_SCORE_PC19 */ + HOWTO (R_SCORE_PC19, /* type */ + 1, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 19, /* bitsize */ + TRUE, /* pc_relative */ + 1, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SCORE_PC19", /* name */ + FALSE, /* partial_inplace */ + 0x3ff03fe, /* src_mask */ + 0x3ff03fe, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /*R_SCORE16_11 */ + HOWTO (R_SCORE16_11, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 11, /* bitsize */ + FALSE, /* pc_relative */ + 1, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SCORE16_11", /* name */ + FALSE, /* partial_inplace */ + 0x000000ffe, /* src_mask */ + 0x000000ffe, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* R_SCORE16_PC8 */ + HOWTO (R_SCORE16_PC8, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SCORE16_PC8", /* name */ + FALSE, /* partial_inplace */ + 0x000000ff, /* src_mask */ + 0x000000ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 32 bit absolute */ + HOWTO (R_SCORE_ABS32, /* type 8 */ + 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, /* special_function */ + "R_SCORE_ABS32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 16 bit absolute */ + HOWTO (R_SCORE_ABS16, /* type 11 */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SCORE_ABS16", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* R_SCORE_DUMMY2 */ + HOWTO (R_SCORE_DUMMY2, /* type */ + 0, /* rightshift */ + 2, /* 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_SCORE_DUMMY2", /* name */ + TRUE, /* partial_inplace */ + 0x00007fff, /* src_mask */ + 0x00007fff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* R_SCORE_GP15 */ + HOWTO (R_SCORE_GP15, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + score_elf_gprel15_reloc,/* special_function */ + "R_SCORE_GP15", /* name */ + TRUE, /* partial_inplace */ + 0x00007fff, /* src_mask */ + 0x00007fff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable hierarchy. */ + HOWTO (R_SCORE_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_SCORE_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_SCORE_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_SCORE_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Reference to global offset table. */ + HOWTO (R_SCORE_GOT15, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + score_elf_got15_reloc, /* special_function */ + "R_SCORE_GOT15", /* name */ + TRUE, /* partial_inplace */ + 0x00007fff, /* src_mask */ + 0x00007fff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Low 16 bits of displacement in global offset table. */ + HOWTO (R_SCORE_GOT_LO16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 1, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + score_elf_got_lo16_reloc, /* special_function */ + "R_SCORE_GOT_LO16", /* name */ + TRUE, /* partial_inplace */ + 0x37ffe, /* src_mask */ + 0x37ffe, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 15 bit call through global offset table. */ + HOWTO (R_SCORE_CALL15, /* type */ + 0, /* rightshift */ + 2, /* 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_SCORE_CALL15", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 32 bit GP relative reference. */ + HOWTO (R_SCORE_GPREL32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + score_elf_gprel32_reloc, /* special_function */ + "R_SCORE_GPREL32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 32 bit symbol relative relocation. */ + HOWTO (R_SCORE_REL32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SCORE_REL32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* R_SCORE_DUMMY_HI16 */ + HOWTO (R_SCORE_DUMMY_HI16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 1, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + score_elf_hi16_reloc, /* special_function */ + "R_SCORE_DUMMY_HI16", /* name */ + TRUE, /* partial_inplace */ + 0x37fff, /* src_mask */ + 0x37fff, /* dst_mask */ + FALSE), /* pcrel_offset */ +}; + +struct score_reloc_map +{ + bfd_reloc_code_real_type bfd_reloc_val; + unsigned char elf_reloc_val; +}; + +static const struct score_reloc_map elf32_score_reloc_map[] = +{ + {BFD_RELOC_NONE, R_SCORE_NONE}, + {BFD_RELOC_HI16_S, R_SCORE_HI16}, + {BFD_RELOC_LO16, R_SCORE_LO16}, + {BFD_RELOC_SCORE_DUMMY1, R_SCORE_DUMMY1}, + {BFD_RELOC_SCORE_JMP, R_SCORE_24}, + {BFD_RELOC_SCORE_BRANCH, R_SCORE_PC19}, + {BFD_RELOC_SCORE16_JMP, R_SCORE16_11}, + {BFD_RELOC_SCORE16_BRANCH, R_SCORE16_PC8}, + {BFD_RELOC_32, R_SCORE_ABS32}, + {BFD_RELOC_16, R_SCORE_ABS16}, + {BFD_RELOC_SCORE_DUMMY2, R_SCORE_DUMMY2}, + {BFD_RELOC_SCORE_GPREL15, R_SCORE_GP15}, + {BFD_RELOC_VTABLE_INHERIT, R_SCORE_GNU_VTINHERIT}, + {BFD_RELOC_VTABLE_ENTRY, R_SCORE_GNU_VTENTRY}, + {BFD_RELOC_SCORE_GOT15, R_SCORE_GOT15}, + {BFD_RELOC_SCORE_GOT_LO16, R_SCORE_GOT_LO16}, + {BFD_RELOC_SCORE_CALL15, R_SCORE_CALL15}, + {BFD_RELOC_GPREL32, R_SCORE_GPREL32}, + {BFD_RELOC_32_PCREL, R_SCORE_REL32}, + {BFD_RELOC_SCORE_DUMMY_HI16, R_SCORE_DUMMY_HI16}, +}; + +/* got_entries only match if they're identical, except for gotidx, so + use all fields to compute the hash, and compare the appropriate + union members. */ + +static hashval_t +score_elf_got_entry_hash (const void *entry_) +{ + const struct score_got_entry *entry = (struct score_got_entry *)entry_; + + return entry->symndx + + (!entry->abfd ? entry->d.address : entry->abfd->id); +} + +static int +score_elf_got_entry_eq (const void *entry1, const void *entry2) +{ + const struct score_got_entry *e1 = (struct score_got_entry *)entry1; + const struct score_got_entry *e2 = (struct score_got_entry *)entry2; + + return e1->abfd == e2->abfd && e1->symndx == e2->symndx + && (! e1->abfd ? e1->d.address == e2->d.address + : e1->symndx >= 0 ? e1->d.addend == e2->d.addend + : e1->d.h == e2->d.h); +} + +/* If H needs a GOT entry, assign it the highest available dynamic + index. Otherwise, assign it the lowest available dynamic + index. */ + +static bfd_boolean +score_elf_sort_hash_table_f (struct score_elf_link_hash_entry *h, void *data) +{ + struct score_elf_hash_sort_data *hsd = data; + + if (h->root.root.type == bfd_link_hash_warning) + h = (struct score_elf_link_hash_entry *) h->root.root.u.i.link; + + /* Symbols without dynamic symbol table entries aren't interesting at all. */ + if (h->root.dynindx == -1) + return TRUE; + + /* Global symbols that need GOT entries that are not explicitly + referenced are marked with got offset 2. Those that are + referenced get a 1, and those that don't need GOT entries get + -1. */ + if (h->root.got.offset == 2) + { + if (hsd->max_unref_got_dynindx == hsd->min_got_dynindx) + hsd->low = (struct elf_link_hash_entry *) h; + h->root.dynindx = hsd->max_unref_got_dynindx++; + } + else if (h->root.got.offset != 1) + h->root.dynindx = hsd->max_non_got_dynindx++; + else + { + h->root.dynindx = --hsd->min_got_dynindx; + hsd->low = (struct elf_link_hash_entry *) h; + } + + return TRUE; +} + +static asection * +score_elf_got_section (bfd *abfd, bfd_boolean maybe_excluded) +{ + asection *sgot = bfd_get_section_by_name (abfd, ".got"); + + if (sgot == NULL || (! maybe_excluded && (sgot->flags & SEC_EXCLUDE) != 0)) + return NULL; + return sgot; +} + +/* Returns the GOT information associated with the link indicated by + INFO. If SGOTP is non-NULL, it is filled in with the GOT section. */ + +static struct score_got_info * +score_elf_got_info (bfd *abfd, asection **sgotp) +{ + asection *sgot; + struct score_got_info *g; + + sgot = score_elf_got_section (abfd, TRUE); + BFD_ASSERT (sgot != NULL); + BFD_ASSERT (elf_section_data (sgot) != NULL); + g = score_elf_section_data (sgot)->u.got_info; + BFD_ASSERT (g != NULL); + + if (sgotp) + *sgotp = sgot; + return g; +} + +/* Sort the dynamic symbol table so that symbols that need GOT entries + appear towards the end. This reduces the amount of GOT space + required. MAX_LOCAL is used to set the number of local symbols + known to be in the dynamic symbol table. During + _bfd_score_elf_size_dynamic_sections, this value is 1. Afterward, the + section symbols are added and the count is higher. */ + +static bfd_boolean +score_elf_sort_hash_table (struct bfd_link_info *info, + unsigned long max_local) +{ + struct score_elf_hash_sort_data hsd; + struct score_got_info *g; + bfd *dynobj; + + dynobj = elf_hash_table (info)->dynobj; + + g = score_elf_got_info (dynobj, NULL); + + hsd.low = NULL; + hsd.max_unref_got_dynindx = + hsd.min_got_dynindx = elf_hash_table (info)->dynsymcount + /* In the multi-got case, assigned_gotno of the master got_info + indicate the number of entries that aren't referenced in the + primary GOT, but that must have entries because there are + dynamic relocations that reference it. Since they aren't + referenced, we move them to the end of the GOT, so that they + don't prevent other entries that are referenced from getting + too large offsets. */ + - (g->next ? g->assigned_gotno : 0); + hsd.max_non_got_dynindx = max_local; + score_elf_link_hash_traverse (((struct score_elf_link_hash_table *) + elf_hash_table (info)), + score_elf_sort_hash_table_f, + &hsd); + + /* There should have been enough room in the symbol table to + accommodate both the GOT and non-GOT symbols. */ + BFD_ASSERT (hsd.max_non_got_dynindx <= hsd.min_got_dynindx); + BFD_ASSERT ((unsigned long)hsd.max_unref_got_dynindx + <= elf_hash_table (info)->dynsymcount); + + /* Now we know which dynamic symbol has the lowest dynamic symbol + table index in the GOT. */ + g->global_gotsym = hsd.low; + + return TRUE; +} + +/* Create an entry in an score ELF linker hash table. */ + +static struct bfd_hash_entry * +score_elf_link_hash_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, + const char *string) +{ + struct score_elf_link_hash_entry *ret = (struct score_elf_link_hash_entry *)entry; + + /* Allocate the structure if it has not already been allocated by a subclass. */ + if (ret == NULL) + ret = bfd_hash_allocate (table, sizeof (struct score_elf_link_hash_entry)); + if (ret == NULL) + return (struct bfd_hash_entry *)ret; + + /* Call the allocation method of the superclass. */ + ret = ((struct score_elf_link_hash_entry *) + _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *)ret, table, string)); + + if (ret != NULL) + { + ret->possibly_dynamic_relocs = 0; + ret->readonly_reloc = FALSE; + ret->no_fn_stub = FALSE; + ret->forced_local = FALSE; + } + + return (struct bfd_hash_entry *)ret; +} + +/* Returns the first relocation of type r_type found, beginning with + RELOCATION. RELEND is one-past-the-end of the relocation table. */ + +static const Elf_Internal_Rela * +score_elf_next_relocation (bfd *abfd ATTRIBUTE_UNUSED, unsigned int r_type, + const Elf_Internal_Rela *relocation, + const Elf_Internal_Rela *relend) +{ + while (relocation < relend) + { + if (ELF32_R_TYPE (relocation->r_info) == r_type) + return relocation; + + ++relocation; + } + + /* We didn't find it. */ + bfd_set_error (bfd_error_bad_value); + return NULL; +} + +/* This function is called via qsort() to sort the dynamic relocation + entries by increasing r_symndx value. */ + +static int +score_elf_sort_dynamic_relocs (const void *arg1, const void *arg2) +{ + Elf_Internal_Rela int_reloc1; + Elf_Internal_Rela int_reloc2; + + bfd_elf32_swap_reloc_in (reldyn_sorting_bfd, arg1, &int_reloc1); + bfd_elf32_swap_reloc_in (reldyn_sorting_bfd, arg2, &int_reloc2); + + return (ELF32_R_SYM (int_reloc1.r_info) - ELF32_R_SYM (int_reloc2.r_info)); +} + +/* Return whether a relocation is against a local symbol. */ + +static bfd_boolean +score_elf_local_relocation_p (bfd *input_bfd, + const Elf_Internal_Rela *relocation, + asection **local_sections, + bfd_boolean check_forced) +{ + unsigned long r_symndx; + Elf_Internal_Shdr *symtab_hdr; + struct score_elf_link_hash_entry *h; + size_t extsymoff; + + r_symndx = ELF32_R_SYM (relocation->r_info); + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + extsymoff = (elf_bad_symtab (input_bfd)) ? 0 : symtab_hdr->sh_info; + + if (r_symndx < extsymoff) + return TRUE; + if (elf_bad_symtab (input_bfd) && local_sections[r_symndx] != NULL) + return TRUE; + + if (check_forced) + { + /* Look up the hash table to check whether the symbol was forced local. */ + h = (struct score_elf_link_hash_entry *) + elf_sym_hashes (input_bfd) [r_symndx - extsymoff]; + /* Find the real hash-table entry for this symbol. */ + while (h->root.root.type == bfd_link_hash_indirect + || h->root.root.type == bfd_link_hash_warning) + h = (struct score_elf_link_hash_entry *) h->root.root.u.i.link; + if (h->root.forced_local) + return TRUE; + } + + return FALSE; +} + +/* Returns the dynamic relocation section for DYNOBJ. */ + +static asection * +score_elf_rel_dyn_section (bfd *dynobj, bfd_boolean create_p) +{ + static const char dname[] = ".rel.dyn"; + asection *sreloc; + + sreloc = bfd_get_section_by_name (dynobj, dname); + if (sreloc == NULL && create_p) + { + sreloc = bfd_make_section_with_flags (dynobj, dname, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)); + if (sreloc == NULL + || ! bfd_set_section_alignment (dynobj, sreloc, + SCORE_ELF_LOG_FILE_ALIGN (dynobj))) + return NULL; + } + return sreloc; +} + +static void +score_elf_allocate_dynamic_relocations (bfd *abfd, unsigned int n) +{ + asection *s; + + s = score_elf_rel_dyn_section (abfd, FALSE); + BFD_ASSERT (s != NULL); + + if (s->size == 0) + { + /* Make room for a null element. */ + s->size += SCORE_ELF_REL_SIZE (abfd); + ++s->reloc_count; + } + s->size += n * SCORE_ELF_REL_SIZE (abfd); +} + +/* Create a rel.dyn relocation for the dynamic linker to resolve. REL + is the original relocation, which is now being transformed into a + dynamic relocation. The ADDENDP is adjusted if necessary; the + caller should store the result in place of the original addend. */ + +static bfd_boolean +score_elf_create_dynamic_relocation (bfd *output_bfd, + struct bfd_link_info *info, + const Elf_Internal_Rela *rel, + struct score_elf_link_hash_entry *h, + bfd_vma symbol, + bfd_vma *addendp, asection *input_section) +{ + Elf_Internal_Rela outrel[3]; + asection *sreloc; + bfd *dynobj; + int r_type; + long indx; + bfd_boolean defined_p; + + r_type = ELF32_R_TYPE (rel->r_info); + dynobj = elf_hash_table (info)->dynobj; + sreloc = score_elf_rel_dyn_section (dynobj, FALSE); + BFD_ASSERT (sreloc != NULL); + BFD_ASSERT (sreloc->contents != NULL); + BFD_ASSERT (sreloc->reloc_count * SCORE_ELF_REL_SIZE (output_bfd) < sreloc->size); + + outrel[0].r_offset = + _bfd_elf_section_offset (output_bfd, info, input_section, rel[0].r_offset); + outrel[1].r_offset = + _bfd_elf_section_offset (output_bfd, info, input_section, rel[1].r_offset); + outrel[2].r_offset = + _bfd_elf_section_offset (output_bfd, info, input_section, rel[2].r_offset); + + if (outrel[0].r_offset == MINUS_ONE) + /* The relocation field has been deleted. */ + return TRUE; + + if (outrel[0].r_offset == MINUS_TWO) + { + /* The relocation field has been converted into a relative value of + some sort. Functions like _bfd_elf_write_section_eh_frame expect + the field to be fully relocated, so add in the symbol's value. */ + *addendp += symbol; + return TRUE; + } + + /* We must now calculate the dynamic symbol table index to use + in the relocation. */ + if (h != NULL + && (! info->symbolic || !h->root.def_regular) + /* h->root.dynindx may be -1 if this symbol was marked to + become local. */ + && h->root.dynindx != -1) + { + indx = h->root.dynindx; + /* ??? glibc's ld.so just adds the final GOT entry to the + relocation field. It therefore treats relocs against + defined symbols in the same way as relocs against + undefined symbols. */ + defined_p = FALSE; + } + else + { + indx = 0; + defined_p = TRUE; + } + + /* If the relocation was previously an absolute relocation and + this symbol will not be referred to by the relocation, we must + adjust it by the value we give it in the dynamic symbol table. + Otherwise leave the job up to the dynamic linker. */ + if (defined_p && r_type != R_SCORE_REL32) + *addendp += symbol; + + /* The relocation is always an REL32 relocation because we don't + know where the shared library will wind up at load-time. */ + outrel[0].r_info = ELF32_R_INFO ((unsigned long) indx, R_SCORE_REL32); + + /* For strict adherence to the ABI specification, we should + generate a R_SCORE_64 relocation record by itself before the + _REL32/_64 record as well, such that the addend is read in as + a 64-bit value (REL32 is a 32-bit relocation, after all). + However, since none of the existing ELF64 SCORE dynamic + loaders seems to care, we don't waste space with these + artificial relocations. If this turns out to not be true, + score_elf_allocate_dynamic_relocations() should be tweaked so + as to make room for a pair of dynamic relocations per + invocation if ABI_64_P, and here we should generate an + additional relocation record with R_SCORE_64 by itself for a + NULL symbol before this relocation record. */ + outrel[1].r_info = ELF32_R_INFO (0, R_SCORE_NONE); + outrel[2].r_info = ELF32_R_INFO (0, R_SCORE_NONE); + + /* Adjust the output offset of the relocation to reference the + correct location in the output file. */ + outrel[0].r_offset += (input_section->output_section->vma + + input_section->output_offset); + outrel[1].r_offset += (input_section->output_section->vma + + input_section->output_offset); + outrel[2].r_offset += (input_section->output_section->vma + + input_section->output_offset); + + /* Put the relocation back out. We have to use the special + relocation outputter in the 64-bit case since the 64-bit + relocation format is non-standard. */ + bfd_elf32_swap_reloc_out + (output_bfd, &outrel[0], + (sreloc->contents + sreloc->reloc_count * sizeof (Elf32_External_Rel))); + + /* We've now added another relocation. */ + ++sreloc->reloc_count; + + /* Make sure the output section is writable. The dynamic linker + will be writing to it. */ + elf_section_data (input_section->output_section)->this_hdr.sh_flags |= SHF_WRITE; + + return TRUE; +} + +static bfd_boolean +score_elf_create_got_section (bfd *abfd, + struct bfd_link_info *info, + bfd_boolean maybe_exclude) +{ + flagword flags; + asection *s; + struct elf_link_hash_entry *h; + struct bfd_link_hash_entry *bh; + struct score_got_info *g; + bfd_size_type amt; + + /* This function may be called more than once. */ + s = score_elf_got_section (abfd, TRUE); + if (s) + { + if (! maybe_exclude) + s->flags &= ~SEC_EXCLUDE; + return TRUE; + } + + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); + + if (maybe_exclude) + flags |= SEC_EXCLUDE; + + /* We have to use an alignment of 2**4 here because this is hardcoded + in the function stub generation and in the linker script. */ + s = bfd_make_section_with_flags (abfd, ".got", flags); + if (s == NULL + || ! bfd_set_section_alignment (abfd, s, 4)) + return FALSE; + + /* Define the symbol _GLOBAL_OFFSET_TABLE_. We don't do this in the + linker script because we don't want to define the symbol if we + are not creating a global offset table. */ + bh = NULL; + if (! (_bfd_generic_link_add_one_symbol + (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s, + 0, NULL, FALSE, get_elf_backend_data (abfd)->collect, &bh))) + return FALSE; + + h = (struct elf_link_hash_entry *) bh; + h->non_elf = 0; + h->def_regular = 1; + h->type = STT_OBJECT; + + if (info->shared && ! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + + amt = sizeof (struct score_got_info); + g = bfd_alloc (abfd, amt); + if (g == NULL) + return FALSE; + + g->global_gotsym = NULL; + g->global_gotno = 0; + + g->local_gotno = SCORE_RESERVED_GOTNO; + g->assigned_gotno = SCORE_RESERVED_GOTNO; + g->next = NULL; + + g->got_entries = htab_try_create (1, score_elf_got_entry_hash, + score_elf_got_entry_eq, NULL); + if (g->got_entries == NULL) + return FALSE; + score_elf_section_data (s)->u.got_info = g; + score_elf_section_data (s)->elf.this_hdr.sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_SCORE_GPREL; + + return TRUE; +} + +/* Calculate the %high function. */ + +static bfd_vma +score_elf_high (bfd_vma value) +{ + return ((value + (bfd_vma) 0x8000) >> 16) & 0xffff; +} + +/* Create a local GOT entry for VALUE. Return the index of the entry, + or -1 if it could not be created. */ + +static struct score_got_entry * +score_elf_create_local_got_entry (bfd *abfd, + bfd *ibfd ATTRIBUTE_UNUSED, + struct score_got_info *gg, + asection *sgot, bfd_vma value, + unsigned long r_symndx ATTRIBUTE_UNUSED, + struct score_elf_link_hash_entry *h ATTRIBUTE_UNUSED, + int r_type ATTRIBUTE_UNUSED) +{ + struct score_got_entry entry, **loc; + struct score_got_info *g; + + entry.abfd = NULL; + entry.symndx = -1; + entry.d.address = value; + + g = gg; + loc = (struct score_got_entry **) htab_find_slot (g->got_entries, &entry, INSERT); + if (*loc) + return *loc; + + entry.gotidx = SCORE_ELF_GOT_SIZE (abfd) * g->assigned_gotno++; + + *loc = bfd_alloc (abfd, sizeof entry); + + if (! *loc) + return NULL; + + memcpy (*loc, &entry, sizeof entry); + + if (g->assigned_gotno >= g->local_gotno) + { + (*loc)->gotidx = -1; + /* We didn't allocate enough space in the GOT. */ + (*_bfd_error_handler) + (_("not enough GOT space for local GOT entries")); + bfd_set_error (bfd_error_bad_value); + return NULL; + } + + bfd_put_32 (abfd, value, (sgot->contents + entry.gotidx)); + + return *loc; +} + +/* Find a GOT entry whose higher-order 16 bits are the same as those + for value. Return the index into the GOT for this entry. */ + +static bfd_vma +score_elf_got16_entry (bfd *abfd, bfd *ibfd, struct bfd_link_info *info, + bfd_vma value, bfd_boolean external) +{ + asection *sgot; + struct score_got_info *g; + struct score_got_entry *entry; + + if (!external) + { + /* Although the ABI says that it is "the high-order 16 bits" that we + want, it is really the %high value. The complete value is + calculated with a `addiu' of a LO16 relocation, just as with a + HI16/LO16 pair. */ + value = score_elf_high (value) << 16; + } + + g = score_elf_got_info (elf_hash_table (info)->dynobj, &sgot); + + entry = score_elf_create_local_got_entry (abfd, ibfd, g, sgot, value, 0, NULL, + R_SCORE_GOT15); + if (entry) + return entry->gotidx; + else + return MINUS_ONE; +} + +static void +_bfd_score_elf_hide_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *entry, + bfd_boolean force_local) +{ + bfd *dynobj; + asection *got; + struct score_got_info *g; + struct score_elf_link_hash_entry *h; + + h = (struct score_elf_link_hash_entry *) entry; + if (h->forced_local) + return; + h->forced_local = TRUE; + + dynobj = elf_hash_table (info)->dynobj; + if (dynobj != NULL && force_local) + { + got = score_elf_got_section (dynobj, FALSE); + if (got == NULL) + return; + g = score_elf_section_data (got)->u.got_info; + + if (g->next) + { + struct score_got_entry e; + struct score_got_info *gg = g; + + /* Since we're turning what used to be a global symbol into a + local one, bump up the number of local entries of each GOT + that had an entry for it. This will automatically decrease + the number of global entries, since global_gotno is actually + the upper limit of global entries. */ + e.abfd = dynobj; + e.symndx = -1; + e.d.h = h; + + for (g = g->next; g != gg; g = g->next) + if (htab_find (g->got_entries, &e)) + { + BFD_ASSERT (g->global_gotno > 0); + g->local_gotno++; + g->global_gotno--; + } + + /* If this was a global symbol forced into the primary GOT, we + no longer need an entry for it. We can't release the entry + at this point, but we must at least stop counting it as one + of the symbols that required a forced got entry. */ + if (h->root.got.offset == 2) + { + BFD_ASSERT (gg->assigned_gotno > 0); + gg->assigned_gotno--; + } + } + else if (g->global_gotno == 0 && g->global_gotsym == NULL) + /* If we haven't got through GOT allocation yet, just bump up the + number of local entries, as this symbol won't be counted as + global. */ + g->local_gotno++; + else if (h->root.got.offset == 1) + { + /* If we're past non-multi-GOT allocation and this symbol had + been marked for a global got entry, give it a local entry + instead. */ + BFD_ASSERT (g->global_gotno > 0); + g->local_gotno++; + g->global_gotno--; + } + } + + _bfd_elf_link_hash_hide_symbol (info, &h->root, force_local); +} + +/* If H is a symbol that needs a global GOT entry, but has a dynamic + symbol table index lower than any we've seen to date, record it for + posterity. */ + +static bfd_boolean +score_elf_record_global_got_symbol (struct elf_link_hash_entry *h, + bfd *abfd, + struct bfd_link_info *info, + struct score_got_info *g) +{ + struct score_got_entry entry, **loc; + + /* A global symbol in the GOT must also be in the dynamic symbol table. */ + if (h->dynindx == -1) + { + switch (ELF_ST_VISIBILITY (h->other)) + { + case STV_INTERNAL: + case STV_HIDDEN: + _bfd_score_elf_hide_symbol (info, h, TRUE); + break; + } + if (!bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + entry.abfd = abfd; + entry.symndx = -1; + entry.d.h = (struct score_elf_link_hash_entry *)h; + + loc = (struct score_got_entry **)htab_find_slot (g->got_entries, &entry, INSERT); + + /* If we've already marked this entry as needing GOT space, we don't + need to do it again. */ + if (*loc) + return TRUE; + + *loc = bfd_alloc (abfd, sizeof entry); + if (! *loc) + return FALSE; + + entry.gotidx = -1; + + memcpy (*loc, &entry, sizeof (entry)); + + if (h->got.offset != MINUS_ONE) + return TRUE; + + /* By setting this to a value other than -1, we are indicating that + there needs to be a GOT entry for H. Avoid using zero, as the + generic ELF copy_indirect_symbol tests for <= 0. */ + h->got.offset = 1; + + return TRUE; +} + +/* Reserve space in G for a GOT entry containing the value of symbol + SYMNDX in input bfd ABDF, plus ADDEND. */ + +static bfd_boolean +score_elf_record_local_got_symbol (bfd *abfd, + long symndx, + bfd_vma addend, + struct score_got_info *g) +{ + struct score_got_entry entry, **loc; + + entry.abfd = abfd; + entry.symndx = symndx; + entry.d.addend = addend; + loc = (struct score_got_entry **)htab_find_slot (g->got_entries, &entry, INSERT); + + if (*loc) + return TRUE; + + entry.gotidx = g->local_gotno++; + + *loc = bfd_alloc (abfd, sizeof(entry)); + if (! *loc) + return FALSE; + + memcpy (*loc, &entry, sizeof (entry)); + + return TRUE; +} + +/* Returns the GOT offset at which the indicated address can be found. + If there is not yet a GOT entry for this value, create one. + Returns -1 if no satisfactory GOT offset can be found. */ + +static bfd_vma +score_elf_local_got_index (bfd *abfd, bfd *ibfd, struct bfd_link_info *info, + bfd_vma value, unsigned long r_symndx, + struct score_elf_link_hash_entry *h, int r_type) +{ + asection *sgot; + struct score_got_info *g; + struct score_got_entry *entry; + + g = score_elf_got_info (elf_hash_table (info)->dynobj, &sgot); + + entry = score_elf_create_local_got_entry (abfd, ibfd, g, sgot, value, + r_symndx, h, r_type); + if (!entry) + return MINUS_ONE; + + else + return entry->gotidx; +} + +/* Returns the GOT index for the global symbol indicated by H. */ + +static bfd_vma +score_elf_global_got_index (bfd *abfd, struct elf_link_hash_entry *h) +{ + bfd_vma index; + asection *sgot; + struct score_got_info *g; + long global_got_dynindx = 0; + + g = score_elf_got_info (abfd, &sgot); + if (g->global_gotsym != NULL) + global_got_dynindx = g->global_gotsym->dynindx; + + /* Once we determine the global GOT entry with the lowest dynamic + symbol table index, we must put all dynamic symbols with greater + indices into the GOT. That makes it easy to calculate the GOT + offset. */ + BFD_ASSERT (h->dynindx >= global_got_dynindx); + index = ((h->dynindx - global_got_dynindx + g->local_gotno) * SCORE_ELF_GOT_SIZE (abfd)); + BFD_ASSERT (index < sgot->size); + + return index; +} + +/* Returns the offset for the entry at the INDEXth position in the GOT. */ + +static bfd_vma +score_elf_got_offset_from_index (bfd *dynobj, bfd *output_bfd, + bfd *input_bfd ATTRIBUTE_UNUSED, bfd_vma index) +{ + asection *sgot; + bfd_vma gp; + struct score_got_info *g; + + g = score_elf_got_info (dynobj, &sgot); + gp = _bfd_get_gp_value (output_bfd); + + return sgot->output_section->vma + sgot->output_offset + index - gp; +} + +/* Follow indirect and warning hash entries so that each got entry + points to the final symbol definition. P must point to a pointer + to the hash table we're traversing. Since this traversal may + modify the hash table, we set this pointer to NULL to indicate + we've made a potentially-destructive change to the hash table, so + the traversal must be restarted. */ +static int +score_elf_resolve_final_got_entry (void **entryp, void *p) +{ + struct score_got_entry *entry = (struct score_got_entry *)*entryp; + htab_t got_entries = *(htab_t *)p; + + if (entry->abfd != NULL && entry->symndx == -1) + { + struct score_elf_link_hash_entry *h = entry->d.h; + + while (h->root.root.type == bfd_link_hash_indirect + || h->root.root.type == bfd_link_hash_warning) + h = (struct score_elf_link_hash_entry *) h->root.root.u.i.link; + + if (entry->d.h == h) + return 1; + + entry->d.h = h; + + /* If we can't find this entry with the new bfd hash, re-insert + it, and get the traversal restarted. */ + if (! htab_find (got_entries, entry)) + { + htab_clear_slot (got_entries, entryp); + entryp = htab_find_slot (got_entries, entry, INSERT); + if (! *entryp) + *entryp = entry; + /* Abort the traversal, since the whole table may have + moved, and leave it up to the parent to restart the + process. */ + *(htab_t *)p = NULL; + return 0; + } + /* We might want to decrement the global_gotno count, but it's + either too early or too late for that at this point. */ + } + + return 1; +} + +/* Turn indirect got entries in a got_entries table into their final locations. */ +static void +score_elf_resolve_final_got_entries (struct score_got_info *g) +{ + htab_t got_entries; + + do + { + got_entries = g->got_entries; + + htab_traverse (got_entries, + score_elf_resolve_final_got_entry, + &got_entries); + } + while (got_entries == NULL); +} + +/* Add INCREMENT to the reloc (of type HOWTO) at ADDRESS. for -r */ + +static void +score_elf_add_to_rel (bfd *abfd, + bfd_byte *address, + reloc_howto_type *howto, + bfd_signed_vma increment) +{ + bfd_signed_vma addend; + bfd_vma contents; + unsigned long offset; + unsigned long r_type = howto->type; + unsigned long hi16_addend, hi16_offset, hi16_value, uvalue; + + contents = bfd_get_32 (abfd, address); + /* Get the (signed) value from the instruction. */ + addend = contents & howto->src_mask; + if (addend & ((howto->src_mask + 1) >> 1)) + { + bfd_signed_vma mask; + + mask = -1; + mask &= ~howto->src_mask; + addend |= mask; + } + /* Add in the increment, (which is a byte value). */ + switch (r_type) + { + case R_SCORE_PC19: + offset = + (((contents & howto->src_mask) & 0x3ff0000) >> 6) | ((contents & howto->src_mask) & 0x3ff); + offset += increment; + contents = + (contents & ~howto-> + src_mask) | (((offset << 6) & howto->src_mask) & 0x3ff0000) | (offset & 0x3ff); + bfd_put_32 (abfd, contents, address); + break; + case R_SCORE_HI16: + break; + case R_SCORE_LO16: + hi16_addend = bfd_get_32 (abfd, address - 4); + hi16_offset = ((((hi16_addend >> 16) & 0x3) << 15) | (hi16_addend & 0x7fff)) >> 1; + offset = ((((contents >> 16) & 0x3) << 15) | (contents & 0x7fff)) >> 1; + offset = (hi16_offset << 16) | (offset & 0xffff); + uvalue = increment + offset; + hi16_offset = (uvalue >> 16) << 1; + hi16_value = (hi16_addend & (~(howto->dst_mask))) + | (hi16_offset & 0x7fff) | ((hi16_offset << 1) & 0x30000); + bfd_put_32 (abfd, hi16_value, address - 4); + offset = (uvalue & 0xffff) << 1; + contents = (contents & (~(howto->dst_mask))) | (offset & 0x7fff) | ((offset << 1) & 0x30000); + bfd_put_32 (abfd, contents, address); + break; + case R_SCORE_24: + offset = + (((contents & howto->src_mask) >> 1) & 0x1ff8000) | ((contents & howto->src_mask) & 0x7fff); + offset += increment; + contents = + (contents & ~howto-> + src_mask) | (((offset << 1) & howto->src_mask) & 0x3ff0000) | (offset & 0x7fff); + bfd_put_32 (abfd, contents, address); + break; + case R_SCORE16_11: + + contents = bfd_get_16 (abfd, address); + offset = contents & howto->src_mask; + offset += increment; + contents = (contents & ~howto->src_mask) | (offset & howto->src_mask); + bfd_put_16 (abfd, contents, address); + + break; + case R_SCORE16_PC8: + + contents = bfd_get_16 (abfd, address); + offset = (contents & howto->src_mask) + ((increment >> 1) & 0xff); + contents = (contents & (~howto->src_mask)) | (offset & howto->src_mask); + bfd_put_16 (abfd, contents, address); + + break; + default: + addend += increment; + contents = (contents & ~howto->dst_mask) | (addend & howto->dst_mask); + bfd_put_32 (abfd, contents, address); + break; + } +} + +/* Perform a relocation as part of a final link. */ + +static bfd_reloc_status_type +score_elf_final_link_relocate (reloc_howto_type *howto, + bfd *input_bfd, + bfd *output_bfd, + asection *input_section, + bfd_byte *contents, + Elf_Internal_Rela *rel, + Elf_Internal_Rela *relocs, + bfd_vma symbol, + struct bfd_link_info *info, + const char *sym_name ATTRIBUTE_UNUSED, + int sym_flags ATTRIBUTE_UNUSED, + struct score_elf_link_hash_entry *h, + asection **local_sections, + bfd_boolean gp_disp_p) +{ + unsigned long r_type; + unsigned long r_symndx; + bfd_byte *hit_data = contents + rel->r_offset; + bfd_vma addend; + /* The final GP value to be used for the relocatable, executable, or + shared object file being produced. */ + bfd_vma gp = MINUS_ONE; + /* The place (section offset or address) of the storage unit being relocated. */ + bfd_vma rel_addr; + /* The value of GP used to create the relocatable object. */ + bfd_vma gp0 = MINUS_ONE; + /* The offset into the global offset table at which the address of the relocation entry + symbol, adjusted by the addend, resides during execution. */ + bfd_vma g = MINUS_ONE; + /* TRUE if the symbol referred to by this relocation is a local symbol. */ + bfd_boolean local_p; + /* The eventual value we will relocate. */ + bfd_vma value = symbol; + unsigned long hi16_addend, hi16_offset, hi16_value, uvalue, offset, abs_value = 0; + + if (elf_gp (output_bfd) == 0) + { + struct bfd_link_hash_entry *bh; + asection *o; + + bh = bfd_link_hash_lookup (info->hash, "_gp", 0, 0, 1); + if (bh != (struct bfd_link_hash_entry *)NULL && bh->type == bfd_link_hash_defined) + elf_gp (output_bfd) = (bh->u.def.value + + bh->u.def.section->output_section->vma + + bh->u.def.section->output_offset); + else if (info->relocatable) + { + bfd_vma lo = -1; + + /* Find the GP-relative section with the lowest offset. */ + for (o = output_bfd->sections; o != (asection *) NULL; o = o->next) + if (o->vma < lo) + lo = o->vma; + /* And calculate GP relative to that. */ + elf_gp (output_bfd) = lo + ELF_SCORE_GP_OFFSET (input_bfd); + } + else + { + /* If the relocate_section function needs to do a reloc + involving the GP value, it should make a reloc_dangerous + callback to warn that GP is not defined. */ + } + } + + /* Parse the relocation. */ + r_symndx = ELF32_R_SYM (rel->r_info); + r_type = ELF32_R_TYPE (rel->r_info); + rel_addr = (input_section->output_section->vma + input_section->output_offset + rel->r_offset); + local_p = score_elf_local_relocation_p (input_bfd, rel, local_sections, TRUE); + + if (r_type == R_SCORE_GOT15) + { + const Elf_Internal_Rela *relend; + const Elf_Internal_Rela *lo16_rel; + const struct elf_backend_data *bed; + bfd_vma lo_value = 0; + + bed = get_elf_backend_data (output_bfd); + relend = relocs + input_section->reloc_count * bed->s->int_rels_per_ext_rel; + lo16_rel = score_elf_next_relocation (input_bfd, R_SCORE_GOT_LO16, rel, relend); + if ((local_p) && (lo16_rel != NULL)) + { + bfd_vma tmp = 0; + tmp = bfd_get_32 (input_bfd, contents + lo16_rel->r_offset); + lo_value = (((tmp >> 16) & 0x3) << 14) | ((tmp & 0x7fff) >> 1); + } + addend = lo_value; + } + else + { + addend = (bfd_get_32 (input_bfd, hit_data) >> howto->bitpos) & howto->src_mask; + } + + /* If we haven't already determined the GOT offset, or the GP value, + and we're going to need it, get it now. */ + switch (r_type) + { + case R_SCORE_CALL15: + case R_SCORE_GOT15: + if (!local_p) + { + g = score_elf_global_got_index (elf_hash_table (info)->dynobj, + (struct elf_link_hash_entry *) h); + if ((! elf_hash_table(info)->dynamic_sections_created + || (info->shared + && (info->symbolic || h->root.dynindx == -1) + && h->root.def_regular))) + { + /* This is a static link or a -Bsymbolic link. The + symbol is defined locally, or was forced to be local. + We must initialize this entry in the GOT. */ + bfd *tmpbfd = elf_hash_table (info)->dynobj; + asection *sgot = score_elf_got_section (tmpbfd, FALSE); + bfd_put_32 (tmpbfd, value, sgot->contents + g); + } + } + else if (r_type == R_SCORE_GOT15 || r_type == R_SCORE_CALL15) + { + /* There's no need to create a local GOT entry here; the + calculation for a local GOT15 entry does not involve G. */ + ; + } + else + { + g = score_elf_local_got_index (output_bfd, input_bfd, info, + symbol + addend, r_symndx, h, r_type); + if (g == MINUS_ONE) + return bfd_reloc_outofrange; + } + + /* Convert GOT indices to actual offsets. */ + g = score_elf_got_offset_from_index (elf_hash_table (info)->dynobj, + output_bfd, input_bfd, g); + break; + + case R_SCORE_HI16: + case R_SCORE_LO16: + case R_SCORE_GPREL32: + gp0 = _bfd_get_gp_value (input_bfd); + gp = _bfd_get_gp_value (output_bfd); + break; + + case R_SCORE_GP15: + gp = _bfd_get_gp_value (output_bfd); + + default: + break; + } + + switch (r_type) + { + case R_SCORE_NONE: + return bfd_reloc_ok; + + case R_SCORE_ABS32: + case R_SCORE_REL32: + if ((info->shared + || (elf_hash_table (info)->dynamic_sections_created + && h != NULL + && h->root.def_dynamic + && !h->root.def_regular)) + && r_symndx != 0 + && (input_section->flags & SEC_ALLOC) != 0) + { + /* If we're creating a shared library, or this relocation is against a symbol + in a shared library, then we can't know where the symbol will end up. + So, we create a relocation record in the output, and leave the job up + to the dynamic linker. */ + value = addend; + if (!score_elf_create_dynamic_relocation (output_bfd, info, rel, h, + symbol, &value, + input_section)) + return bfd_reloc_undefined; + } + else + { + if (r_type != R_SCORE_REL32) + value = symbol + addend; + else + value = addend; + } + value &= howto->dst_mask; + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_SCORE_ABS16: + value += addend; + if ((long)value > 0x7fff || (long)value < -0x8000) + return bfd_reloc_overflow; + bfd_put_16 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_SCORE_24: + addend = bfd_get_32 (input_bfd, hit_data); + offset = (((addend & howto->src_mask) >> 1) & 0x1ff8000) | ((addend & howto->src_mask) & 0x7fff); + if ((offset & 0x1000000) != 0) + offset |= 0xfe000000; + value += offset; + addend = (addend & ~howto->src_mask) + | (((value << 1) & howto->src_mask) & 0x3ff0000) | (value & 0x7fff); + bfd_put_32 (input_bfd, addend, hit_data); + return bfd_reloc_ok; + + case R_SCORE_PC19: + addend = bfd_get_32 (input_bfd, hit_data); + offset = (((addend & howto->src_mask) & 0x3ff0000) >> 6) | ((addend & howto->src_mask) & 0x3ff); + if ((offset & 0x80000) != 0) + offset |= 0xfff00000; + abs_value = value = value - rel_addr + offset; + /* exceed 20 bit : overflow. */ + if ((abs_value & 0x80000000) == 0x80000000) + abs_value = 0xffffffff - value + 1; + if ((abs_value & 0xfff80000) != 0) + return bfd_reloc_overflow; + addend = (addend & ~howto->src_mask) + | (((value << 6) & howto->src_mask) & 0x3ff0000) | (value & 0x3ff); + bfd_put_32 (input_bfd, addend, hit_data); + return bfd_reloc_ok; + + case R_SCORE16_11: + addend = bfd_get_16 (input_bfd, hit_data); + offset = addend & howto->src_mask; + if ((offset & 0x800) != 0) /* Offset is negative. */ + offset |= 0xfffff000; + value += offset; + addend = (addend & ~howto->src_mask) | (value & howto->src_mask); + bfd_put_16 (input_bfd, addend, hit_data); + return bfd_reloc_ok; + + case R_SCORE16_PC8: + addend = bfd_get_16 (input_bfd, hit_data); + offset = (addend & howto->src_mask) << 1; + if ((offset & 0x100) != 0) /* Offset is negative. */ + offset |= 0xfffffe00; + abs_value = value = value - rel_addr + offset; + /* Sign bit + exceed 9 bit. */ + if (((value & 0xffffff00) != 0) && ((value & 0xffffff00) != 0xffffff00)) + return bfd_reloc_overflow; + value >>= 1; + addend = (addend & ~howto->src_mask) | (value & howto->src_mask); + bfd_put_16 (input_bfd, addend, hit_data); + return bfd_reloc_ok; + + case R_SCORE_HI16: + return bfd_reloc_ok; + + case R_SCORE_LO16: + hi16_addend = bfd_get_32 (input_bfd, hit_data - 4); + hi16_offset = ((((hi16_addend >> 16) & 0x3) << 15) | (hi16_addend & 0x7fff)) >> 1; + addend = bfd_get_32 (input_bfd, hit_data); + offset = ((((addend >> 16) & 0x3) << 15) | (addend & 0x7fff)) >> 1; + offset = (hi16_offset << 16) | (offset & 0xffff); + + if (!gp_disp_p) + uvalue = value + offset; + else + uvalue = offset + gp - rel_addr + 4; + + hi16_offset = (uvalue >> 16) << 1; + hi16_value = (hi16_addend & (~(howto->dst_mask))) + | (hi16_offset & 0x7fff) | ((hi16_offset << 1) & 0x30000); + bfd_put_32 (input_bfd, hi16_value, hit_data - 4); + offset = (uvalue & 0xffff) << 1; + value = (addend & (~(howto->dst_mask))) | (offset & 0x7fff) | ((offset << 1) & 0x30000); + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_SCORE_GP15: + addend = bfd_get_32 (input_bfd, hit_data); + offset = addend & 0x7fff; + if ((offset & 0x4000) == 0x4000) + offset |= 0xffffc000; + value = value + offset - gp; + if (((value & 0xffffc000) != 0) && ((value & 0xffffc000) != 0xffffc000)) + return bfd_reloc_overflow; + value = (addend & ~howto->src_mask) | (value & howto->src_mask); + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_SCORE_GOT15: + case R_SCORE_CALL15: + if (local_p) + { + bfd_boolean forced; + + /* The special case is when the symbol is forced to be local. We need the + full address in the GOT since no R_SCORE_GOT_LO16 relocation follows. */ + forced = ! score_elf_local_relocation_p (input_bfd, rel, + local_sections, FALSE); + value = score_elf_got16_entry (output_bfd, input_bfd, info, + symbol + addend, forced); + if (value == MINUS_ONE) + return bfd_reloc_outofrange; + value = score_elf_got_offset_from_index (elf_hash_table (info)->dynobj, + output_bfd, input_bfd, value); + } + else + { + value = g; + } + + if ((long) value > 0x3fff || (long) value < -0x4000) + return bfd_reloc_overflow; + + addend = bfd_get_32 (input_bfd, hit_data); + value = (addend & ~howto->dst_mask) | (value & howto->dst_mask); + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_SCORE_GPREL32: + value = (addend + symbol - gp); + value &= howto->dst_mask; + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_SCORE_GOT_LO16: + addend = bfd_get_32 (input_bfd, hit_data); + value = (((addend >> 16) & 0x3) << 14) | ((addend & 0x7fff) >> 1); + value += symbol; + value = (addend & (~(howto->dst_mask))) | ((value & 0x3fff) << 1) + | (((value >> 14) & 0x3) << 16); + + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_SCORE_DUMMY_HI16: + return bfd_reloc_ok; + + case R_SCORE_GNU_VTINHERIT: + case R_SCORE_GNU_VTENTRY: + /* We don't do anything with these at present. */ + return bfd_reloc_continue; + + default: + return bfd_reloc_notsupported; + } +} + +/* Score backend functions. */ + +static void +_bfd_score_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, + arelent *bfd_reloc, + Elf_Internal_Rela *elf_reloc) +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (elf_reloc->r_info); + if (r_type >= NUM_ELEM (elf32_score_howto_table)) + bfd_reloc->howto = NULL; + else + bfd_reloc->howto = &elf32_score_howto_table[r_type]; +} + +/* Relocate an score ELF section. */ + +static bfd_boolean +_bfd_score_elf_relocate_section (bfd *output_bfd, + struct bfd_link_info *info, + bfd *input_bfd, + asection *input_section, + bfd_byte *contents, + Elf_Internal_Rela *relocs, + Elf_Internal_Sym *local_syms, + asection **local_sections) +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel; + Elf_Internal_Rela *relend; + const char *name; + unsigned long offset; + unsigned long hi16_addend, hi16_offset, hi16_value, uvalue; + size_t extsymoff; + bfd_boolean gp_disp_p = FALSE; + + /* Sort dynsym. */ + if (elf_hash_table (info)->dynamic_sections_created) + { + bfd_size_type dynsecsymcount = 0; + if (info->shared) + { + asection * p; + const struct elf_backend_data *bed = get_elf_backend_data (output_bfd); + + for (p = output_bfd->sections; p ; p = p->next) + if ((p->flags & SEC_EXCLUDE) == 0 + && (p->flags & SEC_ALLOC) != 0 + && !(*bed->elf_backend_omit_section_dynsym) (output_bfd, info, p)) + ++ dynsecsymcount; + } + + if (!score_elf_sort_hash_table (info, dynsecsymcount + 1)) + return FALSE; + } + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + extsymoff = (elf_bad_symtab (input_bfd)) ? 0 : symtab_hdr->sh_info; + sym_hashes = elf_sym_hashes (input_bfd); + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + int r_type; + reloc_howto_type *howto; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + struct score_elf_link_hash_entry *h; + bfd_vma relocation = 0; + bfd_reloc_status_type r; + arelent bfd_reloc; + + r_symndx = ELF32_R_SYM (rel->r_info); + r_type = ELF32_R_TYPE (rel->r_info); + + _bfd_score_info_to_howto (input_bfd, &bfd_reloc, (Elf_Internal_Rela *) rel); + howto = bfd_reloc.howto; + + h = NULL; + sym = NULL; + sec = NULL; + + if (r_symndx < extsymoff) + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + relocation = (sec->output_section->vma + + sec->output_offset + + sym->st_value); + name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym, sec); + + if (!info->relocatable + && (sec->flags & SEC_MERGE) != 0 + && ELF_ST_TYPE (sym->st_info) == STT_SECTION) + { + asection *msec; + bfd_vma addend, value; + + switch (r_type) + { + case R_SCORE_HI16: + break; + case R_SCORE_LO16: + hi16_addend = bfd_get_32 (input_bfd, contents + rel->r_offset - 4); + hi16_offset = ((((hi16_addend >> 16) & 0x3) << 15) | (hi16_addend & 0x7fff)) >> 1; + value = bfd_get_32 (input_bfd, contents + rel->r_offset); + offset = ((((value >> 16) & 0x3) << 15) | (value & 0x7fff)) >> 1; + addend = (hi16_offset << 16) | (offset & 0xffff); + msec = sec; + addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend); + addend -= relocation; + addend += msec->output_section->vma + msec->output_offset; + uvalue = addend; + hi16_offset = (uvalue >> 16) << 1; + hi16_value = (hi16_addend & (~(howto->dst_mask))) + | (hi16_offset & 0x7fff) | ((hi16_offset << 1) & 0x30000); + bfd_put_32 (input_bfd, hi16_value, contents + rel->r_offset - 4); + offset = (uvalue & 0xffff) << 1; + value = (value & (~(howto->dst_mask))) + | (offset & 0x7fff) | ((offset << 1) & 0x30000); + bfd_put_32 (input_bfd, value, contents + rel->r_offset); + break; + case R_SCORE_GOT_LO16: + value = bfd_get_32 (input_bfd, contents + rel->r_offset); + addend = (((value >> 16) & 0x3) << 14) | ((value & 0x7fff) >> 1); + msec = sec; + addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend) - relocation; + addend += msec->output_section->vma + msec->output_offset; + value = (value & (~(howto->dst_mask))) | ((addend & 0x3fff) << 1) + | (((addend >> 14) & 0x3) << 16); + + bfd_put_32 (input_bfd, value, contents + rel->r_offset); + break; + default: + value = bfd_get_32 (input_bfd, contents + rel->r_offset); + /* Get the (signed) value from the instruction. */ + addend = value & howto->src_mask; + if (addend & ((howto->src_mask + 1) >> 1)) + { + bfd_signed_vma mask; + + mask = -1; + mask &= ~howto->src_mask; + addend |= mask; + } + msec = sec; + addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend) - relocation; + addend += msec->output_section->vma + msec->output_offset; + value = (value & ~howto->dst_mask) | (addend & howto->dst_mask); + bfd_put_32 (input_bfd, value, contents + rel->r_offset); + break; + } + } + } + else + { + /* For global symbols we look up the symbol in the hash-table. */ + h = ((struct score_elf_link_hash_entry *) + elf_sym_hashes (input_bfd) [r_symndx - extsymoff]); + /* Find the real hash-table entry for this symbol. */ + while (h->root.root.type == bfd_link_hash_indirect + || h->root.root.type == bfd_link_hash_warning) + h = (struct score_elf_link_hash_entry *) h->root.root.u.i.link; + + /* Record the name of this symbol, for our caller. */ + name = h->root.root.root.string; + + /* See if this is the special GP_DISP_LABEL symbol. Note that such a + symbol must always be a global symbol. */ + if (strcmp (name, GP_DISP_LABEL) == 0) + { + /* Relocations against GP_DISP_LABEL are permitted only with + R_SCORE_HI16 and R_SCORE_LO16 relocations. */ + if (r_type != R_SCORE_HI16 && r_type != R_SCORE_LO16) + return bfd_reloc_notsupported; + + gp_disp_p = TRUE; + } + + /* If this symbol is defined, calculate its address. Note that + GP_DISP_LABEL is a magic symbol, always implicitly defined by the + linker, so it's inappropriate to check to see whether or not + its defined. */ + else if ((h->root.root.type == bfd_link_hash_defined + || h->root.root.type == bfd_link_hash_defweak) + && h->root.root.u.def.section) + { + sec = h->root.root.u.def.section; + if (sec->output_section) + relocation = (h->root.root.u.def.value + + sec->output_section->vma + + sec->output_offset); + else + { + relocation = h->root.root.u.def.value; + } + } + else if (h->root.root.type == bfd_link_hash_undefweak) + /* We allow relocations against undefined weak symbols, giving + it the value zero, so that you can undefined weak functions + and check to see if they exist by looking at their addresses. */ + relocation = 0; + else if (info->unresolved_syms_in_objects == RM_IGNORE + && ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT) + relocation = 0; + else if (strcmp (name, "_DYNAMIC_LINK") == 0) + { + /* If this is a dynamic link, we should have created a _DYNAMIC_LINK symbol + in _bfd_score_elf_create_dynamic_sections. Otherwise, we should define + the symbol with a value of 0. */ + BFD_ASSERT (! info->shared); + BFD_ASSERT (bfd_get_section_by_name (output_bfd, ".dynamic") == NULL); + relocation = 0; + } + else if (!info->relocatable) + { + if (! ((*info->callbacks->undefined_symbol) + (info, h->root.root.root.string, input_bfd, + input_section, rel->r_offset, + (info->unresolved_syms_in_objects == RM_GENERATE_ERROR) + || ELF_ST_VISIBILITY (h->root.other)))) + return bfd_reloc_undefined; + relocation = 0; + } + } + + if (sec != NULL && elf_discarded_section (sec)) + { + /* For relocs against symbols from removed linkonce sections, + or sections discarded by a linker script, we just want the + section contents zeroed. Avoid any special processing. */ + _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset); + rel->r_info = 0; + rel->r_addend = 0; + continue; + } + + if (info->relocatable) + { + /* This is a relocatable link. We don't have to change + anything, unless the reloc is against a section symbol, + in which case we have to adjust according to where the + section symbol winds up in the output section. */ + if (sym != NULL && ELF_ST_TYPE (sym->st_info) == STT_SECTION) + score_elf_add_to_rel (input_bfd, contents + rel->r_offset, + howto, (bfd_signed_vma) sec->output_offset); + continue; + } + + r = score_elf_final_link_relocate (howto, input_bfd, output_bfd, + input_section, contents, rel, relocs, + relocation, info, name, + (h ? ELF_ST_TYPE ((unsigned int)h->root.root.type) : + ELF_ST_TYPE ((unsigned int)sym->st_info)), h, local_sections, + gp_disp_p); + + if (r != bfd_reloc_ok) + { + const char *msg = (const char *)0; + + switch (r) + { + case bfd_reloc_overflow: + /* If the overflowing reloc was to an undefined symbol, + we have already printed one error message and there + is no point complaining again. */ + if (((!h) || (h->root.root.type != bfd_link_hash_undefined)) + && (!((*info->callbacks->reloc_overflow) + (info, NULL, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset)))) + return FALSE; + break; + case bfd_reloc_undefined: + if (!((*info->callbacks->undefined_symbol) + (info, name, input_bfd, input_section, rel->r_offset, TRUE))) + return FALSE; + break; + + case bfd_reloc_outofrange: + msg = _("internal error: out of range error"); + goto common_error; + + case bfd_reloc_notsupported: + msg = _("internal error: unsupported relocation error"); + goto common_error; + + case bfd_reloc_dangerous: + msg = _("internal error: dangerous error"); + goto common_error; + + default: + msg = _("internal error: unknown error"); + /* fall through */ + + common_error: + if (!((*info->callbacks->warning) + (info, msg, name, input_bfd, input_section, rel->r_offset))) + return FALSE; + break; + } + } + } + + return TRUE; +} + +/* Look through the relocs for a section during the first phase, and + allocate space in the global offset table. */ + +static bfd_boolean +_bfd_score_elf_check_relocs (bfd *abfd, + struct bfd_link_info *info, + asection *sec, + const Elf_Internal_Rela *relocs) +{ + const char *name; + bfd *dynobj; + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + struct score_got_info *g; + size_t extsymoff; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + asection *sgot; + asection *sreloc; + const struct elf_backend_data *bed; + + if (info->relocatable) + return TRUE; + + dynobj = elf_hash_table (info)->dynobj; + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + extsymoff = (elf_bad_symtab (abfd)) ? 0 : symtab_hdr->sh_info; + + name = bfd_get_section_name (abfd, sec); + + if (dynobj == NULL) + { + sgot = NULL; + g = NULL; + } + else + { + sgot = score_elf_got_section (dynobj, FALSE); + if (sgot == NULL) + g = NULL; + else + { + BFD_ASSERT (score_elf_section_data (sgot) != NULL); + g = score_elf_section_data (sgot)->u.got_info; + BFD_ASSERT (g != NULL); + } + } + + sreloc = NULL; + bed = get_elf_backend_data (abfd); + rel_end = relocs + sec->reloc_count * bed->s->int_rels_per_ext_rel; + for (rel = relocs; rel < rel_end; ++rel) + { + unsigned long r_symndx; + unsigned int r_type; + struct elf_link_hash_entry *h; + + r_symndx = ELF32_R_SYM (rel->r_info); + r_type = ELF32_R_TYPE (rel->r_info); + + if (r_symndx < extsymoff) + { + h = NULL; + } + else if (r_symndx >= extsymoff + NUM_SHDR_ENTRIES (symtab_hdr)) + { + (*_bfd_error_handler) (_("%s: Malformed reloc detected for section %s"), abfd, name); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + else + { + h = sym_hashes[r_symndx - extsymoff]; + + /* This may be an indirect symbol created because of a version. */ + if (h != NULL) + { + while (h->root.type == bfd_link_hash_indirect) + h = (struct elf_link_hash_entry *)h->root.u.i.link; + } + } + + /* Some relocs require a global offset table. */ + if (dynobj == NULL || sgot == NULL) + { + switch (r_type) + { + case R_SCORE_GOT15: + case R_SCORE_CALL15: + if (dynobj == NULL) + elf_hash_table (info)->dynobj = dynobj = abfd; + if (!score_elf_create_got_section (dynobj, info, FALSE)) + return FALSE; + g = score_elf_got_info (dynobj, &sgot); + break; + case R_SCORE_ABS32: + case R_SCORE_REL32: + if (dynobj == NULL && (info->shared || h != NULL) && (sec->flags & SEC_ALLOC) != 0) + elf_hash_table (info)->dynobj = dynobj = abfd; + break; + default: + break; + } + } + + if (!h && (r_type == R_SCORE_GOT_LO16)) + { + if (! score_elf_record_local_got_symbol (abfd, r_symndx, rel->r_addend, g)) + return FALSE; + } + + switch (r_type) + { + case R_SCORE_CALL15: + if (h == NULL) + { + (*_bfd_error_handler) + (_("%B: CALL15 reloc at 0x%lx not against global symbol"), + abfd, (unsigned long) rel->r_offset); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + else + { + /* This symbol requires a global offset table entry. */ + if (! score_elf_record_global_got_symbol (h, abfd, info, g)) + return FALSE; + + /* We need a stub, not a plt entry for the undefined function. But we record + it as if it needs plt. See _bfd_elf_adjust_dynamic_symbol. */ + h->needs_plt = 1; + h->type = STT_FUNC; + } + break; + case R_SCORE_GOT15: + if (h && ! score_elf_record_global_got_symbol (h, abfd, info, g)) + return FALSE; + break; + case R_SCORE_ABS32: + case R_SCORE_REL32: + if ((info->shared || h != NULL) && (sec->flags & SEC_ALLOC) != 0) + { + if (sreloc == NULL) + { + sreloc = score_elf_rel_dyn_section (dynobj, TRUE); + if (sreloc == NULL) + return FALSE; + } +#define SCORE_READONLY_SECTION (SEC_ALLOC | SEC_LOAD | SEC_READONLY) + if (info->shared) + { + /* When creating a shared object, we must copy these reloc types into + the output file as R_SCORE_REL32 relocs. We make room for this reloc + in the .rel.dyn reloc section. */ + score_elf_allocate_dynamic_relocations (dynobj, 1); + if ((sec->flags & SCORE_READONLY_SECTION) + == SCORE_READONLY_SECTION) + /* We tell the dynamic linker that there are + relocations against the text segment. */ + info->flags |= DF_TEXTREL; + } + else + { + struct score_elf_link_hash_entry *hscore; + + /* We only need to copy this reloc if the symbol is + defined in a dynamic object. */ + hscore = (struct score_elf_link_hash_entry *)h; + ++hscore->possibly_dynamic_relocs; + if ((sec->flags & SCORE_READONLY_SECTION) + == SCORE_READONLY_SECTION) + /* We need it to tell the dynamic linker if there + are relocations against the text segment. */ + hscore->readonly_reloc = TRUE; + } + + /* Even though we don't directly need a GOT entry for this symbol, + a symbol must have a dynamic symbol table index greater that + DT_SCORE_GOTSYM if there are dynamic relocations against it. */ + if (h != NULL) + { + if (dynobj == NULL) + elf_hash_table (info)->dynobj = dynobj = abfd; + if (! score_elf_create_got_section (dynobj, info, TRUE)) + return FALSE; + g = score_elf_got_info (dynobj, &sgot); + if (! score_elf_record_global_got_symbol (h, abfd, info, g)) + return FALSE; + } + } + break; + + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + case R_SCORE_GNU_VTINHERIT: + if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + + /* This relocation describes which C++ vtable entries are actually + used. Record for later use during GC. */ + case R_SCORE_GNU_VTENTRY: + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + default: + break; + } + + /* We must not create a stub for a symbol that has relocations + related to taking the function's address. */ + switch (r_type) + { + default: + if (h != NULL) + { + struct score_elf_link_hash_entry *sh; + + sh = (struct score_elf_link_hash_entry *) h; + sh->no_fn_stub = TRUE; + } + break; + case R_SCORE_CALL15: + break; + } + } + + return TRUE; +} + +static bfd_boolean +_bfd_score_elf_add_symbol_hook (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + Elf_Internal_Sym *sym, + const char **namep ATTRIBUTE_UNUSED, + flagword *flagsp ATTRIBUTE_UNUSED, + asection **secp, + bfd_vma *valp) +{ + switch (sym->st_shndx) + { + case SHN_COMMON: + if (sym->st_size > elf_gp_size (abfd)) + break; + /* Fall through. */ + case SHN_SCORE_SCOMMON: + *secp = bfd_make_section_old_way (abfd, ".scommon"); + (*secp)->flags |= SEC_IS_COMMON; + *valp = sym->st_size; + break; + } + + return TRUE; +} + +static void +_bfd_score_elf_symbol_processing (bfd *abfd, asymbol *asym) +{ + elf_symbol_type *elfsym; + + elfsym = (elf_symbol_type *) asym; + switch (elfsym->internal_elf_sym.st_shndx) + { + case SHN_COMMON: + if (asym->value > elf_gp_size (abfd)) + break; + /* Fall through. */ + case SHN_SCORE_SCOMMON: + if (score_elf_scom_section.name == NULL) + { + /* Initialize the small common section. */ + score_elf_scom_section.name = ".scommon"; + score_elf_scom_section.flags = SEC_IS_COMMON; + score_elf_scom_section.output_section = &score_elf_scom_section; + score_elf_scom_section.symbol = &score_elf_scom_symbol; + score_elf_scom_section.symbol_ptr_ptr = &score_elf_scom_symbol_ptr; + score_elf_scom_symbol.name = ".scommon"; + score_elf_scom_symbol.flags = BSF_SECTION_SYM; + score_elf_scom_symbol.section = &score_elf_scom_section; + score_elf_scom_symbol_ptr = &score_elf_scom_symbol; + } + asym->section = &score_elf_scom_section; + asym->value = elfsym->internal_elf_sym.st_size; + break; + } +} + +static bfd_boolean +_bfd_score_elf_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED, + const char *name ATTRIBUTE_UNUSED, + Elf_Internal_Sym *sym, + asection *input_sec, + struct elf_link_hash_entry *h ATTRIBUTE_UNUSED) +{ + /* If we see a common symbol, which implies a relocatable link, then + if a symbol was small common in an input file, mark it as small + common in the output file. */ + if (sym->st_shndx == SHN_COMMON && strcmp (input_sec->name, ".scommon") == 0) + sym->st_shndx = SHN_SCORE_SCOMMON; + + return TRUE; +} + +static bfd_boolean +_bfd_score_elf_section_from_bfd_section (bfd *abfd ATTRIBUTE_UNUSED, + asection *sec, + int *retval) +{ + if (strcmp (bfd_get_section_name (abfd, sec), ".scommon") == 0) + { + *retval = SHN_SCORE_SCOMMON; + return TRUE; + } + + return FALSE; +} + +/* Adjust a symbol defined by a dynamic object and referenced by a + regular object. The current definition is in some section of the + dynamic object, but we're not including those sections. We have to + change the definition to something the rest of the link can understand. */ + +static bfd_boolean +_bfd_score_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *h) +{ + bfd *dynobj; + struct score_elf_link_hash_entry *hscore; + asection *s; + + dynobj = elf_hash_table (info)->dynobj; + + /* Make sure we know what is going on here. */ + BFD_ASSERT (dynobj != NULL + && (h->needs_plt + || h->u.weakdef != NULL + || (h->def_dynamic && h->ref_regular && !h->def_regular))); + + /* If this symbol is defined in a dynamic object, we need to copy + any R_SCORE_ABS32 or R_SCORE_REL32 relocs against it into the output + file. */ + hscore = (struct score_elf_link_hash_entry *)h; + if (!info->relocatable + && hscore->possibly_dynamic_relocs != 0 + && (h->root.type == bfd_link_hash_defweak || !h->def_regular)) + { + score_elf_allocate_dynamic_relocations (dynobj, hscore->possibly_dynamic_relocs); + if (hscore->readonly_reloc) + /* We tell the dynamic linker that there are relocations + against the text segment. */ + info->flags |= DF_TEXTREL; + } + + /* For a function, create a stub, if allowed. */ + if (!hscore->no_fn_stub && h->needs_plt) + { + if (!elf_hash_table (info)->dynamic_sections_created) + return TRUE; + + /* If this symbol is not defined in a regular file, then set + the symbol to the stub location. This is required to make + function pointers compare as equal between the normal + executable and the shared library. */ + if (!h->def_regular) + { + /* We need .stub section. */ + s = bfd_get_section_by_name (dynobj, SCORE_ELF_STUB_SECTION_NAME); + BFD_ASSERT (s != NULL); + + h->root.u.def.section = s; + h->root.u.def.value = s->size; + + /* XXX Write this stub address somewhere. */ + h->plt.offset = s->size; + + /* Make room for this stub code. */ + s->size += SCORE_FUNCTION_STUB_SIZE; + + /* The last half word of the stub will be filled with the index + of this symbol in .dynsym section. */ + return TRUE; + } + } + else if ((h->type == STT_FUNC) && !h->needs_plt) + { + /* This will set the entry for this symbol in the GOT to 0, and + the dynamic linker will take care of this. */ + h->root.u.def.value = 0; + return TRUE; + } + + /* If this is a weak symbol, and there is a real definition, the + processor independent code will have arranged for us to see the + real definition first, and we can just use the same value. */ + if (h->u.weakdef != NULL) + { + BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined + || h->u.weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->u.weakdef->root.u.def.section; + h->root.u.def.value = h->u.weakdef->root.u.def.value; + return TRUE; + } + + /* This is a reference to a symbol defined by a dynamic object which + is not a function. */ + return TRUE; +} + +/* This function is called after all the input files have been read, + and the input sections have been assigned to output sections. */ + +static bfd_boolean +_bfd_score_elf_always_size_sections (bfd *output_bfd, + struct bfd_link_info *info) +{ + bfd *dynobj; + asection *s; + struct score_got_info *g; + int i; + bfd_size_type loadable_size = 0; + bfd_size_type local_gotno; + bfd *sub; + + dynobj = elf_hash_table (info)->dynobj; + if (dynobj == NULL) + /* Relocatable links don't have it. */ + return TRUE; + + g = score_elf_got_info (dynobj, &s); + if (s == NULL) + return TRUE; + + /* Calculate the total loadable size of the output. That will give us the + maximum number of GOT_PAGE entries required. */ + for (sub = info->input_bfds; sub; sub = sub->link_next) + { + asection *subsection; + + for (subsection = sub->sections; + subsection; + subsection = subsection->next) + { + if ((subsection->flags & SEC_ALLOC) == 0) + continue; + loadable_size += ((subsection->size + 0xf) + &~ (bfd_size_type) 0xf); + } + } + + /* There has to be a global GOT entry for every symbol with + a dynamic symbol table index of DT_SCORE_GOTSYM or + higher. Therefore, it make sense to put those symbols + that need GOT entries at the end of the symbol table. We + do that here. */ + if (! score_elf_sort_hash_table (info, 1)) + return FALSE; + + if (g->global_gotsym != NULL) + i = elf_hash_table (info)->dynsymcount - g->global_gotsym->dynindx; + else + /* If there are no global symbols, or none requiring + relocations, then GLOBAL_GOTSYM will be NULL. */ + i = 0; + + /* In the worst case, we'll get one stub per dynamic symbol. */ + loadable_size += SCORE_FUNCTION_STUB_SIZE * i; + + /* Assume there are two loadable segments consisting of + contiguous sections. Is 5 enough? */ + local_gotno = (loadable_size >> 16) + 5; + + g->local_gotno += local_gotno; + s->size += g->local_gotno * SCORE_ELF_GOT_SIZE (output_bfd); + + g->global_gotno = i; + s->size += i * SCORE_ELF_GOT_SIZE (output_bfd); + + score_elf_resolve_final_got_entries (g); + + if (s->size > SCORE_ELF_GOT_MAX_SIZE (output_bfd)) + { + /* Fixme. Error message or Warning message should be issued here. */ + } + + return TRUE; +} + +/* Set the sizes of the dynamic sections. */ + +static bfd_boolean +_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) +{ + bfd *dynobj; + asection *s; + bfd_boolean reltext; + + dynobj = elf_hash_table (info)->dynobj; + BFD_ASSERT (dynobj != NULL); + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Set the contents of the .interp section to the interpreter. */ + if (!info->shared) + { + s = bfd_get_section_by_name (dynobj, ".interp"); + BFD_ASSERT (s != NULL); + s->size = strlen (ELF_DYNAMIC_INTERPRETER) + 1; + s->contents = (bfd_byte *) ELF_DYNAMIC_INTERPRETER; + } + } + + /* The check_relocs and adjust_dynamic_symbol entry points have + determined the sizes of the various dynamic sections. Allocate + memory for them. */ + reltext = FALSE; + for (s = dynobj->sections; s != NULL; s = s->next) + { + const char *name; + + if ((s->flags & SEC_LINKER_CREATED) == 0) + continue; + + /* It's OK to base decisions on the section name, because none + of the dynobj section names depend upon the input files. */ + name = bfd_get_section_name (dynobj, s); + + if (CONST_STRNEQ (name, ".rel")) + { + if (s->size == 0) + { + /* We only strip the section if the output section name + has the same name. Otherwise, there might be several + input sections for this output section. FIXME: This + code is probably not needed these days anyhow, since + the linker now does not create empty output sections. */ + if (s->output_section != NULL + && strcmp (name, + bfd_get_section_name (s->output_section->owner, + s->output_section)) == 0) + s->flags |= SEC_EXCLUDE; + } + else + { + const char *outname; + asection *target; + + /* If this relocation section applies to a read only + section, then we probably need a DT_TEXTREL entry. + If the relocation section is .rel.dyn, we always + assert a DT_TEXTREL entry rather than testing whether + there exists a relocation to a read only section or + not. */ + outname = bfd_get_section_name (output_bfd, s->output_section); + target = bfd_get_section_by_name (output_bfd, outname + 4); + if ((target != NULL + && (target->flags & SEC_READONLY) != 0 + && (target->flags & SEC_ALLOC) != 0) || strcmp (outname, ".rel.dyn") == 0) + reltext = TRUE; + + /* We use the reloc_count field as a counter if we need + to copy relocs into the output file. */ + if (strcmp (name, ".rel.dyn") != 0) + s->reloc_count = 0; + } + } + else if (CONST_STRNEQ (name, ".got")) + { + /* _bfd_score_elf_always_size_sections() has already done + most of the work, but some symbols may have been mapped + to versions that we must now resolve in the got_entries + hash tables. */ + } + else if (strcmp (name, SCORE_ELF_STUB_SECTION_NAME) == 0) + { + /* IRIX rld assumes that the function stub isn't at the end + of .text section. So put a dummy. XXX */ + s->size += SCORE_FUNCTION_STUB_SIZE; + } + else if (! CONST_STRNEQ (name, ".init")) + { + /* It's not one of our sections, so don't allocate space. */ + continue; + } + + /* Allocate memory for the section contents. */ + s->contents = bfd_zalloc (dynobj, s->size); + if (s->contents == NULL && s->size != 0) + { + bfd_set_error (bfd_error_no_memory); + return FALSE; + } + } + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Add some entries to the .dynamic section. We fill in the + values later, in _bfd_score_elf_finish_dynamic_sections, but we + must add the entries now so that we get the correct size for + the .dynamic section. The DT_DEBUG entry is filled in by the + dynamic linker and used by the debugger. */ + + if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0)) + return FALSE; + + if (reltext) + info->flags |= DF_TEXTREL; + + if ((info->flags & DF_TEXTREL) != 0) + { + if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_TEXTREL, 0)) + return FALSE; + } + + if (! SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_PLTGOT, 0)) + return FALSE; + + if (score_elf_rel_dyn_section (dynobj, FALSE)) + { + if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_REL, 0)) + return FALSE; + + if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELSZ, 0)) + return FALSE; + + if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELENT, 0)) + return FALSE; + } + + if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_SCORE_BASE_ADDRESS, 0)) + return FALSE; + + if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_SCORE_LOCAL_GOTNO, 0)) + return FALSE; + + if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_SCORE_SYMTABNO, 0)) + return FALSE; + + if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_SCORE_UNREFEXTNO, 0)) + return FALSE; + + if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_SCORE_GOTSYM, 0)) + return FALSE; + + if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_SCORE_HIPAGENO, 0)) + return FALSE; + } + + return TRUE; +} + +static bfd_boolean +_bfd_score_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) +{ + struct elf_link_hash_entry *h; + struct bfd_link_hash_entry *bh; + flagword flags; + asection *s; + + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED | SEC_READONLY); + + /* ABI requests the .dynamic section to be read only. */ + s = bfd_get_section_by_name (abfd, ".dynamic"); + if (s != NULL) + { + if (!bfd_set_section_flags (abfd, s, flags)) + return FALSE; + } + + /* We need to create .got section. */ + if (!score_elf_create_got_section (abfd, info, FALSE)) + return FALSE; + + if (!score_elf_rel_dyn_section (elf_hash_table (info)->dynobj, TRUE)) + return FALSE; + + /* Create .stub section. */ + if (bfd_get_section_by_name (abfd, SCORE_ELF_STUB_SECTION_NAME) == NULL) + { + s = bfd_make_section_with_flags (abfd, SCORE_ELF_STUB_SECTION_NAME, + flags | SEC_CODE); + if (s == NULL + || !bfd_set_section_alignment (abfd, s, 2)) + + return FALSE; + } + + if (!info->shared) + { + const char *name; + + name = "_DYNAMIC_LINK"; + bh = NULL; + if (!(_bfd_generic_link_add_one_symbol + (info, abfd, name, BSF_GLOBAL, bfd_abs_section_ptr, + (bfd_vma) 0, (const char *)NULL, FALSE, get_elf_backend_data (abfd)->collect, &bh))) + return FALSE; + + h = (struct elf_link_hash_entry *)bh; + h->non_elf = 0; + h->def_regular = 1; + h->type = STT_SECTION; + + if (!bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + return TRUE; +} + + +/* Finish up dynamic symbol handling. We set the contents of various + dynamic sections here. */ + +static bfd_boolean +_bfd_score_elf_finish_dynamic_symbol (bfd *output_bfd, + struct bfd_link_info *info, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) +{ + bfd *dynobj; + asection *sgot; + struct score_got_info *g; + const char *name; + + dynobj = elf_hash_table (info)->dynobj; + + if (h->plt.offset != MINUS_ONE) + { + asection *s; + bfd_byte stub[SCORE_FUNCTION_STUB_SIZE]; + + /* This symbol has a stub. Set it up. */ + BFD_ASSERT (h->dynindx != -1); + + s = bfd_get_section_by_name (dynobj, SCORE_ELF_STUB_SECTION_NAME); + BFD_ASSERT (s != NULL); + + /* FIXME: Can h->dynindex be more than 64K? */ + if (h->dynindx & 0xffff0000) + return FALSE; + + /* Fill the stub. */ + bfd_put_32 (output_bfd, STUB_LW, stub); + bfd_put_32 (output_bfd, STUB_MOVE, stub + 4); + bfd_put_32 (output_bfd, STUB_LI16 | (h->dynindx << 1), stub + 8); + bfd_put_32 (output_bfd, STUB_BRL, stub + 12); + + BFD_ASSERT (h->plt.offset <= s->size); + memcpy (s->contents + h->plt.offset, stub, SCORE_FUNCTION_STUB_SIZE); + + /* Mark the symbol as undefined. plt.offset != -1 occurs + only for the referenced symbol. */ + sym->st_shndx = SHN_UNDEF; + + /* The run-time linker uses the st_value field of the symbol + to reset the global offset table entry for this external + to its stub address when unlinking a shared object. */ + sym->st_value = (s->output_section->vma + s->output_offset + h->plt.offset); + } + + BFD_ASSERT (h->dynindx != -1 || h->forced_local); + + sgot = score_elf_got_section (dynobj, FALSE); + BFD_ASSERT (sgot != NULL); + BFD_ASSERT (score_elf_section_data (sgot) != NULL); + g = score_elf_section_data (sgot)->u.got_info; + BFD_ASSERT (g != NULL); + + /* Run through the global symbol table, creating GOT entries for all + the symbols that need them. */ + if (g->global_gotsym != NULL && h->dynindx >= g->global_gotsym->dynindx) + { + bfd_vma offset; + bfd_vma value; + + value = sym->st_value; + offset = score_elf_global_got_index (dynobj, h); + bfd_put_32 (output_bfd, value, sgot->contents + offset); + } + + /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ + name = h->root.root.string; + if (strcmp (name, "_DYNAMIC") == 0 || strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0) + sym->st_shndx = SHN_ABS; + else if (strcmp (name, "_DYNAMIC_LINK") == 0) + { + sym->st_shndx = SHN_ABS; + sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION); + sym->st_value = 1; + } + else if (strcmp (name, GP_DISP_LABEL) == 0) + { + sym->st_shndx = SHN_ABS; + sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION); + sym->st_value = elf_gp (output_bfd); + } + + return TRUE; +} + +/* Finish up the dynamic sections. */ + +static bfd_boolean +_bfd_score_elf_finish_dynamic_sections (bfd *output_bfd, + struct bfd_link_info *info) +{ + bfd *dynobj; + asection *sdyn; + asection *sgot; + asection *s; + struct score_got_info *g; + + dynobj = elf_hash_table (info)->dynobj; + + sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); + + sgot = score_elf_got_section (dynobj, FALSE); + if (sgot == NULL) + g = NULL; + else + { + BFD_ASSERT (score_elf_section_data (sgot) != NULL); + g = score_elf_section_data (sgot)->u.got_info; + BFD_ASSERT (g != NULL); + } + + if (elf_hash_table (info)->dynamic_sections_created) + { + bfd_byte *b; + + BFD_ASSERT (sdyn != NULL); + BFD_ASSERT (g != NULL); + + for (b = sdyn->contents; + b < sdyn->contents + sdyn->size; + b += SCORE_ELF_DYN_SIZE (dynobj)) + { + Elf_Internal_Dyn dyn; + const char *name; + size_t elemsize; + bfd_boolean swap_out_p; + + /* Read in the current dynamic entry. */ + (*get_elf_backend_data (dynobj)->s->swap_dyn_in) (dynobj, b, &dyn); + + /* Assume that we're going to modify it and write it out. */ + swap_out_p = TRUE; + + switch (dyn.d_tag) + { + case DT_RELENT: + s = score_elf_rel_dyn_section (dynobj, FALSE); + BFD_ASSERT (s != NULL); + dyn.d_un.d_val = SCORE_ELF_REL_SIZE (dynobj); + break; + + case DT_STRSZ: + /* Rewrite DT_STRSZ. */ + dyn.d_un.d_val = _bfd_elf_strtab_size (elf_hash_table (info)->dynstr); + break; + + case DT_PLTGOT: + name = ".got"; + s = bfd_get_section_by_name (output_bfd, name); + BFD_ASSERT (s != NULL); + dyn.d_un.d_ptr = s->vma; + break; + + case DT_SCORE_BASE_ADDRESS: + s = output_bfd->sections; + BFD_ASSERT (s != NULL); + dyn.d_un.d_ptr = s->vma & ~(bfd_vma) 0xffff; + break; + + case DT_SCORE_LOCAL_GOTNO: + dyn.d_un.d_val = g->local_gotno; + break; + + case DT_SCORE_UNREFEXTNO: + /* The index into the dynamic symbol table which is the + entry of the first external symbol that is not + referenced within the same object. */ + dyn.d_un.d_val = bfd_count_sections (output_bfd) + 1; + break; + + case DT_SCORE_GOTSYM: + if (g->global_gotsym) + { + dyn.d_un.d_val = g->global_gotsym->dynindx; + break; + } + /* In case if we don't have global got symbols we default + to setting DT_SCORE_GOTSYM to the same value as + DT_SCORE_SYMTABNO, so we just fall through. */ + + case DT_SCORE_SYMTABNO: + name = ".dynsym"; + elemsize = SCORE_ELF_SYM_SIZE (output_bfd); + s = bfd_get_section_by_name (output_bfd, name); + BFD_ASSERT (s != NULL); + + dyn.d_un.d_val = s->size / elemsize; + break; + + case DT_SCORE_HIPAGENO: + dyn.d_un.d_val = g->local_gotno - SCORE_RESERVED_GOTNO; + break; + + default: + swap_out_p = FALSE; + break; + } + + if (swap_out_p) + (*get_elf_backend_data (dynobj)->s->swap_dyn_out) (dynobj, &dyn, b); + } + } + + /* The first entry of the global offset table will be filled at + runtime. The second entry will be used by some runtime loaders. + This isn't the case of IRIX rld. */ + if (sgot != NULL && sgot->size > 0) + { + bfd_put_32 (output_bfd, 0, sgot->contents); + bfd_put_32 (output_bfd, 0x80000000, sgot->contents + SCORE_ELF_GOT_SIZE (output_bfd)); + } + + if (sgot != NULL) + elf_section_data (sgot->output_section)->this_hdr.sh_entsize + = SCORE_ELF_GOT_SIZE (output_bfd); + + + /* We need to sort the entries of the dynamic relocation section. */ + s = score_elf_rel_dyn_section (dynobj, FALSE); + + if (s != NULL && s->size > (bfd_vma)2 * SCORE_ELF_REL_SIZE (output_bfd)) + { + reldyn_sorting_bfd = output_bfd; + qsort ((Elf32_External_Rel *) s->contents + 1, s->reloc_count - 1, + sizeof (Elf32_External_Rel), score_elf_sort_dynamic_relocs); + } + + return TRUE; +} + +/* This function set up the ELF section header for a BFD section in preparation for writing + it out. This is where the flags and type fields are set for unusual sections. */ + +static bfd_boolean +_bfd_score_elf_fake_sections (bfd *abfd ATTRIBUTE_UNUSED, + Elf_Internal_Shdr *hdr, + asection *sec) +{ + const char *name; + + name = bfd_get_section_name (abfd, sec); + + if (strcmp (name, ".got") == 0 + || strcmp (name, ".srdata") == 0 + || strcmp (name, ".sdata") == 0 + || strcmp (name, ".sbss") == 0) + hdr->sh_flags |= SHF_SCORE_GPREL; + + return TRUE; +} + +/* This function do additional processing on the ELF section header before writing + it out. This is used to set the flags and type fields for some sections. */ + +/* assign_file_positions_except_relocs() check section flag and if it is allocatable, + warning message will be issued. backend_fake_section is called before + assign_file_positions_except_relocs(); backend_section_processing after it. so, we + modify section flag there, but not backend_fake_section. */ + +static bfd_boolean +_bfd_score_elf_section_processing (bfd *abfd ATTRIBUTE_UNUSED, Elf_Internal_Shdr *hdr) +{ + if (hdr->bfd_section != NULL) + { + const char *name = bfd_get_section_name (abfd, hdr->bfd_section); + + if (strcmp (name, ".sdata") == 0) + { + hdr->sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_SCORE_GPREL; + hdr->sh_type = SHT_PROGBITS; + } + else if (strcmp (name, ".sbss") == 0) + { + hdr->sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_SCORE_GPREL; + hdr->sh_type = SHT_NOBITS; + } + else if (strcmp (name, ".srdata") == 0) + { + hdr->sh_flags |= SHF_ALLOC | SHF_SCORE_GPREL; + hdr->sh_type = SHT_PROGBITS; + } + } + + return TRUE; +} + +static bfd_boolean +_bfd_score_elf_write_section (bfd *output_bfd, + struct bfd_link_info *link_info ATTRIBUTE_UNUSED, + asection *sec, bfd_byte *contents) +{ + bfd_byte *to, *from, *end; + int i; + + if (strcmp (sec->name, ".pdr") != 0) + return FALSE; + + if (score_elf_section_data (sec)->u.tdata == NULL) + return FALSE; + + to = contents; + end = contents + sec->size; + for (from = contents, i = 0; from < end; from += PDR_SIZE, i++) + { + if ((score_elf_section_data (sec)->u.tdata)[i] == 1) + continue; + + if (to != from) + memcpy (to, from, PDR_SIZE); + + to += PDR_SIZE; + } + bfd_set_section_contents (output_bfd, sec->output_section, contents, + (file_ptr) sec->output_offset, sec->size); + + return TRUE; +} + +/* Copy data from a SCORE ELF indirect symbol to its direct symbol, hiding the old + indirect symbol. Process additional relocation information. */ + +static void +_bfd_score_elf_copy_indirect_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *dir, + struct elf_link_hash_entry *ind) +{ + struct score_elf_link_hash_entry *dirscore, *indscore; + + _bfd_elf_link_hash_copy_indirect (info, dir, ind); + + if (ind->root.type != bfd_link_hash_indirect) + return; + + dirscore = (struct score_elf_link_hash_entry *) dir; + indscore = (struct score_elf_link_hash_entry *) ind; + dirscore->possibly_dynamic_relocs += indscore->possibly_dynamic_relocs; + + if (indscore->readonly_reloc) + dirscore->readonly_reloc = TRUE; + + if (indscore->no_fn_stub) + dirscore->no_fn_stub = TRUE; +} + +/* Remove information about discarded functions from other sections which mention them. */ + +static bfd_boolean +_bfd_score_elf_discard_info (bfd *abfd, struct elf_reloc_cookie *cookie, + struct bfd_link_info *info) +{ + asection *o; + bfd_boolean ret = FALSE; + unsigned char *tdata; + size_t i, skip; + + o = bfd_get_section_by_name (abfd, ".pdr"); + if ((!o) || (o->size == 0) || (o->size % PDR_SIZE != 0) + || (o->output_section != NULL && bfd_is_abs_section (o->output_section))) + return FALSE; + + tdata = bfd_zmalloc (o->size / PDR_SIZE); + if (!tdata) + return FALSE; + + cookie->rels = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL, info->keep_memory); + if (!cookie->rels) + { + free (tdata); + return FALSE; + } + + cookie->rel = cookie->rels; + cookie->relend = cookie->rels + o->reloc_count; + + for (i = 0, skip = 0; i < o->size; i++) + { + if (bfd_elf_reloc_symbol_deleted_p (i * PDR_SIZE, cookie)) + { + tdata[i] = 1; + skip++; + } + } + + if (skip != 0) + { + score_elf_section_data (o)->u.tdata = tdata; + o->size -= skip * PDR_SIZE; + ret = TRUE; + } + else + free (tdata); + + if (!info->keep_memory) + free (cookie->rels); + + return ret; +} + +/* Signal that discard_info() has removed the discarded relocations for this section. */ + +static bfd_boolean +_bfd_score_elf_ignore_discarded_relocs (asection *sec) +{ + if (strcmp (sec->name, ".pdr") == 0) + return TRUE; + return FALSE; +} + +/* Return the section that should be marked against GC for a given + relocation. */ + +static asection * +_bfd_score_elf_gc_mark_hook (asection *sec, + struct bfd_link_info *info, + Elf_Internal_Rela *rel, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) +{ + if (h != NULL) + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_SCORE_GNU_VTINHERIT: + case R_SCORE_GNU_VTENTRY: + return NULL; + } + + return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym); +} + +/* Support for core dump NOTE sections. */ + +static bfd_boolean +_bfd_score_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) +{ + int offset; + unsigned int raw_size; + + switch (note->descsz) + { + default: + return FALSE; + + case 148: /* Linux/Score 32-bit. */ + /* pr_cursig */ + elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); + + /* pr_pid */ + elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); + + /* pr_reg */ + offset = 72; + raw_size = 72; + + break; + } + + /* Make a ".reg/999" section. */ + return _bfd_elfcore_make_pseudosection (abfd, ".reg", raw_size, note->descpos + offset); +} + +static bfd_boolean +_bfd_score_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) +{ + switch (note->descsz) + { + default: + return FALSE; + + case 124: /* Linux/Score elf_prpsinfo. */ + elf_tdata (abfd)->core_program = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16); + elf_tdata (abfd)->core_command = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80); + } + + /* Note that for some reason, a spurious space is tacked + onto the end of the args in some (at least one anyway) + implementations, so strip it off if it exists. */ + + { + char *command = elf_tdata (abfd)->core_command; + int n = strlen (command); + + if (0 < n && command[n - 1] == ' ') + command[n - 1] = '\0'; + } + + return TRUE; +} + + +/* Score BFD functions. */ + +static reloc_howto_type * +elf32_score_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_type code) +{ + unsigned int i; + + for (i = 0; i < NUM_ELEM (elf32_score_reloc_map); i++) + if (elf32_score_reloc_map[i].bfd_reloc_val == code) + return &elf32_score_howto_table[elf32_score_reloc_map[i].elf_reloc_val]; + + return NULL; +} + +static reloc_howto_type * +elf32_score_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (elf32_score_howto_table) + / sizeof (elf32_score_howto_table[0])); + i++) + if (elf32_score_howto_table[i].name != NULL + && strcasecmp (elf32_score_howto_table[i].name, r_name) == 0) + return &elf32_score_howto_table[i]; + + return NULL; +} + +/* Create a score elf linker hash table. */ + +static struct bfd_link_hash_table * +elf32_score_link_hash_table_create (bfd *abfd) +{ + struct score_elf_link_hash_table *ret; + bfd_size_type amt = sizeof (struct score_elf_link_hash_table); + + ret = bfd_malloc (amt); + if (ret == NULL) + return NULL; + + if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, score_elf_link_hash_newfunc, + sizeof (struct score_elf_link_hash_entry))) + { + free (ret); + return NULL; + } + + return &ret->root.root; +} + +static bfd_boolean +elf32_score_print_private_bfd_data (bfd *abfd, void * ptr) +{ + FILE *file = (FILE *) ptr; + + BFD_ASSERT (abfd != NULL && ptr != NULL); + + /* Print normal ELF private data. */ + _bfd_elf_print_private_bfd_data (abfd, ptr); + + /* xgettext:c-format */ + fprintf (file, _("private flags = %lx:"), elf_elfheader (abfd)->e_flags); + if (elf_elfheader (abfd)->e_flags & EF_SCORE_PIC) + { + fprintf (file, _(" [pic]")); + } + if (elf_elfheader (abfd)->e_flags & EF_SCORE_FIXDEP) + { + fprintf (file, _(" [fix dep]")); + } + fputc ('\n', file); + + return TRUE; +} + +static bfd_boolean +elf32_score_merge_private_bfd_data (bfd *ibfd, bfd *obfd) +{ + flagword in_flags; + flagword out_flags; + + if (!_bfd_generic_verify_endian_match (ibfd, obfd)) + return FALSE; + + in_flags = elf_elfheader (ibfd)->e_flags; + out_flags = elf_elfheader (obfd)->e_flags; + + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + in_flags = elf_elfheader (ibfd)->e_flags; + out_flags = elf_elfheader (obfd)->e_flags; + + if (! elf_flags_init (obfd)) + { + elf_flags_init (obfd) = TRUE; + elf_elfheader (obfd)->e_flags = in_flags; + + if (bfd_get_arch (obfd) == bfd_get_arch (ibfd) + && bfd_get_arch_info (obfd)->the_default) + { + return bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), bfd_get_mach (ibfd)); + } + + return TRUE; + } + + if (((in_flags & EF_SCORE_PIC) != 0) != ((out_flags & EF_SCORE_PIC) != 0)) + { + (*_bfd_error_handler) (_("%B: warning: linking PIC files with non-PIC files"), ibfd); + } + + /* FIXME: Maybe dependency fix compatibility should be checked here. */ + + return TRUE; +} + +static bfd_boolean +elf32_score_new_section_hook (bfd *abfd, asection *sec) +{ + struct _score_elf_section_data *sdata; + bfd_size_type amt = sizeof (*sdata); + + sdata = bfd_zalloc (abfd, amt); + if (sdata == NULL) + return FALSE; + sec->used_by_bfd = sdata; + + return _bfd_elf_new_section_hook (abfd, sec); +} + + +#define USE_REL 1 +#define TARGET_LITTLE_SYM bfd_elf32_littlescore_vec +#define TARGET_LITTLE_NAME "elf32-littlescore" +#define TARGET_BIG_SYM bfd_elf32_bigscore_vec +#define TARGET_BIG_NAME "elf32-bigscore" +#define ELF_ARCH bfd_arch_score +#define ELF_MACHINE_CODE EM_SCORE +#define ELF_MAXPAGESIZE 0x8000 + +#define elf_info_to_howto 0 +#define elf_info_to_howto_rel _bfd_score_info_to_howto +#define elf_backend_relocate_section _bfd_score_elf_relocate_section +#define elf_backend_check_relocs _bfd_score_elf_check_relocs +#define elf_backend_add_symbol_hook _bfd_score_elf_add_symbol_hook +#define elf_backend_symbol_processing _bfd_score_elf_symbol_processing +#define elf_backend_link_output_symbol_hook \ + _bfd_score_elf_link_output_symbol_hook +#define elf_backend_section_from_bfd_section \ + _bfd_score_elf_section_from_bfd_section +#define elf_backend_adjust_dynamic_symbol \ + _bfd_score_elf_adjust_dynamic_symbol +#define elf_backend_always_size_sections \ + _bfd_score_elf_always_size_sections +#define elf_backend_size_dynamic_sections \ + _bfd_score_elf_size_dynamic_sections +#define elf_backend_omit_section_dynsym \ + ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true) +#define elf_backend_create_dynamic_sections \ + _bfd_score_elf_create_dynamic_sections +#define elf_backend_finish_dynamic_symbol \ + _bfd_score_elf_finish_dynamic_symbol +#define elf_backend_finish_dynamic_sections \ + _bfd_score_elf_finish_dynamic_sections +#define elf_backend_fake_sections _bfd_score_elf_fake_sections +#define elf_backend_section_processing _bfd_score_elf_section_processing +#define elf_backend_write_section _bfd_score_elf_write_section +#define elf_backend_copy_indirect_symbol _bfd_score_elf_copy_indirect_symbol +#define elf_backend_hide_symbol _bfd_score_elf_hide_symbol +#define elf_backend_discard_info _bfd_score_elf_discard_info +#define elf_backend_ignore_discarded_relocs \ + _bfd_score_elf_ignore_discarded_relocs +#define elf_backend_gc_mark_hook _bfd_score_elf_gc_mark_hook +#define elf_backend_grok_prstatus _bfd_score_elf_grok_prstatus +#define elf_backend_grok_psinfo _bfd_score_elf_grok_psinfo +#define elf_backend_can_gc_sections 1 +#define elf_backend_want_plt_sym 0 +#define elf_backend_got_header_size (4 * SCORE_RESERVED_GOTNO) +#define elf_backend_plt_header_size 0 +#define elf_backend_collect TRUE +#define elf_backend_type_change_ok TRUE + +#define bfd_elf32_bfd_reloc_type_lookup elf32_score_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup \ + elf32_score_reloc_name_lookup +#define bfd_elf32_bfd_link_hash_table_create elf32_score_link_hash_table_create +#define bfd_elf32_bfd_print_private_bfd_data elf32_score_print_private_bfd_data +#define bfd_elf32_bfd_merge_private_bfd_data elf32_score_merge_private_bfd_data +#define bfd_elf32_new_section_hook elf32_score_new_section_hook + +#include "elf32-target.h" diff --git a/contrib/binutils/bfd/elf32-sh-relocs.h b/contrib/binutils/bfd/elf32-sh-relocs.h new file mode 100644 index 000000000000..3488ef4edbe4 --- /dev/null +++ b/contrib/binutils/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/contrib/binutils/bfd/elf32-sparc.c b/contrib/binutils/bfd/elf32-sparc.c index 3bfb38a3d44a..f8a3bff196d4 100644 --- a/contrib/binutils/bfd/elf32-sparc.c +++ b/contrib/binutils/bfd/elf32-sparc.c @@ -1,6 +1,6 @@ /* SPARC-specific support for 32-bit ELF Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005 Free Software Foundation, Inc. + 2003, 2004, 2005, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,8 +18,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "bfdlink.h" #include "libbfd.h" #include "elf-bfd.h" @@ -172,6 +172,7 @@ elf32_sparc_reloc_type_class (const Elf_Internal_Rela *rela) #define ELF_MACHINE_CODE EM_SPARC #define ELF_MACHINE_ALT1 EM_SPARC32PLUS #define ELF_MAXPAGESIZE 0x10000 +#define ELF_COMMONPAGESIZE 0x2000 #define bfd_elf32_bfd_merge_private_bfd_data \ elf32_sparc_merge_private_bfd_data @@ -182,6 +183,8 @@ elf32_sparc_reloc_type_class (const Elf_Internal_Rela *rela) #define elf_info_to_howto _bfd_sparc_elf_info_to_howto #define bfd_elf32_bfd_reloc_type_lookup _bfd_sparc_elf_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup \ + _bfd_sparc_elf_reloc_name_lookup #define bfd_elf32_bfd_link_hash_table_create \ _bfd_sparc_elf_link_hash_table_create #define bfd_elf32_bfd_relax_section _bfd_sparc_elf_relax_section @@ -206,6 +209,7 @@ elf32_sparc_reloc_type_class (const Elf_Internal_Rela *rela) #define elf_backend_gc_mark_hook _bfd_sparc_elf_gc_mark_hook #define elf_backend_gc_sweep_hook _bfd_sparc_elf_gc_sweep_hook #define elf_backend_plt_sym_val _bfd_sparc_elf_plt_sym_val +#define elf_backend_init_index_section _bfd_elf_init_1_index_section #define elf_backend_can_gc_sections 1 #define elf_backend_can_refcount 1 diff --git a/contrib/binutils/bfd/elf32-spu.c b/contrib/binutils/bfd/elf32-spu.c new file mode 100644 index 000000000000..d652117e2992 --- /dev/null +++ b/contrib/binutils/bfd/elf32-spu.c @@ -0,0 +1,3154 @@ +/* SPU specific support for 32-bit ELF + + Copyright 2006, 2007 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "sysdep.h" +#include "bfd.h" +#include "bfdlink.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/spu.h" +#include "elf32-spu.h" + +/* We use RELA style relocs. Don't define USE_REL. */ + +static bfd_reloc_status_type spu_elf_rel9 (bfd *, arelent *, asymbol *, + void *, asection *, + bfd *, char **); + +/* Values of type 'enum elf_spu_reloc_type' are used to index this + array, so it must be declared in the order of that type. */ + +static reloc_howto_type elf_howto_table[] = { + HOWTO (R_SPU_NONE, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "SPU_NONE", + FALSE, 0, 0x00000000, FALSE), + HOWTO (R_SPU_ADDR10, 4, 2, 10, FALSE, 14, complain_overflow_bitfield, + bfd_elf_generic_reloc, "SPU_ADDR10", + FALSE, 0, 0x00ffc000, FALSE), + HOWTO (R_SPU_ADDR16, 2, 2, 16, FALSE, 7, complain_overflow_bitfield, + bfd_elf_generic_reloc, "SPU_ADDR16", + FALSE, 0, 0x007fff80, FALSE), + HOWTO (R_SPU_ADDR16_HI, 16, 2, 16, FALSE, 7, complain_overflow_bitfield, + bfd_elf_generic_reloc, "SPU_ADDR16_HI", + FALSE, 0, 0x007fff80, FALSE), + HOWTO (R_SPU_ADDR16_LO, 0, 2, 16, FALSE, 7, complain_overflow_dont, + bfd_elf_generic_reloc, "SPU_ADDR16_LO", + FALSE, 0, 0x007fff80, FALSE), + HOWTO (R_SPU_ADDR18, 0, 2, 18, FALSE, 7, complain_overflow_bitfield, + bfd_elf_generic_reloc, "SPU_ADDR18", + FALSE, 0, 0x01ffff80, FALSE), + HOWTO (R_SPU_ADDR32, 0, 2, 32, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "SPU_ADDR32", + FALSE, 0, 0xffffffff, FALSE), + HOWTO (R_SPU_REL16, 2, 2, 16, TRUE, 7, complain_overflow_bitfield, + bfd_elf_generic_reloc, "SPU_REL16", + FALSE, 0, 0x007fff80, TRUE), + HOWTO (R_SPU_ADDR7, 0, 2, 7, FALSE, 14, complain_overflow_dont, + bfd_elf_generic_reloc, "SPU_ADDR7", + FALSE, 0, 0x001fc000, FALSE), + HOWTO (R_SPU_REL9, 2, 2, 9, TRUE, 0, complain_overflow_signed, + spu_elf_rel9, "SPU_REL9", + FALSE, 0, 0x0180007f, TRUE), + HOWTO (R_SPU_REL9I, 2, 2, 9, TRUE, 0, complain_overflow_signed, + spu_elf_rel9, "SPU_REL9I", + FALSE, 0, 0x0000c07f, TRUE), + HOWTO (R_SPU_ADDR10I, 0, 2, 10, FALSE, 14, complain_overflow_signed, + bfd_elf_generic_reloc, "SPU_ADDR10I", + FALSE, 0, 0x00ffc000, FALSE), + HOWTO (R_SPU_ADDR16I, 0, 2, 16, FALSE, 7, complain_overflow_signed, + bfd_elf_generic_reloc, "SPU_ADDR16I", + FALSE, 0, 0x007fff80, FALSE), + HOWTO (R_SPU_REL32, 0, 2, 32, TRUE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "SPU_REL32", + FALSE, 0, 0xffffffff, TRUE), + HOWTO (R_SPU_ADDR16X, 0, 2, 16, FALSE, 7, complain_overflow_bitfield, + bfd_elf_generic_reloc, "SPU_ADDR16X", + FALSE, 0, 0x007fff80, FALSE), + HOWTO (R_SPU_PPU32, 0, 2, 32, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "SPU_PPU32", + FALSE, 0, 0xffffffff, FALSE), + HOWTO (R_SPU_PPU64, 0, 4, 64, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "SPU_PPU64", + FALSE, 0, -1, FALSE), +}; + +static struct bfd_elf_special_section const spu_elf_special_sections[] = { + { ".toe", 4, 0, SHT_NOBITS, SHF_ALLOC }, + { NULL, 0, 0, 0, 0 } +}; + +static enum elf_spu_reloc_type +spu_elf_bfd_to_reloc_type (bfd_reloc_code_real_type code) +{ + switch (code) + { + default: + return R_SPU_NONE; + case BFD_RELOC_SPU_IMM10W: + return R_SPU_ADDR10; + case BFD_RELOC_SPU_IMM16W: + return R_SPU_ADDR16; + case BFD_RELOC_SPU_LO16: + return R_SPU_ADDR16_LO; + case BFD_RELOC_SPU_HI16: + return R_SPU_ADDR16_HI; + case BFD_RELOC_SPU_IMM18: + return R_SPU_ADDR18; + case BFD_RELOC_SPU_PCREL16: + return R_SPU_REL16; + case BFD_RELOC_SPU_IMM7: + return R_SPU_ADDR7; + case BFD_RELOC_SPU_IMM8: + return R_SPU_NONE; + case BFD_RELOC_SPU_PCREL9a: + return R_SPU_REL9; + case BFD_RELOC_SPU_PCREL9b: + return R_SPU_REL9I; + case BFD_RELOC_SPU_IMM10: + return R_SPU_ADDR10I; + case BFD_RELOC_SPU_IMM16: + return R_SPU_ADDR16I; + case BFD_RELOC_32: + return R_SPU_ADDR32; + case BFD_RELOC_32_PCREL: + return R_SPU_REL32; + case BFD_RELOC_SPU_PPU32: + return R_SPU_PPU32; + case BFD_RELOC_SPU_PPU64: + return R_SPU_PPU64; + } +} + +static void +spu_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, + arelent *cache_ptr, + Elf_Internal_Rela *dst) +{ + enum elf_spu_reloc_type r_type; + + r_type = (enum elf_spu_reloc_type) ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (r_type < R_SPU_max); + cache_ptr->howto = &elf_howto_table[(int) r_type]; +} + +static reloc_howto_type * +spu_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) +{ + enum elf_spu_reloc_type r_type = spu_elf_bfd_to_reloc_type (code); + + if (r_type == R_SPU_NONE) + return NULL; + + return elf_howto_table + r_type; +} + +static reloc_howto_type * +spu_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; i < sizeof (elf_howto_table) / sizeof (elf_howto_table[0]); i++) + if (elf_howto_table[i].name != NULL + && strcasecmp (elf_howto_table[i].name, r_name) == 0) + return &elf_howto_table[i]; + + return NULL; +} + +/* Apply R_SPU_REL9 and R_SPU_REL9I relocs. */ + +static bfd_reloc_status_type +spu_elf_rel9 (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, + bfd *output_bfd, char **error_message) +{ + bfd_size_type octets; + bfd_vma val; + long insn; + + /* If this is a relocatable link (output_bfd test tells us), just + call the generic function. Any adjustment will be done at final + link time. */ + if (output_bfd != NULL) + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); + + if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)) + return bfd_reloc_outofrange; + octets = reloc_entry->address * bfd_octets_per_byte (abfd); + + /* Get symbol value. */ + val = 0; + if (!bfd_is_com_section (symbol->section)) + val = symbol->value; + if (symbol->section->output_section) + val += symbol->section->output_section->vma; + + val += reloc_entry->addend; + + /* Make it pc-relative. */ + val -= input_section->output_section->vma + input_section->output_offset; + + val >>= 2; + if (val + 256 >= 512) + return bfd_reloc_overflow; + + insn = bfd_get_32 (abfd, (bfd_byte *) data + octets); + + /* Move two high bits of value to REL9I and REL9 position. + The mask will take care of selecting the right field. */ + val = (val & 0x7f) | ((val & 0x180) << 7) | ((val & 0x180) << 16); + insn &= ~reloc_entry->howto->dst_mask; + insn |= val & reloc_entry->howto->dst_mask; + bfd_put_32 (abfd, insn, (bfd_byte *) data + octets); + return bfd_reloc_ok; +} + +static bfd_boolean +spu_elf_new_section_hook (bfd *abfd, asection *sec) +{ + if (!sec->used_by_bfd) + { + struct _spu_elf_section_data *sdata; + + sdata = bfd_zalloc (abfd, sizeof (*sdata)); + if (sdata == NULL) + return FALSE; + sec->used_by_bfd = sdata; + } + + return _bfd_elf_new_section_hook (abfd, sec); +} + +/* Specially mark defined symbols named _EAR_* with BSF_KEEP so that + strip --strip-unneeded will not remove them. */ + +static void +spu_elf_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, asymbol *sym) +{ + if (sym->name != NULL + && sym->section != bfd_abs_section_ptr + && strncmp (sym->name, "_EAR_", 5) == 0) + sym->flags |= BSF_KEEP; +} + +/* SPU ELF linker hash table. */ + +struct spu_link_hash_table +{ + struct elf_link_hash_table elf; + + /* The stub hash table. */ + struct bfd_hash_table stub_hash_table; + + /* Shortcuts to overlay sections. */ + asection *stub; + asection *ovtab; + + struct elf_link_hash_entry *ovly_load; + + /* An array of two output sections per overlay region, chosen such that + the first section vma is the overlay buffer vma (ie. the section has + the lowest vma in the group that occupy the region), and the second + section vma+size specifies the end of the region. We keep pointers + to sections like this because section vmas may change when laying + them out. */ + asection **ovl_region; + + /* Number of overlay buffers. */ + unsigned int num_buf; + + /* Total number of overlays. */ + unsigned int num_overlays; + + /* Set if we should emit symbols for stubs. */ + unsigned int emit_stub_syms:1; + + /* Set if we want stubs on calls out of overlay regions to + non-overlay regions. */ + unsigned int non_overlay_stubs : 1; + + /* Set on error. */ + unsigned int stub_overflow : 1; + + /* Set if stack size analysis should be done. */ + unsigned int stack_analysis : 1; + + /* Set if __stack_* syms will be emitted. */ + unsigned int emit_stack_syms : 1; +}; + +#define spu_hash_table(p) \ + ((struct spu_link_hash_table *) ((p)->hash)) + +struct spu_stub_hash_entry +{ + struct bfd_hash_entry root; + + /* Destination of this stub. */ + asection *target_section; + bfd_vma target_off; + + /* Offset of entry in stub section. */ + bfd_vma off; + + /* Offset from this stub to stub that loads the overlay index. */ + bfd_vma delta; +}; + +/* Create an entry in a spu stub hash table. */ + +static struct bfd_hash_entry * +stub_hash_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, + const char *string) +{ + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (entry == NULL) + { + entry = bfd_hash_allocate (table, sizeof (struct spu_stub_hash_entry)); + if (entry == NULL) + return entry; + } + + /* Call the allocation method of the superclass. */ + entry = bfd_hash_newfunc (entry, table, string); + if (entry != NULL) + { + struct spu_stub_hash_entry *sh = (struct spu_stub_hash_entry *) entry; + + sh->target_section = NULL; + sh->target_off = 0; + sh->off = 0; + sh->delta = 0; + } + + return entry; +} + +/* Create a spu ELF linker hash table. */ + +static struct bfd_link_hash_table * +spu_elf_link_hash_table_create (bfd *abfd) +{ + struct spu_link_hash_table *htab; + + htab = bfd_malloc (sizeof (*htab)); + if (htab == NULL) + return NULL; + + if (!_bfd_elf_link_hash_table_init (&htab->elf, abfd, + _bfd_elf_link_hash_newfunc, + sizeof (struct elf_link_hash_entry))) + { + free (htab); + return NULL; + } + + /* Init the stub hash table too. */ + if (!bfd_hash_table_init (&htab->stub_hash_table, stub_hash_newfunc, + sizeof (struct spu_stub_hash_entry))) + return NULL; + + memset (&htab->stub, 0, + sizeof (*htab) - offsetof (struct spu_link_hash_table, stub)); + + return &htab->elf.root; +} + +/* Free the derived linker hash table. */ + +static void +spu_elf_link_hash_table_free (struct bfd_link_hash_table *hash) +{ + struct spu_link_hash_table *ret = (struct spu_link_hash_table *) hash; + + bfd_hash_table_free (&ret->stub_hash_table); + _bfd_generic_link_hash_table_free (hash); +} + +/* Find the symbol for the given R_SYMNDX in IBFD and set *HP and *SYMP + to (hash, NULL) for global symbols, and (NULL, sym) for locals. Set + *SYMSECP to the symbol's section. *LOCSYMSP caches local syms. */ + +static bfd_boolean +get_sym_h (struct elf_link_hash_entry **hp, + Elf_Internal_Sym **symp, + asection **symsecp, + Elf_Internal_Sym **locsymsp, + unsigned long r_symndx, + bfd *ibfd) +{ + Elf_Internal_Shdr *symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; + + if (r_symndx >= symtab_hdr->sh_info) + { + struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (ibfd); + struct elf_link_hash_entry *h; + + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + if (hp != NULL) + *hp = h; + + if (symp != NULL) + *symp = NULL; + + if (symsecp != NULL) + { + asection *symsec = NULL; + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + symsec = h->root.u.def.section; + *symsecp = symsec; + } + } + else + { + Elf_Internal_Sym *sym; + Elf_Internal_Sym *locsyms = *locsymsp; + + if (locsyms == NULL) + { + locsyms = (Elf_Internal_Sym *) symtab_hdr->contents; + if (locsyms == NULL) + { + size_t symcount = symtab_hdr->sh_info; + + /* If we are reading symbols into the contents, then + read the global syms too. This is done to cache + syms for later stack analysis. */ + if ((unsigned char **) locsymsp == &symtab_hdr->contents) + symcount = symtab_hdr->sh_size / symtab_hdr->sh_entsize; + locsyms = bfd_elf_get_elf_syms (ibfd, symtab_hdr, symcount, 0, + NULL, NULL, NULL); + } + if (locsyms == NULL) + return FALSE; + *locsymsp = locsyms; + } + sym = locsyms + r_symndx; + + if (hp != NULL) + *hp = NULL; + + if (symp != NULL) + *symp = sym; + + if (symsecp != NULL) + { + asection *symsec = NULL; + if ((sym->st_shndx != SHN_UNDEF + && sym->st_shndx < SHN_LORESERVE) + || sym->st_shndx > SHN_HIRESERVE) + symsec = bfd_section_from_elf_index (ibfd, sym->st_shndx); + *symsecp = symsec; + } + } + + return TRUE; +} + +/* Build a name for an entry in the stub hash table. We can't use a + local symbol name because ld -r might generate duplicate local symbols. */ + +static char * +spu_stub_name (const asection *sym_sec, + const struct elf_link_hash_entry *h, + const Elf_Internal_Rela *rel) +{ + char *stub_name; + bfd_size_type len; + + if (h) + { + len = strlen (h->root.root.string) + 1 + 8 + 1; + stub_name = bfd_malloc (len); + if (stub_name == NULL) + return stub_name; + + sprintf (stub_name, "%s+%x", + h->root.root.string, + (int) rel->r_addend & 0xffffffff); + len -= 8; + } + else + { + len = 8 + 1 + 8 + 1 + 8 + 1; + stub_name = bfd_malloc (len); + if (stub_name == NULL) + return stub_name; + + sprintf (stub_name, "%x:%x+%x", + sym_sec->id & 0xffffffff, + (int) ELF32_R_SYM (rel->r_info) & 0xffffffff, + (int) rel->r_addend & 0xffffffff); + len = strlen (stub_name); + } + + if (stub_name[len - 2] == '+' + && stub_name[len - 1] == '0' + && stub_name[len] == 0) + stub_name[len - 2] = 0; + + return stub_name; +} + +/* Create the note section if not already present. This is done early so + that the linker maps the sections to the right place in the output. */ + +bfd_boolean +spu_elf_create_sections (bfd *output_bfd, + struct bfd_link_info *info, + int stack_analysis, + int emit_stack_syms) +{ + bfd *ibfd; + struct spu_link_hash_table *htab = spu_hash_table (info); + + /* Stash some options away where we can get at them later. */ + htab->stack_analysis = stack_analysis; + htab->emit_stack_syms = emit_stack_syms; + + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + if (bfd_get_section_by_name (ibfd, SPU_PTNOTE_SPUNAME) != NULL) + break; + + if (ibfd == NULL) + { + /* Make SPU_PTNOTE_SPUNAME section. */ + asection *s; + size_t name_len; + size_t size; + bfd_byte *data; + flagword flags; + + ibfd = info->input_bfds; + flags = SEC_LOAD | SEC_READONLY | SEC_HAS_CONTENTS | SEC_IN_MEMORY; + s = bfd_make_section_anyway_with_flags (ibfd, SPU_PTNOTE_SPUNAME, flags); + if (s == NULL + || !bfd_set_section_alignment (ibfd, s, 4)) + return FALSE; + + name_len = strlen (bfd_get_filename (output_bfd)) + 1; + size = 12 + ((sizeof (SPU_PLUGIN_NAME) + 3) & -4); + size += (name_len + 3) & -4; + + if (!bfd_set_section_size (ibfd, s, size)) + return FALSE; + + data = bfd_zalloc (ibfd, size); + if (data == NULL) + return FALSE; + + bfd_put_32 (ibfd, sizeof (SPU_PLUGIN_NAME), data + 0); + bfd_put_32 (ibfd, name_len, data + 4); + bfd_put_32 (ibfd, 1, data + 8); + memcpy (data + 12, SPU_PLUGIN_NAME, sizeof (SPU_PLUGIN_NAME)); + memcpy (data + 12 + ((sizeof (SPU_PLUGIN_NAME) + 3) & -4), + bfd_get_filename (output_bfd), name_len); + s->contents = data; + } + + return TRUE; +} + +/* qsort predicate to sort sections by vma. */ + +static int +sort_sections (const void *a, const void *b) +{ + const asection *const *s1 = a; + const asection *const *s2 = b; + bfd_signed_vma delta = (*s1)->vma - (*s2)->vma; + + if (delta != 0) + return delta < 0 ? -1 : 1; + + return (*s1)->index - (*s2)->index; +} + +/* Identify overlays in the output bfd, and number them. */ + +bfd_boolean +spu_elf_find_overlays (bfd *output_bfd, struct bfd_link_info *info) +{ + struct spu_link_hash_table *htab = spu_hash_table (info); + asection **alloc_sec; + unsigned int i, n, ovl_index, num_buf; + asection *s; + bfd_vma ovl_end; + + if (output_bfd->section_count < 2) + return FALSE; + + alloc_sec = bfd_malloc (output_bfd->section_count * sizeof (*alloc_sec)); + if (alloc_sec == NULL) + return FALSE; + + /* Pick out all the alloced sections. */ + for (n = 0, s = output_bfd->sections; s != NULL; s = s->next) + if ((s->flags & SEC_ALLOC) != 0 + && (s->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != SEC_THREAD_LOCAL + && s->size != 0) + alloc_sec[n++] = s; + + if (n == 0) + { + free (alloc_sec); + return FALSE; + } + + /* Sort them by vma. */ + qsort (alloc_sec, n, sizeof (*alloc_sec), sort_sections); + + /* Look for overlapping vmas. Any with overlap must be overlays. + Count them. Also count the number of overlay regions and for + each region save a section from that region with the lowest vma + and another section with the highest end vma. */ + ovl_end = alloc_sec[0]->vma + alloc_sec[0]->size; + for (ovl_index = 0, num_buf = 0, i = 1; i < n; i++) + { + s = alloc_sec[i]; + if (s->vma < ovl_end) + { + asection *s0 = alloc_sec[i - 1]; + + if (spu_elf_section_data (s0)->ovl_index == 0) + { + spu_elf_section_data (s0)->ovl_index = ++ovl_index; + alloc_sec[num_buf * 2] = s0; + alloc_sec[num_buf * 2 + 1] = s0; + num_buf++; + } + spu_elf_section_data (s)->ovl_index = ++ovl_index; + if (ovl_end < s->vma + s->size) + { + ovl_end = s->vma + s->size; + alloc_sec[num_buf * 2 - 1] = s; + } + } + else + ovl_end = s->vma + s->size; + } + + htab->num_overlays = ovl_index; + htab->num_buf = num_buf; + if (ovl_index == 0) + { + free (alloc_sec); + return FALSE; + } + + alloc_sec = bfd_realloc (alloc_sec, num_buf * 2 * sizeof (*alloc_sec)); + if (alloc_sec == NULL) + return FALSE; + + htab->ovl_region = alloc_sec; + return TRUE; +} + +/* One of these per stub. */ +#define SIZEOF_STUB1 8 +#define ILA_79 0x4200004f /* ila $79,function_address */ +#define BR 0x32000000 /* br stub2 */ + +/* One of these per overlay. */ +#define SIZEOF_STUB2 8 +#define ILA_78 0x4200004e /* ila $78,overlay_number */ + /* br __ovly_load */ +#define NOP 0x40200000 + +/* Return true for all relative and absolute branch instructions. + bra 00110000 0.. + brasl 00110001 0.. + br 00110010 0.. + brsl 00110011 0.. + brz 00100000 0.. + brnz 00100001 0.. + brhz 00100010 0.. + brhnz 00100011 0.. */ + +static bfd_boolean +is_branch (const unsigned char *insn) +{ + return (insn[0] & 0xec) == 0x20 && (insn[1] & 0x80) == 0; +} + +/* Return true for branch hint instructions. + hbra 0001000.. + hbrr 0001001.. */ + +static bfd_boolean +is_hint (const unsigned char *insn) +{ + return (insn[0] & 0xfc) == 0x10; +} + +/* Return TRUE if this reloc symbol should possibly go via an overlay stub. */ + +static bfd_boolean +needs_ovl_stub (const char *sym_name, + asection *sym_sec, + asection *input_section, + struct spu_link_hash_table *htab, + bfd_boolean is_branch) +{ + if (htab->num_overlays == 0) + return FALSE; + + if (sym_sec == NULL + || sym_sec->output_section == NULL + || spu_elf_section_data (sym_sec->output_section) == NULL) + return FALSE; + + /* setjmp always goes via an overlay stub, because then the return + and hence the longjmp goes via __ovly_return. That magically + makes setjmp/longjmp between overlays work. */ + if (strncmp (sym_name, "setjmp", 6) == 0 + && (sym_name[6] == '\0' || sym_name[6] == '@')) + return TRUE; + + /* Usually, symbols in non-overlay sections don't need stubs. */ + if (spu_elf_section_data (sym_sec->output_section)->ovl_index == 0 + && !htab->non_overlay_stubs) + return FALSE; + + /* A reference from some other section to a symbol in an overlay + section needs a stub. */ + if (spu_elf_section_data (sym_sec->output_section)->ovl_index + != spu_elf_section_data (input_section->output_section)->ovl_index) + return TRUE; + + /* If this insn isn't a branch then we are possibly taking the + address of a function and passing it out somehow. */ + return !is_branch; +} + +struct stubarr { + struct bfd_hash_table *stub_hash_table; + struct spu_stub_hash_entry **sh; + unsigned int count; + int err; +}; + +/* Called via elf_link_hash_traverse to allocate stubs for any _SPUEAR_ + symbols. */ + +static bfd_boolean +allocate_spuear_stubs (struct elf_link_hash_entry *h, void *inf) +{ + /* Symbols starting with _SPUEAR_ need a stub because they may be + invoked by the PPU. */ + if ((h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && h->def_regular + && strncmp (h->root.root.string, "_SPUEAR_", 8) == 0) + { + struct stubarr *stubs = inf; + static Elf_Internal_Rela zero_rel; + char *stub_name = spu_stub_name (h->root.u.def.section, h, &zero_rel); + struct spu_stub_hash_entry *sh; + + if (stub_name == NULL) + { + stubs->err = 1; + return FALSE; + } + + sh = (struct spu_stub_hash_entry *) + bfd_hash_lookup (stubs->stub_hash_table, stub_name, TRUE, FALSE); + if (sh == NULL) + { + free (stub_name); + return FALSE; + } + + /* If this entry isn't new, we already have a stub. */ + if (sh->target_section != NULL) + { + free (stub_name); + return TRUE; + } + + sh->target_section = h->root.u.def.section; + sh->target_off = h->root.u.def.value; + stubs->count += 1; + } + + return TRUE; +} + +/* Called via bfd_hash_traverse to set up pointers to all symbols + in the stub hash table. */ + +static bfd_boolean +populate_stubs (struct bfd_hash_entry *bh, void *inf) +{ + struct stubarr *stubs = inf; + + stubs->sh[--stubs->count] = (struct spu_stub_hash_entry *) bh; + return TRUE; +} + +/* qsort predicate to sort stubs by overlay number. */ + +static int +sort_stubs (const void *a, const void *b) +{ + const struct spu_stub_hash_entry *const *sa = a; + const struct spu_stub_hash_entry *const *sb = b; + int i; + bfd_signed_vma d; + + i = spu_elf_section_data ((*sa)->target_section->output_section)->ovl_index; + i -= spu_elf_section_data ((*sb)->target_section->output_section)->ovl_index; + if (i != 0) + return i; + + d = ((*sa)->target_section->output_section->vma + + (*sa)->target_section->output_offset + + (*sa)->target_off + - (*sb)->target_section->output_section->vma + - (*sb)->target_section->output_offset + - (*sb)->target_off); + if (d != 0) + return d < 0 ? -1 : 1; + + /* Two functions at the same address. Aliases perhaps. */ + i = strcmp ((*sb)->root.string, (*sa)->root.string); + BFD_ASSERT (i != 0); + return i; +} + +/* Allocate space for overlay call and return stubs. */ + +bfd_boolean +spu_elf_size_stubs (bfd *output_bfd, + struct bfd_link_info *info, + int non_overlay_stubs, + int stack_analysis, + asection **stub, + asection **ovtab, + asection **toe) +{ + struct spu_link_hash_table *htab = spu_hash_table (info); + bfd *ibfd; + struct stubarr stubs; + unsigned i, group; + flagword flags; + + htab->non_overlay_stubs = non_overlay_stubs; + stubs.stub_hash_table = &htab->stub_hash_table; + stubs.count = 0; + stubs.err = 0; + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + { + extern const bfd_target bfd_elf32_spu_vec; + Elf_Internal_Shdr *symtab_hdr; + asection *section; + Elf_Internal_Sym *local_syms = NULL; + void *psyms; + + if (ibfd->xvec != &bfd_elf32_spu_vec) + continue; + + /* We'll need the symbol table in a second. */ + symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; + if (symtab_hdr->sh_info == 0) + continue; + + /* Arrange to read and keep global syms for later stack analysis. */ + psyms = &local_syms; + if (stack_analysis) + psyms = &symtab_hdr->contents; + + /* Walk over each section attached to the input bfd. */ + for (section = ibfd->sections; section != NULL; section = section->next) + { + Elf_Internal_Rela *internal_relocs, *irelaend, *irela; + + /* If there aren't any relocs, then there's nothing more to do. */ + if ((section->flags & SEC_RELOC) == 0 + || (section->flags & SEC_ALLOC) == 0 + || (section->flags & SEC_LOAD) == 0 + || section->reloc_count == 0) + continue; + + /* If this section is a link-once section that will be + discarded, then don't create any stubs. */ + if (section->output_section == NULL + || section->output_section->owner != output_bfd) + continue; + + /* Get the relocs. */ + internal_relocs + = _bfd_elf_link_read_relocs (ibfd, section, NULL, NULL, + info->keep_memory); + if (internal_relocs == NULL) + goto error_ret_free_local; + + /* Now examine each relocation. */ + irela = internal_relocs; + irelaend = irela + section->reloc_count; + for (; irela < irelaend; irela++) + { + enum elf_spu_reloc_type r_type; + unsigned int r_indx; + asection *sym_sec; + Elf_Internal_Sym *sym; + struct elf_link_hash_entry *h; + const char *sym_name; + char *stub_name; + struct spu_stub_hash_entry *sh; + unsigned int sym_type; + enum _insn_type { non_branch, branch, call } insn_type; + + r_type = ELF32_R_TYPE (irela->r_info); + r_indx = ELF32_R_SYM (irela->r_info); + + if (r_type >= R_SPU_max) + { + bfd_set_error (bfd_error_bad_value); + goto error_ret_free_internal; + } + + /* Determine the reloc target section. */ + if (!get_sym_h (&h, &sym, &sym_sec, psyms, r_indx, ibfd)) + goto error_ret_free_internal; + + if (sym_sec == NULL + || sym_sec->output_section == NULL + || sym_sec->output_section->owner != output_bfd) + continue; + + /* Ensure no stubs for user supplied overlay manager syms. */ + if (h != NULL + && (strcmp (h->root.root.string, "__ovly_load") == 0 + || strcmp (h->root.root.string, "__ovly_return") == 0)) + continue; + + insn_type = non_branch; + if (r_type == R_SPU_REL16 + || r_type == R_SPU_ADDR16) + { + unsigned char insn[4]; + + if (!bfd_get_section_contents (ibfd, section, insn, + irela->r_offset, 4)) + goto error_ret_free_internal; + + if (is_branch (insn) || is_hint (insn)) + { + insn_type = branch; + if ((insn[0] & 0xfd) == 0x31) + insn_type = call; + } + } + + /* We are only interested in function symbols. */ + if (h != NULL) + { + sym_type = h->type; + sym_name = h->root.root.string; + } + else + { + sym_type = ELF_ST_TYPE (sym->st_info); + sym_name = bfd_elf_sym_name (sym_sec->owner, + symtab_hdr, + sym, + sym_sec); + } + if (sym_type != STT_FUNC) + { + /* It's common for people to write assembly and forget + to give function symbols the right type. Handle + calls to such symbols, but warn so that (hopefully) + people will fix their code. We need the symbol + type to be correct to distinguish function pointer + initialisation from other pointer initialisation. */ + if (insn_type == call) + (*_bfd_error_handler) (_("warning: call to non-function" + " symbol %s defined in %B"), + sym_sec->owner, sym_name); + else + continue; + } + + if (!needs_ovl_stub (sym_name, sym_sec, section, htab, + insn_type != non_branch)) + continue; + + stub_name = spu_stub_name (sym_sec, h, irela); + if (stub_name == NULL) + goto error_ret_free_internal; + + sh = (struct spu_stub_hash_entry *) + bfd_hash_lookup (&htab->stub_hash_table, stub_name, + TRUE, FALSE); + if (sh == NULL) + { + free (stub_name); + error_ret_free_internal: + if (elf_section_data (section)->relocs != internal_relocs) + free (internal_relocs); + error_ret_free_local: + if (local_syms != NULL + && (symtab_hdr->contents + != (unsigned char *) local_syms)) + free (local_syms); + return FALSE; + } + + /* If this entry isn't new, we already have a stub. */ + if (sh->target_section != NULL) + { + free (stub_name); + continue; + } + + sh->target_section = sym_sec; + if (h != NULL) + sh->target_off = h->root.u.def.value; + else + sh->target_off = sym->st_value; + sh->target_off += irela->r_addend; + + stubs.count += 1; + } + + /* We're done with the internal relocs, free them. */ + if (elf_section_data (section)->relocs != internal_relocs) + free (internal_relocs); + } + + if (local_syms != NULL + && symtab_hdr->contents != (unsigned char *) local_syms) + { + if (!info->keep_memory) + free (local_syms); + else + symtab_hdr->contents = (unsigned char *) local_syms; + } + } + + elf_link_hash_traverse (&htab->elf, allocate_spuear_stubs, &stubs); + if (stubs.err) + return FALSE; + + *stub = NULL; + if (stubs.count == 0) + return TRUE; + + ibfd = info->input_bfds; + flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_READONLY + | SEC_HAS_CONTENTS | SEC_IN_MEMORY); + htab->stub = bfd_make_section_anyway_with_flags (ibfd, ".stub", flags); + *stub = htab->stub; + if (htab->stub == NULL + || !bfd_set_section_alignment (ibfd, htab->stub, 2)) + return FALSE; + + flags = (SEC_ALLOC | SEC_LOAD + | SEC_HAS_CONTENTS | SEC_IN_MEMORY); + htab->ovtab = bfd_make_section_anyway_with_flags (ibfd, ".ovtab", flags); + *ovtab = htab->ovtab; + if (htab->ovtab == NULL + || !bfd_set_section_alignment (ibfd, htab->stub, 4)) + return FALSE; + + *toe = bfd_make_section_anyway_with_flags (ibfd, ".toe", SEC_ALLOC); + if (*toe == NULL + || !bfd_set_section_alignment (ibfd, *toe, 4)) + return FALSE; + (*toe)->size = 16; + + /* Retrieve all the stubs and sort. */ + stubs.sh = bfd_malloc (stubs.count * sizeof (*stubs.sh)); + if (stubs.sh == NULL) + return FALSE; + i = stubs.count; + bfd_hash_traverse (&htab->stub_hash_table, populate_stubs, &stubs); + BFD_ASSERT (stubs.count == 0); + + stubs.count = i; + qsort (stubs.sh, stubs.count, sizeof (*stubs.sh), sort_stubs); + + /* Now that the stubs are sorted, place them in the stub section. + Stubs are grouped per overlay + . ila $79,func1 + . br 1f + . ila $79,func2 + . br 1f + . + . + . ila $79,funcn + . nop + . 1: + . ila $78,ovl_index + . br __ovly_load */ + + group = 0; + for (i = 0; i < stubs.count; i++) + { + if (spu_elf_section_data (stubs.sh[group]->target_section + ->output_section)->ovl_index + != spu_elf_section_data (stubs.sh[i]->target_section + ->output_section)->ovl_index) + { + htab->stub->size += SIZEOF_STUB2; + for (; group != i; group++) + stubs.sh[group]->delta + = stubs.sh[i - 1]->off - stubs.sh[group]->off; + } + if (group == i + || ((stubs.sh[i - 1]->target_section->output_section->vma + + stubs.sh[i - 1]->target_section->output_offset + + stubs.sh[i - 1]->target_off) + != (stubs.sh[i]->target_section->output_section->vma + + stubs.sh[i]->target_section->output_offset + + stubs.sh[i]->target_off))) + { + stubs.sh[i]->off = htab->stub->size; + htab->stub->size += SIZEOF_STUB1; + } + else + stubs.sh[i]->off = stubs.sh[i - 1]->off; + } + if (group != i) + htab->stub->size += SIZEOF_STUB2; + for (; group != i; group++) + stubs.sh[group]->delta = stubs.sh[i - 1]->off - stubs.sh[group]->off; + + /* htab->ovtab consists of two arrays. + . struct { + . u32 vma; + . u32 size; + . u32 file_off; + . u32 buf; + . } _ovly_table[]; + . + . struct { + . u32 mapped; + . } _ovly_buf_table[]; */ + + htab->ovtab->alignment_power = 4; + htab->ovtab->size = htab->num_overlays * 16 + htab->num_buf * 4; + + return TRUE; +} + +/* Functions to handle embedded spu_ovl.o object. */ + +static void * +ovl_mgr_open (struct bfd *nbfd ATTRIBUTE_UNUSED, void *stream) +{ + return stream; +} + +static file_ptr +ovl_mgr_pread (struct bfd *abfd ATTRIBUTE_UNUSED, + void *stream, + void *buf, + file_ptr nbytes, + file_ptr offset) +{ + struct _ovl_stream *os; + size_t count; + size_t max; + + os = (struct _ovl_stream *) stream; + max = (const char *) os->end - (const char *) os->start; + + if ((ufile_ptr) offset >= max) + return 0; + + count = nbytes; + if (count > max - offset) + count = max - offset; + + memcpy (buf, (const char *) os->start + offset, count); + return count; +} + +bfd_boolean +spu_elf_open_builtin_lib (bfd **ovl_bfd, const struct _ovl_stream *stream) +{ + *ovl_bfd = bfd_openr_iovec ("builtin ovl_mgr", + "elf32-spu", + ovl_mgr_open, + (void *) stream, + ovl_mgr_pread, + NULL, + NULL); + return *ovl_bfd != NULL; +} + +/* Fill in the ila and br for a stub. On the last stub for a group, + write the stub that sets the overlay number too. */ + +static bfd_boolean +write_one_stub (struct bfd_hash_entry *bh, void *inf) +{ + struct spu_stub_hash_entry *ent = (struct spu_stub_hash_entry *) bh; + struct spu_link_hash_table *htab = inf; + asection *sec = htab->stub; + asection *s = ent->target_section; + unsigned int ovl; + bfd_vma val; + + val = ent->target_off + s->output_offset + s->output_section->vma; + bfd_put_32 (sec->owner, ILA_79 + ((val << 7) & 0x01ffff80), + sec->contents + ent->off); + val = ent->delta + 4; + bfd_put_32 (sec->owner, BR + ((val << 5) & 0x007fff80), + sec->contents + ent->off + 4); + + /* If this is the last stub of this group, write stub2. */ + if (ent->delta == 0) + { + bfd_put_32 (sec->owner, NOP, + sec->contents + ent->off + 4); + + ovl = spu_elf_section_data (s->output_section)->ovl_index; + bfd_put_32 (sec->owner, ILA_78 + ((ovl << 7) & 0x01ffff80), + sec->contents + ent->off + 8); + + val = (htab->ovly_load->root.u.def.section->output_section->vma + + htab->ovly_load->root.u.def.section->output_offset + + htab->ovly_load->root.u.def.value + - (sec->output_section->vma + + sec->output_offset + + ent->off + 12)); + + if (val + 0x20000 >= 0x40000) + htab->stub_overflow = TRUE; + + bfd_put_32 (sec->owner, BR + ((val << 5) & 0x007fff80), + sec->contents + ent->off + 12); + } + + if (htab->emit_stub_syms) + { + struct elf_link_hash_entry *h; + size_t len1, len2; + char *name; + + len1 = sizeof ("00000000.ovl_call.") - 1; + len2 = strlen (ent->root.string); + name = bfd_malloc (len1 + len2 + 1); + if (name == NULL) + return FALSE; + memcpy (name, "00000000.ovl_call.", len1); + memcpy (name + len1, ent->root.string, len2 + 1); + h = elf_link_hash_lookup (&htab->elf, name, TRUE, TRUE, FALSE); + free (name); + if (h == NULL) + return FALSE; + if (h->root.type == bfd_link_hash_new) + { + h->root.type = bfd_link_hash_defined; + h->root.u.def.section = sec; + h->root.u.def.value = ent->off; + h->size = (ent->delta == 0 + ? SIZEOF_STUB1 + SIZEOF_STUB2 : SIZEOF_STUB1); + h->type = STT_FUNC; + h->ref_regular = 1; + h->def_regular = 1; + h->ref_regular_nonweak = 1; + h->forced_local = 1; + h->non_elf = 0; + } + } + + return TRUE; +} + +/* Define an STT_OBJECT symbol. */ + +static struct elf_link_hash_entry * +define_ovtab_symbol (struct spu_link_hash_table *htab, const char *name) +{ + struct elf_link_hash_entry *h; + + h = elf_link_hash_lookup (&htab->elf, name, TRUE, FALSE, FALSE); + if (h == NULL) + return NULL; + + if (h->root.type != bfd_link_hash_defined + || !h->def_regular) + { + h->root.type = bfd_link_hash_defined; + h->root.u.def.section = htab->ovtab; + h->type = STT_OBJECT; + h->ref_regular = 1; + h->def_regular = 1; + h->ref_regular_nonweak = 1; + h->non_elf = 0; + } + else + { + (*_bfd_error_handler) (_("%B is not allowed to define %s"), + h->root.u.def.section->owner, + h->root.root.string); + bfd_set_error (bfd_error_bad_value); + return NULL; + } + + return h; +} + +/* Fill in all stubs and the overlay tables. */ + +bfd_boolean +spu_elf_build_stubs (struct bfd_link_info *info, int emit_syms, asection *toe) +{ + struct spu_link_hash_table *htab = spu_hash_table (info); + struct elf_link_hash_entry *h; + bfd_byte *p; + asection *s; + bfd *obfd; + unsigned int i; + + htab->emit_stub_syms = emit_syms; + htab->stub->contents = bfd_zalloc (htab->stub->owner, htab->stub->size); + if (htab->stub->contents == NULL) + return FALSE; + + h = elf_link_hash_lookup (&htab->elf, "__ovly_load", FALSE, FALSE, FALSE); + htab->ovly_load = h; + BFD_ASSERT (h != NULL + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && h->def_regular); + + s = h->root.u.def.section->output_section; + if (spu_elf_section_data (s)->ovl_index) + { + (*_bfd_error_handler) (_("%s in overlay section"), + h->root.u.def.section->owner); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + /* Write out all the stubs. */ + bfd_hash_traverse (&htab->stub_hash_table, write_one_stub, htab); + + if (htab->stub_overflow) + { + (*_bfd_error_handler) (_("overlay stub relocation overflow")); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + htab->ovtab->contents = bfd_zalloc (htab->ovtab->owner, htab->ovtab->size); + if (htab->ovtab->contents == NULL) + return FALSE; + + /* Write out _ovly_table. */ + p = htab->ovtab->contents; + obfd = htab->ovtab->output_section->owner; + for (s = obfd->sections; s != NULL; s = s->next) + { + unsigned int ovl_index = spu_elf_section_data (s)->ovl_index; + + if (ovl_index != 0) + { + unsigned int lo, hi, mid; + unsigned long off = (ovl_index - 1) * 16; + bfd_put_32 (htab->ovtab->owner, s->vma, p + off); + bfd_put_32 (htab->ovtab->owner, (s->size + 15) & -16, p + off + 4); + /* file_off written later in spu_elf_modify_program_headers. */ + + lo = 0; + hi = htab->num_buf; + while (lo < hi) + { + mid = (lo + hi) >> 1; + if (htab->ovl_region[2 * mid + 1]->vma + + htab->ovl_region[2 * mid + 1]->size <= s->vma) + lo = mid + 1; + else if (htab->ovl_region[2 * mid]->vma > s->vma) + hi = mid; + else + { + bfd_put_32 (htab->ovtab->owner, mid + 1, p + off + 12); + break; + } + } + BFD_ASSERT (lo < hi); + } + } + + /* Write out _ovly_buf_table. */ + p = htab->ovtab->contents + htab->num_overlays * 16; + for (i = 0; i < htab->num_buf; i++) + { + bfd_put_32 (htab->ovtab->owner, 0, p); + p += 4; + } + + h = define_ovtab_symbol (htab, "_ovly_table"); + if (h == NULL) + return FALSE; + h->root.u.def.value = 0; + h->size = htab->num_overlays * 16; + + h = define_ovtab_symbol (htab, "_ovly_table_end"); + if (h == NULL) + return FALSE; + h->root.u.def.value = htab->num_overlays * 16; + h->size = 0; + + h = define_ovtab_symbol (htab, "_ovly_buf_table"); + if (h == NULL) + return FALSE; + h->root.u.def.value = htab->num_overlays * 16; + h->size = htab->num_buf * 4; + + h = define_ovtab_symbol (htab, "_ovly_buf_table_end"); + if (h == NULL) + return FALSE; + h->root.u.def.value = htab->num_overlays * 16 + htab->num_buf * 4; + h->size = 0; + + h = define_ovtab_symbol (htab, "_EAR_"); + if (h == NULL) + return FALSE; + h->root.u.def.section = toe; + h->root.u.def.value = 0; + h->size = 16; + + return TRUE; +} + +/* OFFSET in SEC (presumably) is the beginning of a function prologue. + Search for stack adjusting insns, and return the sp delta. */ + +static int +find_function_stack_adjust (asection *sec, bfd_vma offset) +{ + int unrecog; + int reg[128]; + + memset (reg, 0, sizeof (reg)); + for (unrecog = 0; offset + 4 <= sec->size && unrecog < 32; offset += 4) + { + unsigned char buf[4]; + int rt, ra; + int imm; + + /* Assume no relocs on stack adjusing insns. */ + if (!bfd_get_section_contents (sec->owner, sec, buf, offset, 4)) + break; + + if (buf[0] == 0x24 /* stqd */) + continue; + + rt = buf[3] & 0x7f; + ra = ((buf[2] & 0x3f) << 1) | (buf[3] >> 7); + /* Partly decoded immediate field. */ + imm = (buf[1] << 9) | (buf[2] << 1) | (buf[3] >> 7); + + if (buf[0] == 0x1c /* ai */) + { + imm >>= 7; + imm = (imm ^ 0x200) - 0x200; + reg[rt] = reg[ra] + imm; + + if (rt == 1 /* sp */) + { + if (imm > 0) + break; + return reg[rt]; + } + } + else if (buf[0] == 0x18 && (buf[1] & 0xe0) == 0 /* a */) + { + int rb = ((buf[1] & 0x1f) << 2) | ((buf[2] & 0xc0) >> 6); + + reg[rt] = reg[ra] + reg[rb]; + if (rt == 1) + return reg[rt]; + } + else if ((buf[0] & 0xfc) == 0x40 /* il, ilh, ilhu, ila */) + { + if (buf[0] >= 0x42 /* ila */) + imm |= (buf[0] & 1) << 17; + else + { + imm &= 0xffff; + + if (buf[0] == 0x40 /* il */) + { + if ((buf[1] & 0x80) == 0) + goto unknown_insn; + imm = (imm ^ 0x8000) - 0x8000; + } + else if ((buf[1] & 0x80) == 0 /* ilhu */) + imm <<= 16; + } + reg[rt] = imm; + continue; + } + else if (buf[0] == 0x60 && (buf[1] & 0x80) != 0 /* iohl */) + { + reg[rt] |= imm & 0xffff; + continue; + } + else if (buf[0] == 0x04 /* ori */) + { + imm >>= 7; + imm = (imm ^ 0x200) - 0x200; + reg[rt] = reg[ra] | imm; + continue; + } + else if ((buf[0] == 0x33 && imm == 1 /* brsl .+4 */) + || (buf[0] == 0x08 && (buf[1] & 0xe0) == 0 /* sf */)) + { + /* Used in pic reg load. Say rt is trashed. */ + reg[rt] = 0; + continue; + } + else if (is_branch (buf)) + /* If we hit a branch then we must be out of the prologue. */ + break; + unknown_insn: + ++unrecog; + } + + return 0; +} + +/* qsort predicate to sort symbols by section and value. */ + +static Elf_Internal_Sym *sort_syms_syms; +static asection **sort_syms_psecs; + +static int +sort_syms (const void *a, const void *b) +{ + Elf_Internal_Sym *const *s1 = a; + Elf_Internal_Sym *const *s2 = b; + asection *sec1,*sec2; + bfd_signed_vma delta; + + sec1 = sort_syms_psecs[*s1 - sort_syms_syms]; + sec2 = sort_syms_psecs[*s2 - sort_syms_syms]; + + if (sec1 != sec2) + return sec1->index - sec2->index; + + delta = (*s1)->st_value - (*s2)->st_value; + if (delta != 0) + return delta < 0 ? -1 : 1; + + delta = (*s2)->st_size - (*s1)->st_size; + if (delta != 0) + return delta < 0 ? -1 : 1; + + return *s1 < *s2 ? -1 : 1; +} + +struct call_info +{ + struct function_info *fun; + struct call_info *next; + int is_tail; +}; + +struct function_info +{ + /* List of functions called. Also branches to hot/cold part of + function. */ + struct call_info *call_list; + /* For hot/cold part of function, point to owner. */ + struct function_info *start; + /* Symbol at start of function. */ + union { + Elf_Internal_Sym *sym; + struct elf_link_hash_entry *h; + } u; + /* Function section. */ + asection *sec; + /* Address range of (this part of) function. */ + bfd_vma lo, hi; + /* Stack usage. */ + int stack; + /* Set if global symbol. */ + unsigned int global : 1; + /* Set if known to be start of function (as distinct from a hunk + in hot/cold section. */ + unsigned int is_func : 1; + /* Flags used during call tree traversal. */ + unsigned int visit1 : 1; + unsigned int non_root : 1; + unsigned int visit2 : 1; + unsigned int marking : 1; + unsigned int visit3 : 1; +}; + +struct spu_elf_stack_info +{ + int num_fun; + int max_fun; + /* Variable size array describing functions, one per contiguous + address range belonging to a function. */ + struct function_info fun[1]; +}; + +/* Allocate a struct spu_elf_stack_info with MAX_FUN struct function_info + entries for section SEC. */ + +static struct spu_elf_stack_info * +alloc_stack_info (asection *sec, int max_fun) +{ + struct _spu_elf_section_data *sec_data = spu_elf_section_data (sec); + bfd_size_type amt; + + amt = sizeof (struct spu_elf_stack_info); + amt += (max_fun - 1) * sizeof (struct function_info); + sec_data->stack_info = bfd_zmalloc (amt); + if (sec_data->stack_info != NULL) + sec_data->stack_info->max_fun = max_fun; + return sec_data->stack_info; +} + +/* Add a new struct function_info describing a (part of a) function + starting at SYM_H. Keep the array sorted by address. */ + +static struct function_info * +maybe_insert_function (asection *sec, + void *sym_h, + bfd_boolean global, + bfd_boolean is_func) +{ + struct _spu_elf_section_data *sec_data = spu_elf_section_data (sec); + struct spu_elf_stack_info *sinfo = sec_data->stack_info; + int i; + bfd_vma off, size; + + if (sinfo == NULL) + { + sinfo = alloc_stack_info (sec, 20); + if (sinfo == NULL) + return NULL; + } + + if (!global) + { + Elf_Internal_Sym *sym = sym_h; + off = sym->st_value; + size = sym->st_size; + } + else + { + struct elf_link_hash_entry *h = sym_h; + off = h->root.u.def.value; + size = h->size; + } + + for (i = sinfo->num_fun; --i >= 0; ) + if (sinfo->fun[i].lo <= off) + break; + + if (i >= 0) + { + /* Don't add another entry for an alias, but do update some + info. */ + if (sinfo->fun[i].lo == off) + { + /* Prefer globals over local syms. */ + if (global && !sinfo->fun[i].global) + { + sinfo->fun[i].global = TRUE; + sinfo->fun[i].u.h = sym_h; + } + if (is_func) + sinfo->fun[i].is_func = TRUE; + return &sinfo->fun[i]; + } + /* Ignore a zero-size symbol inside an existing function. */ + else if (sinfo->fun[i].hi > off && size == 0) + return &sinfo->fun[i]; + } + + if (++i < sinfo->num_fun) + memmove (&sinfo->fun[i + 1], &sinfo->fun[i], + (sinfo->num_fun - i) * sizeof (sinfo->fun[i])); + else if (i >= sinfo->max_fun) + { + bfd_size_type amt = sizeof (struct spu_elf_stack_info); + bfd_size_type old = amt; + + old += (sinfo->max_fun - 1) * sizeof (struct function_info); + sinfo->max_fun += 20 + (sinfo->max_fun >> 1); + amt += (sinfo->max_fun - 1) * sizeof (struct function_info); + sinfo = bfd_realloc (sinfo, amt); + if (sinfo == NULL) + return NULL; + memset ((char *) sinfo + old, 0, amt - old); + sec_data->stack_info = sinfo; + } + sinfo->fun[i].is_func = is_func; + sinfo->fun[i].global = global; + sinfo->fun[i].sec = sec; + if (global) + sinfo->fun[i].u.h = sym_h; + else + sinfo->fun[i].u.sym = sym_h; + sinfo->fun[i].lo = off; + sinfo->fun[i].hi = off + size; + sinfo->fun[i].stack = -find_function_stack_adjust (sec, off); + sinfo->num_fun += 1; + return &sinfo->fun[i]; +} + +/* Return the name of FUN. */ + +static const char * +func_name (struct function_info *fun) +{ + asection *sec; + bfd *ibfd; + Elf_Internal_Shdr *symtab_hdr; + + while (fun->start != NULL) + fun = fun->start; + + if (fun->global) + return fun->u.h->root.root.string; + + sec = fun->sec; + if (fun->u.sym->st_name == 0) + { + size_t len = strlen (sec->name); + char *name = bfd_malloc (len + 10); + if (name == NULL) + return "(null)"; + sprintf (name, "%s+%lx", sec->name, + (unsigned long) fun->u.sym->st_value & 0xffffffff); + return name; + } + ibfd = sec->owner; + symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; + return bfd_elf_sym_name (ibfd, symtab_hdr, fun->u.sym, sec); +} + +/* Read the instruction at OFF in SEC. Return true iff the instruction + is a nop, lnop, or stop 0 (all zero insn). */ + +static bfd_boolean +is_nop (asection *sec, bfd_vma off) +{ + unsigned char insn[4]; + + if (off + 4 > sec->size + || !bfd_get_section_contents (sec->owner, sec, insn, off, 4)) + return FALSE; + if ((insn[0] & 0xbf) == 0 && (insn[1] & 0xe0) == 0x20) + return TRUE; + if (insn[0] == 0 && insn[1] == 0 && insn[2] == 0 && insn[3] == 0) + return TRUE; + return FALSE; +} + +/* Extend the range of FUN to cover nop padding up to LIMIT. + Return TRUE iff some instruction other than a NOP was found. */ + +static bfd_boolean +insns_at_end (struct function_info *fun, bfd_vma limit) +{ + bfd_vma off = (fun->hi + 3) & -4; + + while (off < limit && is_nop (fun->sec, off)) + off += 4; + if (off < limit) + { + fun->hi = off; + return TRUE; + } + fun->hi = limit; + return FALSE; +} + +/* Check and fix overlapping function ranges. Return TRUE iff there + are gaps in the current info we have about functions in SEC. */ + +static bfd_boolean +check_function_ranges (asection *sec, struct bfd_link_info *info) +{ + struct _spu_elf_section_data *sec_data = spu_elf_section_data (sec); + struct spu_elf_stack_info *sinfo = sec_data->stack_info; + int i; + bfd_boolean gaps = FALSE; + + if (sinfo == NULL) + return FALSE; + + for (i = 1; i < sinfo->num_fun; i++) + if (sinfo->fun[i - 1].hi > sinfo->fun[i].lo) + { + /* Fix overlapping symbols. */ + const char *f1 = func_name (&sinfo->fun[i - 1]); + const char *f2 = func_name (&sinfo->fun[i]); + + info->callbacks->einfo (_("warning: %s overlaps %s\n"), f1, f2); + sinfo->fun[i - 1].hi = sinfo->fun[i].lo; + } + else if (insns_at_end (&sinfo->fun[i - 1], sinfo->fun[i].lo)) + gaps = TRUE; + + if (sinfo->num_fun == 0) + gaps = TRUE; + else + { + if (sinfo->fun[0].lo != 0) + gaps = TRUE; + if (sinfo->fun[sinfo->num_fun - 1].hi > sec->size) + { + const char *f1 = func_name (&sinfo->fun[sinfo->num_fun - 1]); + + info->callbacks->einfo (_("warning: %s exceeds section size\n"), f1); + sinfo->fun[sinfo->num_fun - 1].hi = sec->size; + } + else if (insns_at_end (&sinfo->fun[sinfo->num_fun - 1], sec->size)) + gaps = TRUE; + } + return gaps; +} + +/* Search current function info for a function that contains address + OFFSET in section SEC. */ + +static struct function_info * +find_function (asection *sec, bfd_vma offset, struct bfd_link_info *info) +{ + struct _spu_elf_section_data *sec_data = spu_elf_section_data (sec); + struct spu_elf_stack_info *sinfo = sec_data->stack_info; + int lo, hi, mid; + + lo = 0; + hi = sinfo->num_fun; + while (lo < hi) + { + mid = (lo + hi) / 2; + if (offset < sinfo->fun[mid].lo) + hi = mid; + else if (offset >= sinfo->fun[mid].hi) + lo = mid + 1; + else + return &sinfo->fun[mid]; + } + info->callbacks->einfo (_("%A:0x%v not found in function table\n"), + sec, offset); + return NULL; +} + +/* Add CALLEE to CALLER call list if not already present. */ + +static bfd_boolean +insert_callee (struct function_info *caller, struct call_info *callee) +{ + struct call_info *p; + for (p = caller->call_list; p != NULL; p = p->next) + if (p->fun == callee->fun) + { + /* Tail calls use less stack than normal calls. Retain entry + for normal call over one for tail call. */ + if (p->is_tail > callee->is_tail) + p->is_tail = callee->is_tail; + return FALSE; + } + callee->next = caller->call_list; + caller->call_list = callee; + return TRUE; +} + +/* Rummage through the relocs for SEC, looking for function calls. + If CALL_TREE is true, fill in call graph. If CALL_TREE is false, + mark destination symbols on calls as being functions. Also + look at branches, which may be tail calls or go to hot/cold + section part of same function. */ + +static bfd_boolean +mark_functions_via_relocs (asection *sec, + struct bfd_link_info *info, + int call_tree) +{ + Elf_Internal_Rela *internal_relocs, *irelaend, *irela; + Elf_Internal_Shdr *symtab_hdr = &elf_tdata (sec->owner)->symtab_hdr; + Elf_Internal_Sym *syms; + void *psyms; + static bfd_boolean warned; + + internal_relocs = _bfd_elf_link_read_relocs (sec->owner, sec, NULL, NULL, + info->keep_memory); + if (internal_relocs == NULL) + return FALSE; + + symtab_hdr = &elf_tdata (sec->owner)->symtab_hdr; + psyms = &symtab_hdr->contents; + syms = *(Elf_Internal_Sym **) psyms; + irela = internal_relocs; + irelaend = irela + sec->reloc_count; + for (; irela < irelaend; irela++) + { + enum elf_spu_reloc_type r_type; + unsigned int r_indx; + asection *sym_sec; + Elf_Internal_Sym *sym; + struct elf_link_hash_entry *h; + bfd_vma val; + unsigned char insn[4]; + bfd_boolean is_call; + struct function_info *caller; + struct call_info *callee; + + r_type = ELF32_R_TYPE (irela->r_info); + if (r_type != R_SPU_REL16 + && r_type != R_SPU_ADDR16) + continue; + + r_indx = ELF32_R_SYM (irela->r_info); + if (!get_sym_h (&h, &sym, &sym_sec, psyms, r_indx, sec->owner)) + return FALSE; + + if (sym_sec == NULL + || sym_sec->output_section == NULL + || sym_sec->output_section->owner != sec->output_section->owner) + continue; + + if (!bfd_get_section_contents (sec->owner, sec, insn, + irela->r_offset, 4)) + return FALSE; + if (!is_branch (insn)) + continue; + + if ((sym_sec->flags & (SEC_ALLOC | SEC_LOAD | SEC_CODE)) + != (SEC_ALLOC | SEC_LOAD | SEC_CODE)) + { + if (!call_tree) + warned = TRUE; + if (!call_tree || !warned) + info->callbacks->einfo (_("%B(%A+0x%v): call to non-code section" + " %B(%A), stack analysis incomplete\n"), + sec->owner, sec, irela->r_offset, + sym_sec->owner, sym_sec); + continue; + } + + is_call = (insn[0] & 0xfd) == 0x31; + + if (h) + val = h->root.u.def.value; + else + val = sym->st_value; + val += irela->r_addend; + + if (!call_tree) + { + struct function_info *fun; + + if (irela->r_addend != 0) + { + Elf_Internal_Sym *fake = bfd_zmalloc (sizeof (*fake)); + if (fake == NULL) + return FALSE; + fake->st_value = val; + fake->st_shndx + = _bfd_elf_section_from_bfd_section (sym_sec->owner, sym_sec); + sym = fake; + } + if (sym) + fun = maybe_insert_function (sym_sec, sym, FALSE, is_call); + else + fun = maybe_insert_function (sym_sec, h, TRUE, is_call); + if (fun == NULL) + return FALSE; + if (irela->r_addend != 0 + && fun->u.sym != sym) + free (sym); + continue; + } + + caller = find_function (sec, irela->r_offset, info); + if (caller == NULL) + return FALSE; + callee = bfd_malloc (sizeof *callee); + if (callee == NULL) + return FALSE; + + callee->fun = find_function (sym_sec, val, info); + if (callee->fun == NULL) + return FALSE; + callee->is_tail = !is_call; + if (!insert_callee (caller, callee)) + free (callee); + else if (!is_call + && !callee->fun->is_func + && callee->fun->stack == 0) + { + /* This is either a tail call or a branch from one part of + the function to another, ie. hot/cold section. If the + destination has been called by some other function then + it is a separate function. We also assume that functions + are not split across input files. */ + if (callee->fun->start != NULL + || sec->owner != sym_sec->owner) + { + callee->fun->start = NULL; + callee->fun->is_func = TRUE; + } + else + callee->fun->start = caller; + } + } + + return TRUE; +} + +/* Handle something like .init or .fini, which has a piece of a function. + These sections are pasted together to form a single function. */ + +static bfd_boolean +pasted_function (asection *sec, struct bfd_link_info *info) +{ + struct bfd_link_order *l; + struct _spu_elf_section_data *sec_data; + struct spu_elf_stack_info *sinfo; + Elf_Internal_Sym *fake; + struct function_info *fun, *fun_start; + + fake = bfd_zmalloc (sizeof (*fake)); + if (fake == NULL) + return FALSE; + fake->st_value = 0; + fake->st_size = sec->size; + fake->st_shndx + = _bfd_elf_section_from_bfd_section (sec->owner, sec); + fun = maybe_insert_function (sec, fake, FALSE, FALSE); + if (!fun) + return FALSE; + + /* Find a function immediately preceding this section. */ + fun_start = NULL; + for (l = sec->output_section->map_head.link_order; l != NULL; l = l->next) + { + if (l->u.indirect.section == sec) + { + if (fun_start != NULL) + { + if (fun_start->start) + fun_start = fun_start->start; + fun->start = fun_start; + } + return TRUE; + } + if (l->type == bfd_indirect_link_order + && (sec_data = spu_elf_section_data (l->u.indirect.section)) != NULL + && (sinfo = sec_data->stack_info) != NULL + && sinfo->num_fun != 0) + fun_start = &sinfo->fun[sinfo->num_fun - 1]; + } + + info->callbacks->einfo (_("%A link_order not found\n"), sec); + return FALSE; +} + +/* We're only interested in code sections. */ + +static bfd_boolean +interesting_section (asection *s, bfd *obfd, struct spu_link_hash_table *htab) +{ + return (s != htab->stub + && s->output_section != NULL + && s->output_section->owner == obfd + && ((s->flags & (SEC_ALLOC | SEC_LOAD | SEC_CODE)) + == (SEC_ALLOC | SEC_LOAD | SEC_CODE)) + && s->size != 0); +} + +/* Map address ranges in code sections to functions. */ + +static bfd_boolean +discover_functions (bfd *output_bfd, struct bfd_link_info *info) +{ + struct spu_link_hash_table *htab = spu_hash_table (info); + bfd *ibfd; + int bfd_idx; + Elf_Internal_Sym ***psym_arr; + asection ***sec_arr; + bfd_boolean gaps = FALSE; + + bfd_idx = 0; + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + bfd_idx++; + + psym_arr = bfd_zmalloc (bfd_idx * sizeof (*psym_arr)); + if (psym_arr == NULL) + return FALSE; + sec_arr = bfd_zmalloc (bfd_idx * sizeof (*sec_arr)); + if (sec_arr == NULL) + return FALSE; + + + for (ibfd = info->input_bfds, bfd_idx = 0; + ibfd != NULL; + ibfd = ibfd->link_next, bfd_idx++) + { + extern const bfd_target bfd_elf32_spu_vec; + Elf_Internal_Shdr *symtab_hdr; + asection *sec; + size_t symcount; + Elf_Internal_Sym *syms, *sy, **psyms, **psy; + asection **psecs, **p; + + if (ibfd->xvec != &bfd_elf32_spu_vec) + continue; + + /* Read all the symbols. */ + symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; + symcount = symtab_hdr->sh_size / symtab_hdr->sh_entsize; + if (symcount == 0) + continue; + + syms = (Elf_Internal_Sym *) symtab_hdr->contents; + if (syms == NULL) + { + syms = bfd_elf_get_elf_syms (ibfd, symtab_hdr, symcount, 0, + NULL, NULL, NULL); + symtab_hdr->contents = (void *) syms; + if (syms == NULL) + return FALSE; + } + + /* Select defined function symbols that are going to be output. */ + psyms = bfd_malloc ((symcount + 1) * sizeof (*psyms)); + if (psyms == NULL) + return FALSE; + psym_arr[bfd_idx] = psyms; + psecs = bfd_malloc (symcount * sizeof (*psecs)); + if (psecs == NULL) + return FALSE; + sec_arr[bfd_idx] = psecs; + for (psy = psyms, p = psecs, sy = syms; sy < syms + symcount; ++p, ++sy) + if (ELF_ST_TYPE (sy->st_info) == STT_NOTYPE + || ELF_ST_TYPE (sy->st_info) == STT_FUNC) + { + asection *s; + + *p = s = bfd_section_from_elf_index (ibfd, sy->st_shndx); + if (s != NULL && interesting_section (s, output_bfd, htab)) + *psy++ = sy; + } + symcount = psy - psyms; + *psy = NULL; + + /* Sort them by section and offset within section. */ + sort_syms_syms = syms; + sort_syms_psecs = psecs; + qsort (psyms, symcount, sizeof (*psyms), sort_syms); + + /* Now inspect the function symbols. */ + for (psy = psyms; psy < psyms + symcount; ) + { + asection *s = psecs[*psy - syms]; + Elf_Internal_Sym **psy2; + + for (psy2 = psy; ++psy2 < psyms + symcount; ) + if (psecs[*psy2 - syms] != s) + break; + + if (!alloc_stack_info (s, psy2 - psy)) + return FALSE; + psy = psy2; + } + + /* First install info about properly typed and sized functions. + In an ideal world this will cover all code sections, except + when partitioning functions into hot and cold sections, + and the horrible pasted together .init and .fini functions. */ + for (psy = psyms; psy < psyms + symcount; ++psy) + { + sy = *psy; + if (ELF_ST_TYPE (sy->st_info) == STT_FUNC) + { + asection *s = psecs[sy - syms]; + if (!maybe_insert_function (s, sy, FALSE, TRUE)) + return FALSE; + } + } + + for (sec = ibfd->sections; sec != NULL && !gaps; sec = sec->next) + if (interesting_section (sec, output_bfd, htab)) + gaps |= check_function_ranges (sec, info); + } + + if (gaps) + { + /* See if we can discover more function symbols by looking at + relocations. */ + for (ibfd = info->input_bfds, bfd_idx = 0; + ibfd != NULL; + ibfd = ibfd->link_next, bfd_idx++) + { + asection *sec; + + if (psym_arr[bfd_idx] == NULL) + continue; + + for (sec = ibfd->sections; sec != NULL; sec = sec->next) + if (interesting_section (sec, output_bfd, htab) + && sec->reloc_count != 0) + { + if (!mark_functions_via_relocs (sec, info, FALSE)) + return FALSE; + } + } + + for (ibfd = info->input_bfds, bfd_idx = 0; + ibfd != NULL; + ibfd = ibfd->link_next, bfd_idx++) + { + Elf_Internal_Shdr *symtab_hdr; + asection *sec; + Elf_Internal_Sym *syms, *sy, **psyms, **psy; + asection **psecs; + + if ((psyms = psym_arr[bfd_idx]) == NULL) + continue; + + psecs = sec_arr[bfd_idx]; + + symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; + syms = (Elf_Internal_Sym *) symtab_hdr->contents; + + gaps = FALSE; + for (sec = ibfd->sections; sec != NULL && !gaps; sec = sec->next) + if (interesting_section (sec, output_bfd, htab)) + gaps |= check_function_ranges (sec, info); + if (!gaps) + continue; + + /* Finally, install all globals. */ + for (psy = psyms; (sy = *psy) != NULL; ++psy) + { + asection *s; + + s = psecs[sy - syms]; + + /* Global syms might be improperly typed functions. */ + if (ELF_ST_TYPE (sy->st_info) != STT_FUNC + && ELF_ST_BIND (sy->st_info) == STB_GLOBAL) + { + if (!maybe_insert_function (s, sy, FALSE, FALSE)) + return FALSE; + } + } + + /* Some of the symbols we've installed as marking the + beginning of functions may have a size of zero. Extend + the range of such functions to the beginning of the + next symbol of interest. */ + for (sec = ibfd->sections; sec != NULL; sec = sec->next) + if (interesting_section (sec, output_bfd, htab)) + { + struct _spu_elf_section_data *sec_data; + struct spu_elf_stack_info *sinfo; + + sec_data = spu_elf_section_data (sec); + sinfo = sec_data->stack_info; + if (sinfo != NULL) + { + int fun_idx; + bfd_vma hi = sec->size; + + for (fun_idx = sinfo->num_fun; --fun_idx >= 0; ) + { + sinfo->fun[fun_idx].hi = hi; + hi = sinfo->fun[fun_idx].lo; + } + } + /* No symbols in this section. Must be .init or .fini + or something similar. */ + else if (!pasted_function (sec, info)) + return FALSE; + } + } + } + + for (ibfd = info->input_bfds, bfd_idx = 0; + ibfd != NULL; + ibfd = ibfd->link_next, bfd_idx++) + { + if (psym_arr[bfd_idx] == NULL) + continue; + + free (psym_arr[bfd_idx]); + free (sec_arr[bfd_idx]); + } + + free (psym_arr); + free (sec_arr); + + return TRUE; +} + +/* Mark nodes in the call graph that are called by some other node. */ + +static void +mark_non_root (struct function_info *fun) +{ + struct call_info *call; + + fun->visit1 = TRUE; + for (call = fun->call_list; call; call = call->next) + { + call->fun->non_root = TRUE; + if (!call->fun->visit1) + mark_non_root (call->fun); + } +} + +/* Remove cycles from the call graph. */ + +static void +call_graph_traverse (struct function_info *fun, struct bfd_link_info *info) +{ + struct call_info **callp, *call; + + fun->visit2 = TRUE; + fun->marking = TRUE; + + callp = &fun->call_list; + while ((call = *callp) != NULL) + { + if (!call->fun->visit2) + call_graph_traverse (call->fun, info); + else if (call->fun->marking) + { + const char *f1 = func_name (fun); + const char *f2 = func_name (call->fun); + + info->callbacks->info (_("Stack analysis will ignore the call " + "from %s to %s\n"), + f1, f2); + *callp = call->next; + continue; + } + callp = &call->next; + } + fun->marking = FALSE; +} + +/* Populate call_list for each function. */ + +static bfd_boolean +build_call_tree (bfd *output_bfd, struct bfd_link_info *info) +{ + struct spu_link_hash_table *htab = spu_hash_table (info); + bfd *ibfd; + + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + { + extern const bfd_target bfd_elf32_spu_vec; + asection *sec; + + if (ibfd->xvec != &bfd_elf32_spu_vec) + continue; + + for (sec = ibfd->sections; sec != NULL; sec = sec->next) + { + if (!interesting_section (sec, output_bfd, htab) + || sec->reloc_count == 0) + continue; + + if (!mark_functions_via_relocs (sec, info, TRUE)) + return FALSE; + } + + /* Transfer call info from hot/cold section part of function + to main entry. */ + for (sec = ibfd->sections; sec != NULL; sec = sec->next) + { + struct _spu_elf_section_data *sec_data; + struct spu_elf_stack_info *sinfo; + + if ((sec_data = spu_elf_section_data (sec)) != NULL + && (sinfo = sec_data->stack_info) != NULL) + { + int i; + for (i = 0; i < sinfo->num_fun; ++i) + { + if (sinfo->fun[i].start != NULL) + { + struct call_info *call = sinfo->fun[i].call_list; + + while (call != NULL) + { + struct call_info *call_next = call->next; + if (!insert_callee (sinfo->fun[i].start, call)) + free (call); + call = call_next; + } + sinfo->fun[i].call_list = NULL; + sinfo->fun[i].non_root = TRUE; + } + } + } + } + } + + /* Find the call graph root(s). */ + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + { + extern const bfd_target bfd_elf32_spu_vec; + asection *sec; + + if (ibfd->xvec != &bfd_elf32_spu_vec) + continue; + + for (sec = ibfd->sections; sec != NULL; sec = sec->next) + { + struct _spu_elf_section_data *sec_data; + struct spu_elf_stack_info *sinfo; + + if ((sec_data = spu_elf_section_data (sec)) != NULL + && (sinfo = sec_data->stack_info) != NULL) + { + int i; + for (i = 0; i < sinfo->num_fun; ++i) + if (!sinfo->fun[i].visit1) + mark_non_root (&sinfo->fun[i]); + } + } + } + + /* Remove cycles from the call graph. We start from the root node(s) + so that we break cycles in a reasonable place. */ + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + { + extern const bfd_target bfd_elf32_spu_vec; + asection *sec; + + if (ibfd->xvec != &bfd_elf32_spu_vec) + continue; + + for (sec = ibfd->sections; sec != NULL; sec = sec->next) + { + struct _spu_elf_section_data *sec_data; + struct spu_elf_stack_info *sinfo; + + if ((sec_data = spu_elf_section_data (sec)) != NULL + && (sinfo = sec_data->stack_info) != NULL) + { + int i; + for (i = 0; i < sinfo->num_fun; ++i) + if (!sinfo->fun[i].non_root) + call_graph_traverse (&sinfo->fun[i], info); + } + } + } + + return TRUE; +} + +/* Descend the call graph for FUN, accumulating total stack required. */ + +static bfd_vma +sum_stack (struct function_info *fun, + struct bfd_link_info *info, + int emit_stack_syms) +{ + struct call_info *call; + struct function_info *max = NULL; + bfd_vma max_stack = fun->stack; + bfd_vma stack; + const char *f1; + + if (fun->visit3) + return max_stack; + + for (call = fun->call_list; call; call = call->next) + { + stack = sum_stack (call->fun, info, emit_stack_syms); + /* Include caller stack for normal calls, don't do so for + tail calls. fun->stack here is local stack usage for + this function. */ + if (!call->is_tail) + stack += fun->stack; + if (max_stack < stack) + { + max_stack = stack; + max = call->fun; + } + } + + f1 = func_name (fun); + info->callbacks->minfo (_("%s: 0x%v 0x%v\n"), f1, fun->stack, max_stack); + + if (fun->call_list) + { + info->callbacks->minfo (_(" calls:\n")); + for (call = fun->call_list; call; call = call->next) + { + const char *f2 = func_name (call->fun); + const char *ann1 = call->fun == max ? "*" : " "; + const char *ann2 = call->is_tail ? "t" : " "; + + info->callbacks->minfo (_(" %s%s %s\n"), ann1, ann2, f2); + } + } + + /* Now fun->stack holds cumulative stack. */ + fun->stack = max_stack; + fun->visit3 = TRUE; + + if (emit_stack_syms) + { + struct spu_link_hash_table *htab = spu_hash_table (info); + char *name = bfd_malloc (18 + strlen (f1)); + struct elf_link_hash_entry *h; + + if (name != NULL) + { + if (fun->global || ELF_ST_BIND (fun->u.sym->st_info) == STB_GLOBAL) + sprintf (name, "__stack_%s", f1); + else + sprintf (name, "__stack_%x_%s", fun->sec->id & 0xffffffff, f1); + + h = elf_link_hash_lookup (&htab->elf, name, TRUE, TRUE, FALSE); + free (name); + if (h != NULL + && (h->root.type == bfd_link_hash_new + || h->root.type == bfd_link_hash_undefined + || h->root.type == bfd_link_hash_undefweak)) + { + h->root.type = bfd_link_hash_defined; + h->root.u.def.section = bfd_abs_section_ptr; + h->root.u.def.value = max_stack; + h->size = 0; + h->type = 0; + h->ref_regular = 1; + h->def_regular = 1; + h->ref_regular_nonweak = 1; + h->forced_local = 1; + h->non_elf = 0; + } + } + } + + return max_stack; +} + +/* Provide an estimate of total stack required. */ + +static bfd_boolean +spu_elf_stack_analysis (bfd *output_bfd, + struct bfd_link_info *info, + int emit_stack_syms) +{ + bfd *ibfd; + bfd_vma max_stack = 0; + + if (!discover_functions (output_bfd, info)) + return FALSE; + + if (!build_call_tree (output_bfd, info)) + return FALSE; + + info->callbacks->info (_("Stack size for call graph root nodes.\n")); + info->callbacks->minfo (_("\nStack size for functions. " + "Annotations: '*' max stack, 't' tail call\n")); + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + { + extern const bfd_target bfd_elf32_spu_vec; + asection *sec; + + if (ibfd->xvec != &bfd_elf32_spu_vec) + continue; + + for (sec = ibfd->sections; sec != NULL; sec = sec->next) + { + struct _spu_elf_section_data *sec_data; + struct spu_elf_stack_info *sinfo; + + if ((sec_data = spu_elf_section_data (sec)) != NULL + && (sinfo = sec_data->stack_info) != NULL) + { + int i; + for (i = 0; i < sinfo->num_fun; ++i) + { + if (!sinfo->fun[i].non_root) + { + bfd_vma stack; + const char *f1; + + stack = sum_stack (&sinfo->fun[i], info, + emit_stack_syms); + f1 = func_name (&sinfo->fun[i]); + info->callbacks->info (_(" %s: 0x%v\n"), + f1, stack); + if (max_stack < stack) + max_stack = stack; + } + } + } + } + } + + info->callbacks->info (_("Maximum stack required is 0x%v\n"), max_stack); + return TRUE; +} + +/* Perform a final link. */ + +static bfd_boolean +spu_elf_final_link (bfd *output_bfd, struct bfd_link_info *info) +{ + struct spu_link_hash_table *htab = spu_hash_table (info); + + if (htab->stack_analysis + && !spu_elf_stack_analysis (output_bfd, info, htab->emit_stack_syms)) + info->callbacks->einfo ("%X%P: stack analysis error: %E\n"); + + return bfd_elf_final_link (output_bfd, info); +} + +/* Called when not normally emitting relocs, ie. !info->relocatable + and !info->emitrelocations. Returns a count of special relocs + that need to be emitted. */ + +static unsigned int +spu_elf_count_relocs (asection *sec, Elf_Internal_Rela *relocs) +{ + unsigned int count = 0; + Elf_Internal_Rela *relend = relocs + sec->reloc_count; + + for (; relocs < relend; relocs++) + { + int r_type = ELF32_R_TYPE (relocs->r_info); + if (r_type == R_SPU_PPU32 || r_type == R_SPU_PPU64) + ++count; + } + + return count; +} + +/* Apply RELOCS to CONTENTS of INPUT_SECTION from INPUT_BFD. */ + +static bfd_boolean +spu_elf_relocate_section (bfd *output_bfd, + struct bfd_link_info *info, + bfd *input_bfd, + asection *input_section, + bfd_byte *contents, + Elf_Internal_Rela *relocs, + Elf_Internal_Sym *local_syms, + asection **local_sections) +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel, *relend; + struct spu_link_hash_table *htab; + bfd_boolean ret = TRUE; + bfd_boolean emit_these_relocs = FALSE; + + htab = spu_hash_table (info); + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = (struct elf_link_hash_entry **) (elf_sym_hashes (input_bfd)); + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + int r_type; + reloc_howto_type *howto; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + struct elf_link_hash_entry *h; + const char *sym_name; + bfd_vma relocation; + bfd_vma addend; + bfd_reloc_status_type r; + bfd_boolean unresolved_reloc; + bfd_boolean warned; + bfd_boolean branch; + + r_symndx = ELF32_R_SYM (rel->r_info); + r_type = ELF32_R_TYPE (rel->r_info); + if (r_type == R_SPU_PPU32 || r_type == R_SPU_PPU64) + { + emit_these_relocs = TRUE; + continue; + } + + howto = elf_howto_table + r_type; + unresolved_reloc = FALSE; + warned = FALSE; + h = NULL; + sym = NULL; + sec = NULL; + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + sym_name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym, sec); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + } + else + { + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); + sym_name = h->root.root.string; + } + + if (sec != NULL && elf_discarded_section (sec)) + { + /* For relocs against symbols from removed linkonce sections, + or sections discarded by a linker script, we just want the + section contents zeroed. Avoid any special processing. */ + _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset); + rel->r_info = 0; + rel->r_addend = 0; + continue; + } + + if (info->relocatable) + continue; + + if (unresolved_reloc) + { + (*_bfd_error_handler) + (_("%B(%s+0x%lx): unresolvable %s relocation against symbol `%s'"), + input_bfd, + bfd_get_section_name (input_bfd, input_section), + (long) rel->r_offset, + howto->name, + sym_name); + ret = FALSE; + } + + /* If this symbol is in an overlay area, we may need to relocate + to the overlay stub. */ + addend = rel->r_addend; + branch = (is_branch (contents + rel->r_offset) + || is_hint (contents + rel->r_offset)); + if (needs_ovl_stub (sym_name, sec, input_section, htab, branch)) + { + char *stub_name; + struct spu_stub_hash_entry *sh; + + stub_name = spu_stub_name (sec, h, rel); + if (stub_name == NULL) + return FALSE; + + sh = (struct spu_stub_hash_entry *) + bfd_hash_lookup (&htab->stub_hash_table, stub_name, FALSE, FALSE); + if (sh != NULL) + { + relocation = (htab->stub->output_section->vma + + htab->stub->output_offset + + sh->off); + addend = 0; + } + free (stub_name); + } + + r = _bfd_final_link_relocate (howto, + input_bfd, + input_section, + contents, + rel->r_offset, relocation, addend); + + if (r != bfd_reloc_ok) + { + const char *msg = (const char *) 0; + + switch (r) + { + case bfd_reloc_overflow: + if (!((*info->callbacks->reloc_overflow) + (info, (h ? &h->root : NULL), sym_name, howto->name, + (bfd_vma) 0, input_bfd, input_section, rel->r_offset))) + return FALSE; + break; + + case bfd_reloc_undefined: + if (!((*info->callbacks->undefined_symbol) + (info, sym_name, input_bfd, input_section, + rel->r_offset, TRUE))) + return FALSE; + break; + + case bfd_reloc_outofrange: + msg = _("internal error: out of range error"); + goto common_error; + + case bfd_reloc_notsupported: + msg = _("internal error: unsupported relocation error"); + goto common_error; + + case bfd_reloc_dangerous: + msg = _("internal error: dangerous error"); + goto common_error; + + default: + msg = _("internal error: unknown error"); + /* fall through */ + + common_error: + if (!((*info->callbacks->warning) + (info, msg, sym_name, input_bfd, input_section, + rel->r_offset))) + return FALSE; + break; + } + } + } + + if (ret + && emit_these_relocs + && !info->relocatable + && !info->emitrelocations) + { + Elf_Internal_Rela *wrel; + Elf_Internal_Shdr *rel_hdr; + + wrel = rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + int r_type; + + r_type = ELF32_R_TYPE (rel->r_info); + if (r_type == R_SPU_PPU32 || r_type == R_SPU_PPU64) + *wrel++ = *rel; + } + input_section->reloc_count = wrel - relocs; + /* Backflips for _bfd_elf_link_output_relocs. */ + rel_hdr = &elf_section_data (input_section)->rel_hdr; + rel_hdr->sh_size = input_section->reloc_count * rel_hdr->sh_entsize; + ret = 2; + } + + return ret; +} + +/* Adjust _SPUEAR_ syms to point at their overlay stubs. */ + +static bfd_boolean +spu_elf_output_symbol_hook (struct bfd_link_info *info, + const char *sym_name ATTRIBUTE_UNUSED, + Elf_Internal_Sym *sym, + asection *sym_sec ATTRIBUTE_UNUSED, + struct elf_link_hash_entry *h) +{ + struct spu_link_hash_table *htab = spu_hash_table (info); + + if (!info->relocatable + && htab->num_overlays != 0 + && h != NULL + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && h->def_regular + && strncmp (h->root.root.string, "_SPUEAR_", 8) == 0) + { + static Elf_Internal_Rela zero_rel; + char *stub_name = spu_stub_name (h->root.u.def.section, h, &zero_rel); + struct spu_stub_hash_entry *sh; + + if (stub_name == NULL) + return FALSE; + sh = (struct spu_stub_hash_entry *) + bfd_hash_lookup (&htab->stub_hash_table, stub_name, FALSE, FALSE); + free (stub_name); + if (sh == NULL) + return TRUE; + sym->st_shndx + = _bfd_elf_section_from_bfd_section (htab->stub->output_section->owner, + htab->stub->output_section); + sym->st_value = (htab->stub->output_section->vma + + htab->stub->output_offset + + sh->off); + } + + return TRUE; +} + +static int spu_plugin = 0; + +void +spu_elf_plugin (int val) +{ + spu_plugin = val; +} + +/* Set ELF header e_type for plugins. */ + +static void +spu_elf_post_process_headers (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) +{ + if (spu_plugin) + { + Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd); + + i_ehdrp->e_type = ET_DYN; + } +} + +/* We may add an extra PT_LOAD segment for .toe. We also need extra + segments for overlays. */ + +static int +spu_elf_additional_program_headers (bfd *abfd, struct bfd_link_info *info) +{ + struct spu_link_hash_table *htab = spu_hash_table (info); + int extra = htab->num_overlays; + asection *sec; + + if (extra) + ++extra; + + sec = bfd_get_section_by_name (abfd, ".toe"); + if (sec != NULL && (sec->flags & SEC_LOAD) != 0) + ++extra; + + return extra; +} + +/* Remove .toe section from other PT_LOAD segments and put it in + a segment of its own. Put overlays in separate segments too. */ + +static bfd_boolean +spu_elf_modify_segment_map (bfd *abfd, struct bfd_link_info *info) +{ + asection *toe, *s; + struct elf_segment_map *m; + unsigned int i; + + if (info == NULL) + return TRUE; + + toe = bfd_get_section_by_name (abfd, ".toe"); + for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next) + if (m->p_type == PT_LOAD && m->count > 1) + for (i = 0; i < m->count; i++) + if ((s = m->sections[i]) == toe + || spu_elf_section_data (s)->ovl_index != 0) + { + struct elf_segment_map *m2; + bfd_vma amt; + + if (i + 1 < m->count) + { + amt = sizeof (struct elf_segment_map); + amt += (m->count - (i + 2)) * sizeof (m->sections[0]); + m2 = bfd_zalloc (abfd, amt); + if (m2 == NULL) + return FALSE; + m2->count = m->count - (i + 1); + memcpy (m2->sections, m->sections + i + 1, + m2->count * sizeof (m->sections[0])); + m2->p_type = PT_LOAD; + m2->next = m->next; + m->next = m2; + } + m->count = 1; + if (i != 0) + { + m->count = i; + amt = sizeof (struct elf_segment_map); + m2 = bfd_zalloc (abfd, amt); + if (m2 == NULL) + return FALSE; + m2->p_type = PT_LOAD; + m2->count = 1; + m2->sections[0] = s; + m2->next = m->next; + m->next = m2; + } + break; + } + + return TRUE; +} + +/* Check that all loadable section VMAs lie in the range + LO .. HI inclusive. */ + +asection * +spu_elf_check_vma (bfd *abfd, bfd_vma lo, bfd_vma hi) +{ + struct elf_segment_map *m; + unsigned int i; + + for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next) + if (m->p_type == PT_LOAD) + for (i = 0; i < m->count; i++) + if (m->sections[i]->size != 0 + && (m->sections[i]->vma < lo + || m->sections[i]->vma > hi + || m->sections[i]->vma + m->sections[i]->size - 1 > hi)) + return m->sections[i]; + + return NULL; +} + +/* Tweak the section type of .note.spu_name. */ + +static bfd_boolean +spu_elf_fake_sections (bfd *obfd ATTRIBUTE_UNUSED, + Elf_Internal_Shdr *hdr, + asection *sec) +{ + if (strcmp (sec->name, SPU_PTNOTE_SPUNAME) == 0) + hdr->sh_type = SHT_NOTE; + return TRUE; +} + +/* Tweak phdrs before writing them out. */ + +static int +spu_elf_modify_program_headers (bfd *abfd, struct bfd_link_info *info) +{ + const struct elf_backend_data *bed; + struct elf_obj_tdata *tdata; + Elf_Internal_Phdr *phdr, *last; + struct spu_link_hash_table *htab; + unsigned int count; + unsigned int i; + + if (info == NULL) + return TRUE; + + bed = get_elf_backend_data (abfd); + tdata = elf_tdata (abfd); + phdr = tdata->phdr; + count = tdata->program_header_size / bed->s->sizeof_phdr; + htab = spu_hash_table (info); + if (htab->num_overlays != 0) + { + struct elf_segment_map *m; + unsigned int o; + + for (i = 0, m = elf_tdata (abfd)->segment_map; m; ++i, m = m->next) + if (m->count != 0 + && (o = spu_elf_section_data (m->sections[0])->ovl_index) != 0) + { + /* Mark this as an overlay header. */ + phdr[i].p_flags |= PF_OVERLAY; + + if (htab->ovtab != NULL && htab->ovtab->size != 0) + { + bfd_byte *p = htab->ovtab->contents; + unsigned int off = (o - 1) * 16 + 8; + + /* Write file_off into _ovly_table. */ + bfd_put_32 (htab->ovtab->owner, phdr[i].p_offset, p + off); + } + } + } + + /* Round up p_filesz and p_memsz of PT_LOAD segments to multiples + of 16. This should always be possible when using the standard + linker scripts, but don't create overlapping segments if + someone is playing games with linker scripts. */ + last = NULL; + for (i = count; i-- != 0; ) + if (phdr[i].p_type == PT_LOAD) + { + unsigned adjust; + + adjust = -phdr[i].p_filesz & 15; + if (adjust != 0 + && last != NULL + && phdr[i].p_offset + phdr[i].p_filesz > last->p_offset - adjust) + break; + + adjust = -phdr[i].p_memsz & 15; + if (adjust != 0 + && last != NULL + && phdr[i].p_filesz != 0 + && phdr[i].p_vaddr + phdr[i].p_memsz > last->p_vaddr - adjust + && phdr[i].p_vaddr + phdr[i].p_memsz <= last->p_vaddr) + break; + + if (phdr[i].p_filesz != 0) + last = &phdr[i]; + } + + if (i == (unsigned int) -1) + for (i = count; i-- != 0; ) + if (phdr[i].p_type == PT_LOAD) + { + unsigned adjust; + + adjust = -phdr[i].p_filesz & 15; + phdr[i].p_filesz += adjust; + + adjust = -phdr[i].p_memsz & 15; + phdr[i].p_memsz += adjust; + } + + return TRUE; +} + +#define TARGET_BIG_SYM bfd_elf32_spu_vec +#define TARGET_BIG_NAME "elf32-spu" +#define ELF_ARCH bfd_arch_spu +#define ELF_MACHINE_CODE EM_SPU +/* This matches the alignment need for DMA. */ +#define ELF_MAXPAGESIZE 0x80 +#define elf_backend_rela_normal 1 +#define elf_backend_can_gc_sections 1 + +#define bfd_elf32_bfd_reloc_type_lookup spu_elf_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup spu_elf_reloc_name_lookup +#define elf_info_to_howto spu_elf_info_to_howto +#define elf_backend_count_relocs spu_elf_count_relocs +#define elf_backend_relocate_section spu_elf_relocate_section +#define elf_backend_symbol_processing spu_elf_backend_symbol_processing +#define elf_backend_link_output_symbol_hook spu_elf_output_symbol_hook +#define bfd_elf32_new_section_hook spu_elf_new_section_hook +#define bfd_elf32_bfd_link_hash_table_create spu_elf_link_hash_table_create +#define bfd_elf32_bfd_link_hash_table_free spu_elf_link_hash_table_free + +#define elf_backend_additional_program_headers spu_elf_additional_program_headers +#define elf_backend_modify_segment_map spu_elf_modify_segment_map +#define elf_backend_modify_program_headers spu_elf_modify_program_headers +#define elf_backend_post_process_headers spu_elf_post_process_headers +#define elf_backend_fake_sections spu_elf_fake_sections +#define elf_backend_special_sections spu_elf_special_sections +#define bfd_elf32_bfd_final_link spu_elf_final_link + +#include "elf32-target.h" diff --git a/contrib/binutils/bfd/elf32-spu.h b/contrib/binutils/bfd/elf32-spu.h new file mode 100644 index 000000000000..b74c3102b8be --- /dev/null +++ b/contrib/binutils/bfd/elf32-spu.h @@ -0,0 +1,57 @@ +/* SPU specific support for 32-bit ELF. + + Copyright 2006, 2007 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* Extra info kept for SPU sections. */ + +struct spu_elf_stack_info; + +struct _spu_elf_section_data +{ + struct bfd_elf_section_data elf; + + /* Stack analysis info kept for this section. */ + + struct spu_elf_stack_info *stack_info; + + /* Non-zero for overlay output sections. */ + unsigned int ovl_index; +}; + +#define spu_elf_section_data(sec) \ + ((struct _spu_elf_section_data *) elf_section_data (sec)) + +struct _ovl_stream +{ + const void *start; + const void *end; +}; + +extern void spu_elf_plugin (int); +extern bfd_boolean spu_elf_open_builtin_lib (bfd **, + const struct _ovl_stream *); +extern bfd_boolean spu_elf_create_sections (bfd *, + struct bfd_link_info *, int, int); +extern bfd_boolean spu_elf_find_overlays (bfd *, struct bfd_link_info *); +extern bfd_boolean spu_elf_size_stubs (bfd *, struct bfd_link_info *, int, int, + asection **, asection **, + asection **); +extern bfd_boolean spu_elf_build_stubs (struct bfd_link_info *, int, + asection *); +extern asection *spu_elf_check_vma (bfd *, bfd_vma, bfd_vma); diff --git a/contrib/binutils/bfd/elf64-alpha.c b/contrib/binutils/bfd/elf64-alpha.c index 76d0661a1165..3d4350d00820 100644 --- a/contrib/binutils/bfd/elf64-alpha.c +++ b/contrib/binutils/bfd/elf64-alpha.c @@ -1,6 +1,6 @@ /* Alpha specific support for 64-bit ELF Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006 Free Software Foundation, Inc. + 2006, 2007 Free Software Foundation, Inc. Contributed by Richard Henderson <rth@tamu.edu>. This file is part of BFD, the Binary File Descriptor library. @@ -22,8 +22,8 @@ /* We need a published ABI spec for this. Until one comes out, don't assume this'll remain unchanged forever. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "elf-bfd.h" @@ -184,6 +184,10 @@ struct alpha_elf_link_hash_table /* The head of a list of .got subsections linked through alpha_elf_tdata(abfd)->got_link_next. */ bfd *got_list; + + /* The most recent relax pass that we've seen. The GOTs + should be regenerated if this doesn't match. */ + int relax_trip; }; /* Look up an entry in a Alpha ELF linker hash table. */ @@ -321,11 +325,14 @@ struct alpha_elf_obj_tdata static bfd_boolean elf64_alpha_mkobject (bfd *abfd) { - bfd_size_type amt = sizeof (struct alpha_elf_obj_tdata); - abfd->tdata.any = bfd_zalloc (abfd, amt); if (abfd->tdata.any == NULL) - return FALSE; - return TRUE; + { + bfd_size_type amt = sizeof (struct alpha_elf_obj_tdata); + abfd->tdata.any = bfd_zalloc (abfd, amt); + if (abfd->tdata.any == NULL) + return FALSE; + } + return bfd_elf_mkobject (abfd); } static bfd_boolean @@ -1052,6 +1059,23 @@ elf64_alpha_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return 0; } +static reloc_howto_type * +elf64_alpha_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (elf64_alpha_howto_table) + / sizeof (elf64_alpha_howto_table[0])); + i++) + if (elf64_alpha_howto_table[i].name != NULL + && strcasecmp (elf64_alpha_howto_table[i].name, r_name) == 0) + return &elf64_alpha_howto_table[i]; + + return NULL; +} + /* Given an Alpha ELF reloc type, fill in an arelent structure. */ static void @@ -1898,7 +1922,7 @@ elf64_alpha_check_relocs (bfd *abfd, struct bfd_link_info *info, if (rel_sec_name == NULL) return FALSE; - BFD_ASSERT (strncmp (rel_sec_name, ".rela", 5) == 0 + BFD_ASSERT (CONST_STRNEQ (rel_sec_name, ".rela") && strcmp (bfd_get_section_name (abfd, sec), rel_sec_name+5) == 0); } @@ -2032,6 +2056,19 @@ elf64_alpha_adjust_dynamic_symbol (struct bfd_link_info *info, return TRUE; } +/* Record STO_ALPHA_NOPV and STO_ALPHA_STD_GPLOAD. */ + +static void +elf64_alpha_merge_symbol_attribute (struct elf_link_hash_entry *h, + const Elf_Internal_Sym *isym, + bfd_boolean definition, + bfd_boolean dynamic) +{ + if (!dynamic && definition) + h->other = ((h->other & ELF_ST_VISIBILITY (-1)) + | (isym->st_other & ~ELF_ST_VISIBILITY (-1))); +} + /* Symbol versioning can create new symbols, and make our old symbols indirect to the new ones. Consolidate the got and reloc information in these situations. */ @@ -2342,7 +2379,6 @@ static bfd_boolean elf64_alpha_size_got_sections (struct bfd_link_info *info) { bfd *i, *got_list, *cur_got_obj = NULL; - int something_changed = 0; got_list = alpha_elf_hash_table (info)->got_list; @@ -2380,9 +2416,6 @@ elf64_alpha_size_got_sections (struct bfd_link_info *info) return TRUE; alpha_elf_hash_table (info)->got_list = got_list; - - /* Force got offsets to be recalculated. */ - something_changed = 1; } cur_got_obj = got_list; @@ -2396,8 +2429,6 @@ elf64_alpha_size_got_sections (struct bfd_link_info *info) alpha_elf_tdata(i)->got->size = 0; i = alpha_elf_tdata(i)->got_link_next; alpha_elf_tdata(cur_got_obj)->got_link_next = i; - - something_changed = 1; } else { @@ -2408,8 +2439,7 @@ elf64_alpha_size_got_sections (struct bfd_link_info *info) /* Once the gots have been merged, fill in the got offsets for everything therein. */ - if (1 || something_changed) - elf64_alpha_calc_got_offsets (info); + elf64_alpha_calc_got_offsets (info); return TRUE; } @@ -2444,10 +2474,10 @@ elf64_alpha_size_plt_section_1 (struct alpha_elf_link_hash_entry *h, PTR data) return TRUE; } -/* Called from relax_section to rebuild the PLT in light of - potential changes in the function's status. */ +/* Called from relax_section to rebuild the PLT in light of potential changes + in the function's status. */ -static bfd_boolean +static void elf64_alpha_size_plt_section (struct bfd_link_info *info) { asection *splt, *spltrel, *sgotplt; @@ -2457,7 +2487,7 @@ elf64_alpha_size_plt_section (struct bfd_link_info *info) dynobj = elf_hash_table(info)->dynobj; splt = bfd_get_section_by_name (dynobj, ".plt"); if (splt == NULL) - return TRUE; + return; splt->size = 0; @@ -2466,6 +2496,7 @@ elf64_alpha_size_plt_section (struct bfd_link_info *info) /* Every plt entry requires a JMP_SLOT relocation. */ spltrel = bfd_get_section_by_name (dynobj, ".rela.plt"); + entries = 0; if (splt->size) { if (elf64_alpha_use_secureplt) @@ -2473,8 +2504,6 @@ elf64_alpha_size_plt_section (struct bfd_link_info *info) else entries = (splt->size - OLD_PLT_HEADER_SIZE) / OLD_PLT_ENTRY_SIZE; } - else - entries = 0; spltrel->size = entries * sizeof (Elf64_External_Rela); /* When using the secureplt, we need two words somewhere in the data @@ -2485,8 +2514,6 @@ elf64_alpha_size_plt_section (struct bfd_link_info *info) sgotplt = bfd_get_section_by_name (dynobj, ".got.plt"); sgotplt->size = entries ? 16 : 0; } - - return TRUE; } static bfd_boolean @@ -2657,7 +2684,7 @@ elf64_alpha_size_rela_got_1 (struct alpha_elf_link_hash_entry *h, /* Set the sizes of the dynamic relocation sections. */ -static bfd_boolean +static void elf64_alpha_size_rela_got_section (struct bfd_link_info *info) { unsigned long entries; @@ -2696,15 +2723,13 @@ elf64_alpha_size_rela_got_section (struct bfd_link_info *info) if (!srel) { BFD_ASSERT (entries == 0); - return TRUE; + return; } srel->size = sizeof (Elf64_External_Rela) * entries; /* Now do the non-local symbols. */ alpha_elf_link_hash_traverse (alpha_elf_hash_table (info), elf64_alpha_size_rela_got_1, info); - - return TRUE; } /* Set the sizes of the dynamic sections. */ @@ -2758,7 +2783,7 @@ elf64_alpha_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, of the dynobj section names depend upon the input files. */ name = bfd_get_section_name (dynobj, s); - if (strncmp (name, ".rela", 5) == 0) + if (CONST_STRNEQ (name, ".rela")) { if (s->size != 0) { @@ -2770,7 +2795,7 @@ elf64_alpha_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, s->reloc_count = 0; } } - else if (strncmp (name, ".got", 4) != 0 + else if (! CONST_STRNEQ (name, ".got") && strcmp (name, ".plt") != 0 && strcmp (name, ".dynbss") != 0) { @@ -3576,7 +3601,7 @@ elf64_alpha_relax_section (bfd *abfd, asection *sec, struct alpha_elf_got_entry **local_got_entries; struct alpha_relax_info info; - /* We are not currently changing any sizes, so only one pass. */ + /* There's nothing to change, yet. */ *again = FALSE; if (link_info->relocatable @@ -3585,6 +3610,22 @@ elf64_alpha_relax_section (bfd *abfd, asection *sec, || sec->reloc_count == 0) return TRUE; + /* Make sure our GOT and PLT tables are up-to-date. */ + if (alpha_elf_hash_table(link_info)->relax_trip != link_info->relax_trip) + { + alpha_elf_hash_table(link_info)->relax_trip = link_info->relax_trip; + + /* This should never fail after the initial round, since the only + error is GOT overflow, and relaxation only shrinks the table. */ + if (!elf64_alpha_size_got_sections (link_info)) + abort (); + if (elf_hash_table (link_info)->dynamic_sections_created) + { + elf64_alpha_size_plt_section (link_info); + elf64_alpha_size_rela_got_section (link_info); + } + } + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; local_got_entries = alpha_elf_tdata(abfd)->local_got_entries; @@ -3794,13 +3835,6 @@ elf64_alpha_relax_section (bfd *abfd, asection *sec, } } - if (!elf64_alpha_size_plt_section (link_info)) - return FALSE; - if (!elf64_alpha_size_got_sections (link_info)) - return FALSE; - if (!elf64_alpha_size_rela_got_section (link_info)) - return FALSE; - if (isymbuf != NULL && symtab_hdr->contents != (unsigned char *) isymbuf) { @@ -3896,9 +3930,11 @@ elf64_alpha_relocate_section_r (bfd *output_bfd ATTRIBUTE_UNUSED, unsigned long symtab_hdr_sh_info; Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; + struct elf_link_hash_entry **sym_hashes; bfd_boolean ret_val = TRUE; symtab_hdr_sh_info = elf_tdata (input_bfd)->symtab_hdr.sh_info; + sym_hashes = elf_sym_hashes (input_bfd); relend = relocs + input_section->reloc_count; for (rel = relocs; rel < relend; rel++) @@ -3908,7 +3944,7 @@ elf64_alpha_relocate_section_r (bfd *output_bfd ATTRIBUTE_UNUSED, asection *sec; unsigned long r_type; - r_type = ELF64_R_TYPE(rel->r_info); + r_type = ELF64_R_TYPE (rel->r_info); if (r_type >= R_ALPHA_max) { (*_bfd_error_handler) @@ -3919,22 +3955,49 @@ elf64_alpha_relocate_section_r (bfd *output_bfd ATTRIBUTE_UNUSED, continue; } - r_symndx = ELF64_R_SYM(rel->r_info); - /* The symbol associated with GPDISP and LITUSE is immaterial. Only the addend is significant. */ if (r_type == R_ALPHA_GPDISP || r_type == R_ALPHA_LITUSE) continue; + r_symndx = ELF64_R_SYM (rel->r_info); if (r_symndx < symtab_hdr_sh_info) { sym = local_syms + r_symndx; - if (ELF_ST_TYPE(sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } + sec = local_sections[r_symndx]; } + else + { + struct elf_link_hash_entry *h; + + h = sym_hashes[r_symndx - symtab_hdr_sh_info]; + + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + if (h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + continue; + + sym = NULL; + sec = h->root.u.def.section; + } + + if (sec != NULL && elf_discarded_section (sec)) + { + /* For relocs against symbols from removed linkonce sections, + or sections discarded by a linker script, we just want the + section contents zeroed. */ + _bfd_clear_contents (elf64_alpha_howto_table + r_type, + input_bfd, contents + rel->r_offset); + rel->r_info = 0; + rel->r_addend = 0; + continue; + } + + if (sym != NULL && ELF_ST_TYPE (sym->st_info) == STT_SECTION) + rel->r_addend += sec->output_offset; } return ret_val; @@ -4134,6 +4197,17 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info, gotent = h->got_entries; } + if (sec != NULL && elf_discarded_section (sec)) + { + /* For relocs against symbols from removed linkonce sections, + or sections discarded by a linker script, we just want the + section contents zeroed. Avoid any special processing. */ + _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset); + rel->r_info = 0; + rel->r_addend = 0; + continue; + } + addend = rel->r_addend; value += addend; @@ -4193,18 +4267,6 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info, goto default_reloc; case R_ALPHA_GPREL32: - /* If the target section was a removed linkonce section, - r_symndx will be zero. In this case, assume that the - switch will not be used, so don't fill it in. If we - do nothing here, we'll get relocation truncated messages, - due to the placement of the application above 4GB. */ - if (r_symndx == 0) - { - r = bfd_reloc_ok; - break; - } - /* FALLTHRU */ - case R_ALPHA_GPREL16: case R_ALPHA_GPRELLOW: if (dynamic_symbol_p) @@ -5145,9 +5207,9 @@ elf64_alpha_reloc_type_class (const Elf_Internal_Rela *rela) static const struct bfd_elf_special_section elf64_alpha_special_sections[] = { - { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL }, - { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL }, - { NULL, 0, 0, 0, 0 } + { STRING_COMMA_LEN (".sbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL }, + { STRING_COMMA_LEN (".sdata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL }, + { NULL, 0, 0, 0, 0 } }; /* ECOFF swapping routines. These are used when dealing with the @@ -5231,12 +5293,15 @@ static const struct elf_size_info alpha_elf_size_info = #define ELF_ARCH bfd_arch_alpha #define ELF_MACHINE_CODE EM_ALPHA #define ELF_MAXPAGESIZE 0x10000 +#define ELF_COMMONPAGESIZE 0x2000 #define bfd_elf64_bfd_link_hash_table_create \ elf64_alpha_bfd_link_hash_table_create #define bfd_elf64_bfd_reloc_type_lookup \ elf64_alpha_bfd_reloc_type_lookup +#define bfd_elf64_bfd_reloc_name_lookup \ + elf64_alpha_bfd_reloc_name_lookup #define elf_info_to_howto \ elf64_alpha_info_to_howto @@ -5267,10 +5332,14 @@ static const struct elf_size_info alpha_elf_size_info = elf64_alpha_create_dynamic_sections #define elf_backend_adjust_dynamic_symbol \ elf64_alpha_adjust_dynamic_symbol +#define elf_backend_merge_symbol_attribute \ + elf64_alpha_merge_symbol_attribute #define elf_backend_always_size_sections \ elf64_alpha_always_size_sections #define elf_backend_size_dynamic_sections \ elf64_alpha_size_dynamic_sections +#define elf_backend_omit_section_dynsym \ + ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true) #define elf_backend_relocate_section \ elf64_alpha_relocate_section #define elf_backend_finish_dynamic_symbol \ @@ -5305,6 +5374,8 @@ static const struct elf_size_info alpha_elf_size_info = #define TARGET_LITTLE_SYM bfd_elf64_alpha_freebsd_vec #undef TARGET_LITTLE_NAME #define TARGET_LITTLE_NAME "elf64-alpha-freebsd" +#undef ELF_OSABI +#define ELF_OSABI ELFOSABI_FREEBSD /* The kernel recognizes executables as valid only if they carry a "FreeBSD" label in the ELF header. So we put this label on all @@ -5319,7 +5390,7 @@ elf64_alpha_fbsd_post_process_headers (bfd * abfd, i_ehdrp = elf_elfheader (abfd); /* Put an ABI label supported by FreeBSD >= 4.1. */ - i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD; + i_ehdrp->e_ident[EI_OSABI] = get_elf_backend_data (abfd)->elf_osabi; #ifdef OLD_FREEBSD_ABI_LABEL /* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard. */ memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8); diff --git a/contrib/binutils/bfd/elf64-gen.c b/contrib/binutils/bfd/elf64-gen.c index 49b8d9c55284..05a94f0650a2 100644 --- a/contrib/binutils/bfd/elf64-gen.c +++ b/contrib/binutils/bfd/elf64-gen.c @@ -1,5 +1,5 @@ /* Generic support for 64-bit ELF - Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004, 2005 + Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004, 2005, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,8 +18,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "elf-bfd.h" @@ -94,6 +94,7 @@ elf64_generic_link_add_symbols (bfd *abfd, struct bfd_link_info *info) #define ELF_MACHINE_CODE EM_NONE #define ELF_MAXPAGESIZE 0x1 #define bfd_elf64_bfd_reloc_type_lookup bfd_default_reloc_type_lookup +#define bfd_elf64_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup #define bfd_elf64_bfd_link_add_symbols elf64_generic_link_add_symbols #define elf_info_to_howto elf_generic_info_to_howto #define elf_info_to_howto_rel elf_generic_info_to_howto_rel diff --git a/contrib/binutils/bfd/elf64-mips.c b/contrib/binutils/bfd/elf64-mips.c index c8f3127e3c9e..e64b50caed01 100644 --- a/contrib/binutils/bfd/elf64-mips.c +++ b/contrib/binutils/bfd/elf64-mips.c @@ -1,6 +1,6 @@ /* MIPS-specific support for 64-bit ELF - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 - Free Software Foundation, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + 2007 Free Software Foundation, Inc. Ian Lance Taylor, Cygnus Support Linker support added by Mark Mitchell, CodeSourcery, LLC. <mark@codesourcery.com> @@ -40,8 +40,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. . the OldABI version is still lying around and should be removed. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "aout/ar.h" #include "bfdlink.h" @@ -112,8 +112,6 @@ static bfd_reloc_status_type mips_elf64_gprel32_reloc (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf64_shift6_reloc (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); -static bfd_reloc_status_type mips16_jump_reloc - (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips16_gprel_reloc (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_boolean mips_elf64_assign_gp @@ -791,6 +789,21 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = 0x0000ffff, /* src_mask */ 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ + + /* 32 bit relocation with no addend. */ + HOWTO (R_MIPS_GLOB_DAT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_mips_elf_generic_reloc, /* special_function */ + "R_MIPS_GLOB_DAT", /* name */ + FALSE, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ }; /* The relocation table used for SHT_RELA sections. */ @@ -1314,7 +1327,20 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = EMPTY_HOWTO (R_MIPS_TLS_DTPMOD32), EMPTY_HOWTO (R_MIPS_TLS_DTPREL32), EMPTY_HOWTO (R_MIPS_TLS_DTPMOD64), - EMPTY_HOWTO (R_MIPS_TLS_DTPREL64), + + HOWTO (R_MIPS_TLS_DTPREL64, /* 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_mips_elf_generic_reloc, /* special_function */ + "R_MIPS_TLS_DTPREL64", /* name */ + TRUE, /* partial_inplace */ + MINUS_ONE, /* src_mask */ + MINUS_ONE, /* dst_mask */ + FALSE), /* pcrel_offset */ /* TLS general dynamic variable reference. */ HOWTO (R_MIPS_TLS_GD, /* type */ @@ -1423,6 +1449,21 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = 0x0000ffff, /* src_mask */ 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ + + /* 32 bit relocation with no addend. */ + HOWTO (R_MIPS_GLOB_DAT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_mips_elf_generic_reloc, /* special_function */ + "R_MIPS_GLOB_DAT", /* name */ + FALSE, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ }; static reloc_howto_type mips16_elf64_howto_table_rel[] = @@ -1438,7 +1479,7 @@ static reloc_howto_type mips16_elf64_howto_table_rel[] = /* This needs complex overflow detection, because the upper four bits must match the PC. */ - mips16_jump_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS16_26", /* name */ TRUE, /* partial_inplace */ 0x3ffffff, /* src_mask */ @@ -1510,7 +1551,7 @@ static reloc_howto_type mips16_elf64_howto_table_rela[] = /* This needs complex overflow detection, because the upper four bits must match the PC. */ - mips16_jump_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS16_26", /* name */ FALSE, /* partial_inplace */ 0x3ffffff, /* src_mask */ @@ -2044,37 +2085,6 @@ mips_elf64_shift6_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, error_message); } -/* Handle a mips16 jump. */ - -static bfd_reloc_status_type -mips16_jump_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, - asymbol *symbol, void *data ATTRIBUTE_UNUSED, - asection *input_section, bfd *output_bfd, - char **error_message ATTRIBUTE_UNUSED) -{ - if (output_bfd != NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && (! reloc_entry->howto->partial_inplace - || reloc_entry->addend == 0)) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - /* FIXME. */ - { - static bfd_boolean warned; - - if (! warned) - (*_bfd_error_handler) - (_("Linking mips16 objects into %s format is not supported"), - bfd_get_target (input_section->output_section->owner)); - warned = TRUE; - } - - return bfd_reloc_undefined; -} - /* Handle a mips16 GP relative reloc. */ static bfd_reloc_status_type @@ -2227,6 +2237,39 @@ bfd_elf64_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, } } +static reloc_howto_type * +bfd_elf64_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (mips_elf64_howto_table_rela) + / sizeof (mips_elf64_howto_table_rela[0])); i++) + if (mips_elf64_howto_table_rela[i].name != NULL + && strcasecmp (mips_elf64_howto_table_rela[i].name, r_name) == 0) + return &mips_elf64_howto_table_rela[i]; + + for (i = 0; + i < (sizeof (mips16_elf64_howto_table_rela) + / sizeof (mips16_elf64_howto_table_rela[0])); + i++) + if (mips16_elf64_howto_table_rela[i].name != NULL + && strcasecmp (mips16_elf64_howto_table_rela[i].name, r_name) == 0) + return &mips16_elf64_howto_table_rela[i]; + + if (strcasecmp (elf_mips_gnu_vtinherit_howto.name, r_name) == 0) + return &elf_mips_gnu_vtinherit_howto; + if (strcasecmp (elf_mips_gnu_vtentry_howto.name, r_name) == 0) + return &elf_mips_gnu_vtentry_howto; + if (strcasecmp (elf_mips_gnu_rel16_s2.name, r_name) == 0) + return &elf_mips_gnu_rel16_s2; + if (strcasecmp (elf_mips_gnu_rela16_s2.name, r_name) == 0) + return &elf_mips_gnu_rela16_s2; + + return NULL; +} + /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */ static reloc_howto_type * @@ -3059,12 +3102,15 @@ const struct elf_size_info mips_elf64_size_info = #define elf_backend_create_dynamic_sections \ _bfd_mips_elf_create_dynamic_sections #define elf_backend_check_relocs _bfd_mips_elf_check_relocs +#define elf_backend_merge_symbol_attribute \ + _bfd_mips_elf_merge_symbol_attribute #define elf_backend_adjust_dynamic_symbol \ _bfd_mips_elf_adjust_dynamic_symbol #define elf_backend_always_size_sections \ _bfd_mips_elf_always_size_sections #define elf_backend_size_dynamic_sections \ _bfd_mips_elf_size_dynamic_sections +#define elf_backend_init_index_section _bfd_elf_init_1_index_section #define elf_backend_relocate_section _bfd_mips_elf_relocate_section #define elf_backend_finish_dynamic_symbol \ _bfd_mips_elf_finish_dynamic_symbol @@ -3152,10 +3198,8 @@ extern bfd_boolean bfd_elf64_archive_write_armap #define TARGET_BIG_SYM bfd_elf64_bigmips_vec #define TARGET_BIG_NAME "elf64-bigmips" -/* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses - a value of 0x1000, and we are compatible. - FIXME: How does this affect NewABI? */ -#define ELF_MAXPAGESIZE 0x1000 +#define ELF_MAXPAGESIZE 0x10000 +#define ELF_COMMONPAGESIZE 0x1000 #include "elf64-target.h" @@ -3166,15 +3210,15 @@ extern bfd_boolean bfd_elf64_archive_write_armap #undef TARGET_BIG_NAME #undef ELF_MAXPAGESIZE +#undef ELF_COMMONPAGESIZE #define TARGET_LITTLE_SYM bfd_elf64_tradlittlemips_vec #define TARGET_LITTLE_NAME "elf64-tradlittlemips" #define TARGET_BIG_SYM bfd_elf64_tradbigmips_vec #define TARGET_BIG_NAME "elf64-tradbigmips" -/* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses - page sizes of up to that limit, so we need to respect it. */ #define ELF_MAXPAGESIZE 0x10000 +#define ELF_COMMONPAGESIZE 0x1000 #define elf64_bed elf64_tradbed /* Include the target file again for this target. */ diff --git a/contrib/binutils/bfd/elf64-ppc.c b/contrib/binutils/bfd/elf64-ppc.c index 698f8e422c8e..d7decd85e9dd 100644 --- a/contrib/binutils/bfd/elf64-ppc.c +++ b/contrib/binutils/bfd/elf64-ppc.c @@ -1,5 +1,5 @@ /* PowerPC64-specific support for 64-bit ELF. - Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Linus Nordberg, Swox AB <info@swox.com>, based on elf32-ppc.c by Ian Lance Taylor. @@ -25,8 +25,9 @@ http://www.linuxbase.org/spec/ELF/ppc64/PPC-elf64abi.txt, and http://www.linuxbase.org/spec/ELF/ppc64/spec/book1.html */ -#include "bfd.h" #include "sysdep.h" +#include <stdarg.h> +#include "bfd.h" #include "bfdlink.h" #include "libbfd.h" #include "elf-bfd.h" @@ -61,6 +62,7 @@ static bfd_vma opd_entry_value #define ELF_ARCH bfd_arch_powerpc #define ELF_MACHINE_CODE EM_PPC64 #define ELF_MAXPAGESIZE 0x10000 +#define ELF_COMMONPAGESIZE 0x1000 #define elf_info_to_howto ppc64_elf_info_to_howto #define elf_backend_want_got_sym 0 @@ -71,9 +73,11 @@ static bfd_vma opd_entry_value #define elf_backend_can_gc_sections 1 #define elf_backend_can_refcount 1 #define elf_backend_rela_normal 1 +#define elf_backend_default_execstack 0 #define bfd_elf64_mkobject ppc64_elf_mkobject #define bfd_elf64_bfd_reloc_type_lookup ppc64_elf_reloc_type_lookup +#define bfd_elf64_bfd_reloc_name_lookup ppc64_elf_reloc_name_lookup #define bfd_elf64_bfd_merge_private_bfd_data ppc64_elf_merge_private_bfd_data #define bfd_elf64_new_section_hook ppc64_elf_new_section_hook #define bfd_elf64_bfd_link_hash_table_create ppc64_elf_link_hash_table_create @@ -83,10 +87,12 @@ static bfd_vma opd_entry_value #define elf_backend_object_p ppc64_elf_object_p #define elf_backend_grok_prstatus ppc64_elf_grok_prstatus #define elf_backend_grok_psinfo ppc64_elf_grok_psinfo +#define elf_backend_write_core_note ppc64_elf_write_core_note #define elf_backend_create_dynamic_sections ppc64_elf_create_dynamic_sections #define elf_backend_copy_indirect_symbol ppc64_elf_copy_indirect_symbol #define elf_backend_add_symbol_hook ppc64_elf_add_symbol_hook #define elf_backend_check_directives ppc64_elf_check_directives +#define elf_backend_as_needed_cleanup ppc64_elf_as_needed_cleanup #define elf_backend_archive_symbol_lookup ppc64_elf_archive_symbol_lookup #define elf_backend_check_relocs ppc64_elf_check_relocs #define elf_backend_gc_mark_dynamic_ref ppc64_elf_gc_mark_dynamic_ref @@ -96,6 +102,7 @@ static bfd_vma opd_entry_value #define elf_backend_hide_symbol ppc64_elf_hide_symbol #define elf_backend_always_size_sections ppc64_elf_func_desc_adjust #define elf_backend_size_dynamic_sections ppc64_elf_size_dynamic_sections +#define elf_backend_init_index_section _bfd_elf_init_2_index_sections #define elf_backend_action_discarded ppc64_elf_action_discarded #define elf_backend_relocate_section ppc64_elf_relocate_section #define elf_backend_finish_dynamic_symbol ppc64_elf_finish_dynamic_symbol @@ -134,30 +141,29 @@ static bfd_vma opd_entry_value #define BCTR 0x4e800420 /* bctr */ +#define ADDIS_R12_R12 0x3d8c0000 /* addis %r12,%r12,off@ha */ #define ADDIS_R2_R2 0x3c420000 /* addis %r2,%r2,off@ha */ #define ADDI_R2_R2 0x38420000 /* addi %r2,%r2,off@l */ #define LD_R2_40R1 0xe8410028 /* ld %r2,40(%r1) */ -/* glink call stub instructions. We enter with the index in R0, and the - address of glink entry in CTR. From that, we can calculate PLT0. */ +/* glink call stub instructions. We enter with the index in R0. */ #define GLINK_CALL_STUB_SIZE (16*4) -#define MFCTR_R12 0x7d8902a6 /* mfctr %r12 */ -#define SLDI_R11_R0_3 0x780b1f24 /* sldi %r11,%r0,3 */ -#define ADDIC_R2_R0_32K 0x34408000 /* addic. %r2,%r0,-32768 */ -#define SUB_R12_R12_R11 0x7d8b6050 /* sub %r12,%r12,%r11 */ -#define SRADI_R2_R2_63 0x7c42fe76 /* sradi %r2,%r2,63 */ -#define SLDI_R11_R0_2 0x780b1764 /* sldi %r11,%r0,2 */ -#define AND_R2_R2_R11 0x7c425838 /* and %r2,%r2,%r11 */ - /* sub %r12,%r12,%r11 */ -#define ADD_R12_R12_R2 0x7d8c1214 /* add %r12,%r12,%r2 */ -#define ADDIS_R12_R12 0x3d8c0000 /* addis %r12,%r12,xxx@ha */ - /* ld %r11,xxx@l(%r12) */ -#define ADDI_R12_R12 0x398c0000 /* addi %r12,%r12,xxx@l */ - /* ld %r2,8(%r12) */ - /* mtctr %r11 */ - /* ld %r11,16(%r12) */ - /* bctr */ + /* 0: */ + /* .quad plt0-1f */ + /* __glink: */ +#define MFLR_R12 0x7d8802a6 /* mflr %12 */ +#define BCL_20_31 0x429f0005 /* bcl 20,31,1f */ + /* 1: */ +#define MFLR_R11 0x7d6802a6 /* mflr %11 */ +#define LD_R2_M16R11 0xe84bfff0 /* ld %2,(0b-1b)(%11) */ +#define MTLR_R12 0x7d8803a6 /* mtlr %12 */ +#define ADD_R12_R2_R11 0x7d825a14 /* add %12,%2,%11 */ + /* ld %11,0(%12) */ + /* ld %2,8(%12) */ + /* mtctr %11 */ + /* ld %11,16(%12) */ + /* bctr */ /* Pad with this. */ #define NOP 0x60000000 @@ -1193,7 +1199,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = { /* Like R_PPC64_PLTGOT16, but for instructions with a DS field. */ /* FIXME: R_PPC64_PLTGOT16_DS not implemented. */ - HOWTO (R_PPC64_PLTGOT16_DS, /* type */ + HOWTO (R_PPC64_PLTGOT16_DS, /* type */ 0, /* rightshift */ 1, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ @@ -2106,6 +2112,22 @@ ppc64_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return ppc64_elf_howto_table[r]; }; +static reloc_howto_type * +ppc64_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (ppc64_elf_howto_raw) / sizeof (ppc64_elf_howto_raw[0]); + i++) + if (ppc64_elf_howto_raw[i].name != NULL + && strcasecmp (ppc64_elf_howto_raw[i].name, r_name) == 0) + return &ppc64_elf_howto_raw[i]; + + return NULL; +} + /* Set the howto pointer for a PowerPC ELF reloc. */ static void @@ -2376,14 +2398,9 @@ struct ppc64_elf_obj_tdata asection *got; asection *relgot; - union { - /* Used during garbage collection. We attach global symbols defined - on removed .opd entries to this section so that the sym is removed. */ - asection *deleted_section; - - /* Used when adding symbols. */ - bfd_boolean has_dotsym; - } u; + /* Used during garbage collection. We attach global symbols defined + on removed .opd entries to this section so that the sym is removed. */ + asection *deleted_section; /* TLS local dynamic got entry handling. Suppose for multiple GOT sections means we potentially need one of these for each input bfd. */ @@ -2407,11 +2424,14 @@ struct ppc64_elf_obj_tdata static bfd_boolean ppc64_elf_mkobject (bfd *abfd) { - bfd_size_type amt = sizeof (struct ppc64_elf_obj_tdata); - abfd->tdata.any = bfd_zalloc (abfd, amt); if (abfd->tdata.any == NULL) - return FALSE; - return TRUE; + { + bfd_size_type amt = sizeof (struct ppc64_elf_obj_tdata); + abfd->tdata.any = bfd_zalloc (abfd, amt); + if (abfd->tdata.any == NULL) + return FALSE; + } + return bfd_elf_mkobject (abfd); } /* Return 1 if target is one of ours. */ @@ -2484,6 +2504,53 @@ ppc64_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) return TRUE; } +static char * +ppc64_elf_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type, + ...) +{ + switch (note_type) + { + default: + return NULL; + + case NT_PRPSINFO: + { + char data[136]; + va_list ap; + + va_start (ap, note_type); + memset (data, 0, 40); + strncpy (data + 40, va_arg (ap, const char *), 16); + strncpy (data + 56, va_arg (ap, const char *), 80); + va_end (ap); + return elfcore_write_note (abfd, buf, bufsiz, + "CORE", note_type, data, sizeof (data)); + } + + case NT_PRSTATUS: + { + char data[504]; + va_list ap; + long pid; + int cursig; + const void *greg; + + va_start (ap, note_type); + memset (data, 0, 112); + pid = va_arg (ap, long); + bfd_put_32 (abfd, pid, data + 32); + cursig = va_arg (ap, int); + bfd_put_16 (abfd, cursig, data + 12); + greg = va_arg (ap, const void *); + memcpy (data + 112, greg, 384); + memset (data + 496, 0, 8); + va_end (ap); + return elfcore_write_note (abfd, buf, bufsiz, + "CORE", note_type, data, sizeof (data)); + } + } +} + /* Merge backend specific data from an object file to the output object file when linking. */ @@ -2517,13 +2584,19 @@ ppc64_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) static const struct bfd_elf_special_section ppc64_elf_special_sections[]= { - { ".plt", 4, 0, SHT_NOBITS, 0 }, - { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, - { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".toc", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".toc1", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".tocbss", 7, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, - { NULL, 0, 0, 0, 0 } + { STRING_COMMA_LEN (".plt"), 0, SHT_NOBITS, 0 }, + { STRING_COMMA_LEN (".sbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { STRING_COMMA_LEN (".sdata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { STRING_COMMA_LEN (".toc"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { STRING_COMMA_LEN (".toc1"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { STRING_COMMA_LEN (".tocbss"), 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { NULL, 0, 0, 0, 0 } +}; + +enum _ppc64_sec_type { + sec_normal = 0, + sec_opd = 1, + sec_toc = 2 }; struct _ppc64_elf_section_data @@ -2534,14 +2607,20 @@ struct _ppc64_elf_section_data union { /* Points to the function code section for local opd entries. */ - asection **func_sec; + asection **opd_func_sec; /* After editing .opd, adjust references to opd local syms. */ - long *adjust; - } opd; + long *opd_adjust; - /* An array for toc sections, indexed by offset/8. - Specifies the relocation symbol index used at a given toc offset. */ - unsigned *t_symndx; + /* An array for toc sections, indexed by offset/8. + Specifies the relocation symbol index used at a given toc offset. */ + unsigned *t_symndx; + } u; + + enum _ppc64_sec_type sec_type:2; + + /* Flag set when small branches are detected. Used to + select suitable defaults for the stub group size. */ + unsigned int has_14bit_branch:1; }; #define ppc64_elf_section_data(sec) \ @@ -2550,13 +2629,16 @@ struct _ppc64_elf_section_data static bfd_boolean ppc64_elf_new_section_hook (bfd *abfd, asection *sec) { - struct _ppc64_elf_section_data *sdata; - bfd_size_type amt = sizeof (*sdata); + if (!sec->used_by_bfd) + { + struct _ppc64_elf_section_data *sdata; + bfd_size_type amt = sizeof (*sdata); - sdata = bfd_zalloc (abfd, amt); - if (sdata == NULL) - return FALSE; - sec->used_by_bfd = sdata; + sdata = bfd_zalloc (abfd, amt); + if (sdata == NULL) + return FALSE; + sec->used_by_bfd = sdata; + } return _bfd_elf_new_section_hook (abfd, sec); } @@ -2566,8 +2648,8 @@ get_opd_info (asection * sec) { if (sec != NULL && ppc64_elf_section_data (sec) != NULL - && ppc64_elf_section_data (sec)->opd.adjust != NULL) - return ppc64_elf_section_data (sec)->opd.adjust; + && ppc64_elf_section_data (sec)->sec_type == sec_opd) + return ppc64_elf_section_data (sec)->u.opd_adjust; return NULL; } @@ -3234,9 +3316,14 @@ struct ppc_link_hash_entry { struct elf_link_hash_entry elf; - /* A pointer to the most recently used stub hash entry against this - symbol. */ - struct ppc_stub_hash_entry *stub_cache; + union { + /* A pointer to the most recently used stub hash entry against this + symbol. */ + struct ppc_stub_hash_entry *stub_cache; + + /* A pointer to the next symbol starting with a '.' */ + struct ppc_link_hash_entry *next_dot_sym; + } u; /* Track dynamic relocs copied for this symbol. */ struct ppc_dyn_relocs *dyn_relocs; @@ -3314,6 +3401,9 @@ struct ppc_link_hash_table /* Highest output section index. */ int top_index; + /* Used when adding symbols. */ + struct ppc_link_hash_entry *dot_syms; + /* List of input sections for each output section. */ asection **input_list; @@ -3348,10 +3438,6 @@ struct ppc_link_hash_table /* Set on error. */ unsigned int stub_error:1; - /* Flag set when small branches are detected. Used to - select suitable defaults for the stub group size. */ - unsigned int has_14bit_branch:1; - /* Temp used by ppc64_elf_check_directives. */ unsigned int twiddled_syms:1; @@ -3470,9 +3556,34 @@ link_hash_newfunc (struct bfd_hash_entry *entry, { struct ppc_link_hash_entry *eh = (struct ppc_link_hash_entry *) entry; - memset (&eh->stub_cache, 0, + memset (&eh->u.stub_cache, 0, (sizeof (struct ppc_link_hash_entry) - - offsetof (struct ppc_link_hash_entry, stub_cache))); + - offsetof (struct ppc_link_hash_entry, u.stub_cache))); + + /* When making function calls, old ABI code references function entry + points (dot symbols), while new ABI code references the function + descriptor symbol. We need to make any combination of reference and + definition work together, without breaking archive linking. + + For a defined function "foo" and an undefined call to "bar": + An old object defines "foo" and ".foo", references ".bar" (possibly + "bar" too). + A new object defines "foo" and references "bar". + + A new object thus has no problem with its undefined symbols being + satisfied by definitions in an old object. On the other hand, the + old object won't have ".bar" satisfied by a new object. + + Keep a list of newly added dot-symbols. */ + + if (string[0] == '.') + { + struct ppc_link_hash_table *htab; + + htab = (struct ppc_link_hash_table *) table; + eh->u.next_dot_sym = htab->dot_syms; + htab->dot_syms = eh; + } } return entry; @@ -3618,11 +3729,11 @@ ppc_get_stub_entry (const asection *input_section, distinguish between them. */ id_sec = htab->stub_group[input_section->id].link_sec; - if (h != NULL && h->stub_cache != NULL - && h->stub_cache->h == h - && h->stub_cache->id_sec == id_sec) + if (h != NULL && h->u.stub_cache != NULL + && h->u.stub_cache->h == h + && h->u.stub_cache->id_sec == id_sec) { - stub_entry = h->stub_cache; + stub_entry = h->u.stub_cache; } else { @@ -3635,7 +3746,7 @@ ppc_get_stub_entry (const asection *input_section, stub_entry = ppc_stub_hash_lookup (&htab->stub_hash_table, stub_name, FALSE, FALSE); if (h != NULL) - h->stub_cache = stub_entry; + h->u.stub_cache = stub_entry; free (stub_name); } @@ -3721,49 +3832,26 @@ create_linkage_sections (bfd *dynobj, struct bfd_link_info *info) htab->glink = bfd_make_section_anyway_with_flags (dynobj, ".glink", flags); if (htab->glink == NULL - || ! bfd_set_section_alignment (dynobj, htab->glink, 2)) + || ! bfd_set_section_alignment (dynobj, htab->glink, 3)) return FALSE; /* Create branch lookup table for plt_branch stubs. */ - if (info->shared) - { - flags = (SEC_ALLOC | SEC_LOAD - | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); - htab->brlt - = bfd_make_section_anyway_with_flags (dynobj, ".data.rel.ro.brlt", - flags); - } - else - { - flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY - | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); - htab->brlt - = bfd_make_section_anyway_with_flags (dynobj, ".rodata.brlt", flags); - } - + flags = (SEC_ALLOC | SEC_LOAD + | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); + htab->brlt = bfd_make_section_anyway_with_flags (dynobj, ".branch_lt", + flags); if (htab->brlt == NULL || ! bfd_set_section_alignment (dynobj, htab->brlt, 3)) return FALSE; - if (info->shared) - { - flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY - | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); - htab->relbrlt - = bfd_make_section_anyway_with_flags (dynobj, ".rela.data.rel.ro.brlt", - flags); - } - else if (info->emitrelocations) - { - flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY - | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); - htab->relbrlt - = bfd_make_section_anyway_with_flags (dynobj, ".rela.rodata.brlt", - flags); - } - else + if (!info->shared) return TRUE; + flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY + | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); + htab->relbrlt = bfd_make_section_anyway_with_flags (dynobj, + ".rela.branch_lt", + flags); if (!htab->relbrlt || ! bfd_set_section_alignment (dynobj, htab->relbrlt, 3)) return FALSE; @@ -4044,29 +4132,14 @@ make_fdh (struct bfd_link_info *info, return fdh; } -/* Hacks to support old ABI code. - When making function calls, old ABI code references function entry - points (dot symbols), while new ABI code references the function - descriptor symbol. We need to make any combination of reference and - definition work together, without breaking archive linking. - - For a defined function "foo" and an undefined call to "bar": - An old object defines "foo" and ".foo", references ".bar" (possibly - "bar" too). - A new object defines "foo" and references "bar". - - A new object thus has no problem with its undefined symbols being - satisfied by definitions in an old object. On the other hand, the - old object won't have ".bar" satisfied by a new object. */ - /* Fix function descriptor symbols defined in .opd sections to be function type. */ static bfd_boolean -ppc64_elf_add_symbol_hook (bfd *ibfd, +ppc64_elf_add_symbol_hook (bfd *ibfd ATTRIBUTE_UNUSED, struct bfd_link_info *info ATTRIBUTE_UNUSED, Elf_Internal_Sym *isym, - const char **name, + const char **name ATTRIBUTE_UNUSED, flagword *flags ATTRIBUTE_UNUSED, asection **sec, bfd_vma *value ATTRIBUTE_UNUSED) @@ -4075,12 +4148,6 @@ ppc64_elf_add_symbol_hook (bfd *ibfd, && strcmp (bfd_get_section_name (ibfd, *sec), ".opd") == 0) isym->st_info = ELF_ST_INFO (ELF_ST_BIND (isym->st_info), STT_FUNC); - if ((*name)[0] == '.' - && ELF_ST_BIND (isym->st_info) == STB_GLOBAL - && ELF_ST_TYPE (isym->st_info) < STT_SECTION - && is_ppc64_elf_target (ibfd->xvec)) - ppc64_elf_tdata (ibfd)->u.has_dotsym = 1; - return TRUE; } @@ -4129,35 +4196,25 @@ ppc64_elf_archive_symbol_lookup (bfd *abfd, most restrictive visibility of the function descriptor and the function entry symbol is used. */ -struct add_symbol_adjust_data -{ - struct bfd_link_info *info; - bfd_boolean ok; -}; - static bfd_boolean -add_symbol_adjust (struct elf_link_hash_entry *h, void *inf) +add_symbol_adjust (struct ppc_link_hash_entry *eh, struct bfd_link_info *info) { - struct add_symbol_adjust_data *data; struct ppc_link_hash_table *htab; - struct ppc_link_hash_entry *eh; struct ppc_link_hash_entry *fdh; - if (h->root.type == bfd_link_hash_indirect) + if (eh->elf.root.type == bfd_link_hash_indirect) return TRUE; - if (h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (eh->elf.root.type == bfd_link_hash_warning) + eh = (struct ppc_link_hash_entry *) eh->elf.root.u.i.link; - if (h->root.root.string[0] != '.') - return TRUE; + if (eh->elf.root.root.string[0] != '.') + abort (); - data = inf; - htab = ppc_hash_table (data->info); - eh = (struct ppc_link_hash_entry *) h; + htab = ppc_hash_table (info); fdh = get_fdh (eh, htab); if (fdh == NULL - && !data->info->relocatable + && !info->relocatable && (eh->elf.root.type == bfd_link_hash_undefined || eh->elf.root.type == bfd_link_hash_undefweak) && eh->elf.ref_regular) @@ -4165,9 +4222,9 @@ add_symbol_adjust (struct elf_link_hash_entry *h, void *inf) /* Make an undefweak function descriptor sym, which is enough to pull in an --as-needed shared lib, but won't cause link errors. Archives are handled elsewhere. */ - fdh = make_fdh (data->info, eh); + fdh = make_fdh (info, eh); if (fdh == NULL) - data->ok = FALSE; + return FALSE; else fdh->elf.ref_regular = 1; } @@ -4193,26 +4250,37 @@ add_symbol_adjust (struct elf_link_hash_entry *h, void *inf) return TRUE; } +/* Process list of dot-symbols we made in link_hash_newfunc. */ + static bfd_boolean -ppc64_elf_check_directives (bfd *abfd, struct bfd_link_info *info) +ppc64_elf_check_directives (bfd *ibfd, struct bfd_link_info *info) { struct ppc_link_hash_table *htab; - struct add_symbol_adjust_data data; - - if (!is_ppc64_elf_target (abfd->xvec)) - return TRUE; - - if (!ppc64_elf_tdata (abfd)->u.has_dotsym) - return TRUE; - ppc64_elf_tdata (abfd)->u.deleted_section = NULL; + struct ppc_link_hash_entry **p, *eh; htab = ppc_hash_table (info); if (!is_ppc64_elf_target (htab->elf.root.creator)) return TRUE; - data.info = info; - data.ok = TRUE; - elf_link_hash_traverse (&htab->elf, add_symbol_adjust, &data); + if (is_ppc64_elf_target (ibfd->xvec)) + { + p = &htab->dot_syms; + while ((eh = *p) != NULL) + { + *p = NULL; + if (!add_symbol_adjust (eh, info)) + return FALSE; + p = &eh->u.next_dot_sym; + } + } + + /* Clear the list for non-ppc64 input files. */ + p = &htab->dot_syms; + while ((eh = *p) != NULL) + { + *p = NULL; + p = &eh->u.next_dot_sym; + } /* We need to fix the undefs list for any syms we have twiddled to undef_weak. */ @@ -4221,7 +4289,18 @@ ppc64_elf_check_directives (bfd *abfd, struct bfd_link_info *info) bfd_link_repair_undef_list (&htab->elf.root); htab->twiddled_syms = 0; } - return data.ok; + return TRUE; +} + +/* Undo hash table changes when an --as-needed input file is determined + not to be needed. */ + +static bfd_boolean +ppc64_elf_as_needed_cleanup (bfd *ibfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info) +{ + ppc_hash_table (info)->dot_syms = NULL; + return TRUE; } static bfd_boolean @@ -4358,7 +4437,9 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, opd_sym_map = bfd_zalloc (abfd, amt); if (opd_sym_map == NULL) return FALSE; - ppc64_elf_section_data (sec)->opd.func_sec = opd_sym_map; + ppc64_elf_section_data (sec)->u.opd_func_sec = opd_sym_map; + BFD_ASSERT (ppc64_elf_section_data (sec)->sec_type == sec_normal); + ppc64_elf_section_data (sec)->sec_type = sec_opd; } if (htab->sfpr == NULL @@ -4372,6 +4453,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, struct elf_link_hash_entry *h; enum elf_ppc64_reloc_type r_type; int tls_type = 0; + struct _ppc64_elf_section_data *ppc64_sec; r_symndx = ELF64_R_SYM (rel->r_info); if (r_symndx < symtab_hdr->sh_info) @@ -4553,7 +4635,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, dest = bfd_section_from_r_symndx (abfd, &htab->sym_sec, sec, r_symndx); if (dest != sec) - htab->has_14bit_branch = 1; + ppc64_elf_section_data (sec)->has_14bit_branch = 1; } /* Fall through. */ @@ -4569,7 +4651,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, || h == &htab->tls_get_addr_fd->elf) sec->has_tls_reloc = 1; else if (htab->tls_get_addr == NULL - && !strncmp (h->root.root.string, ".__tls_get_addr", 15) + && CONST_STRNEQ (h->root.root.string, ".__tls_get_addr") && (h->root.root.string[15] == 0 || h->root.root.string[15] == '@')) { @@ -4577,7 +4659,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, sec->has_tls_reloc = 1; } else if (htab->tls_get_addr_fd == NULL - && !strncmp (h->root.root.string, "__tls_get_addr", 14) + && CONST_STRNEQ (h->root.root.string, "__tls_get_addr") && (h->root.root.string[14] == 0 || h->root.root.string[14] == '@')) { @@ -4624,23 +4706,26 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, rel->r_addend, tls_type)) return FALSE; - if (ppc64_elf_section_data (sec)->t_symndx == NULL) + ppc64_sec = ppc64_elf_section_data (sec); + if (ppc64_sec->sec_type != sec_toc) { /* One extra to simplify get_tls_mask. */ bfd_size_type amt = sec->size * sizeof (unsigned) / 8 + 1; - ppc64_elf_section_data (sec)->t_symndx = bfd_zalloc (abfd, amt); - if (ppc64_elf_section_data (sec)->t_symndx == NULL) + ppc64_sec->u.t_symndx = bfd_zalloc (abfd, amt); + if (ppc64_sec->u.t_symndx == NULL) return FALSE; + BFD_ASSERT (ppc64_sec->sec_type == sec_normal); + ppc64_sec->sec_type = sec_toc; } BFD_ASSERT (rel->r_offset % 8 == 0); - ppc64_elf_section_data (sec)->t_symndx[rel->r_offset / 8] = r_symndx; + ppc64_sec->u.t_symndx[rel->r_offset / 8] = r_symndx; /* Mark the second slot of a GD or LD entry. -1 to indicate GD and -2 to indicate LD. */ if (tls_type == (TLS_EXPLICIT | TLS_TLS | TLS_GD)) - ppc64_elf_section_data (sec)->t_symndx[rel->r_offset / 8 + 1] = -1; + ppc64_sec->u.t_symndx[rel->r_offset / 8 + 1] = -1; else if (tls_type == (TLS_EXPLICIT | TLS_TLS | TLS_LD)) - ppc64_elf_section_data (sec)->t_symndx[rel->r_offset / 8 + 1] = -2; + ppc64_sec->u.t_symndx[rel->r_offset / 8 + 1] = -2; goto dodyn; case R_PPC64_TPREL16: @@ -4770,7 +4855,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, if (name == NULL) return FALSE; - if (strncmp (name, ".rela", 5) != 0 + if (! CONST_STRNEQ (name, ".rela") || strcmp (bfd_get_section_name (abfd, sec), name + 5) != 0) { @@ -5714,7 +5799,6 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, { struct ppc_link_hash_table *htab; asection *s; - unsigned int power_of_two; htab = ppc_hash_table (info); @@ -5766,6 +5850,10 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, if (!h->non_got_ref) return TRUE; + /* Don't generate a copy reloc for symbols defined in the executable. */ + if (!h->def_dynamic || !h->ref_regular || h->def_regular) + return TRUE; + if (ELIMINATE_COPY_RELOCS) { struct ppc_link_hash_entry * eh; @@ -5831,29 +5919,9 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, h->needs_copy = 1; } - /* We need to figure out the alignment required for this symbol. I - have no idea how ELF linkers handle this. */ - power_of_two = bfd_log2 (h->size); - if (power_of_two > 4) - power_of_two = 4; - - /* Apply the required alignment. */ s = htab->dynbss; - s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); - if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s)) - { - if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two)) - return FALSE; - } - /* Define the symbol as being at this point in the section. */ - h->root.u.def.section = s; - h->root.u.def.value = s->size; - - /* Increment the section size to make room for the symbol. */ - s->size += h->size; - - return TRUE; + return _bfd_elf_adjust_dynamic_copy (h, s); } /* If given a function descriptor symbol, hide both the function code @@ -6036,7 +6104,7 @@ get_tls_mask (char **tls_maskp, unsigned long *toc_symndx, if ((*tls_maskp != NULL && **tls_maskp != 0) || sec == NULL - || ppc64_elf_section_data (sec)->t_symndx == NULL) + || ppc64_elf_section_data (sec)->sec_type != sec_toc) return 1; /* Look inside a TOC section too. */ @@ -6049,8 +6117,8 @@ get_tls_mask (char **tls_maskp, unsigned long *toc_symndx, off = sym->st_value; off += rel->r_addend; BFD_ASSERT (off % 8 == 0); - r_symndx = ppc64_elf_section_data (sec)->t_symndx[off / 8]; - next_r = ppc64_elf_section_data (sec)->t_symndx[off / 8 + 1]; + r_symndx = ppc64_elf_section_data (sec)->u.t_symndx[off / 8]; + next_r = ppc64_elf_section_data (sec)->u.t_symndx[off / 8 + 1]; if (!get_sym_h (&h, &sym, &sec, tls_maskp, locsymsp, r_symndx, ibfd)) return 0; if (toc_symndx != NULL) @@ -6096,13 +6164,13 @@ adjust_opd_syms (struct elf_link_hash_entry *h, void *inf ATTRIBUTE_UNUSED) if (adjust == -1) { /* This entry has been deleted. */ - asection *dsec = ppc64_elf_tdata (sym_sec->owner)->u.deleted_section; + asection *dsec = ppc64_elf_tdata (sym_sec->owner)->deleted_section; if (dsec == NULL) { for (dsec = sym_sec->owner->sections; dsec; dsec = dsec->next) if (elf_discarded_section (dsec)) { - ppc64_elf_tdata (sym_sec->owner)->u.deleted_section = dsec; + ppc64_elf_tdata (sym_sec->owner)->deleted_section = dsec; break; } } @@ -6291,7 +6359,9 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info, opd_adjust = bfd_alloc (obfd, amt); if (opd_adjust == NULL) return FALSE; - ppc64_elf_section_data (sec)->opd.adjust = opd_adjust; + ppc64_elf_section_data (sec)->u.opd_adjust = opd_adjust; + BFD_ASSERT (ppc64_elf_section_data (sec)->sec_type == sec_normal); + ppc64_elf_section_data (sec)->sec_type = sec_opd; } memset (opd_adjust, 0, amt); @@ -6601,7 +6671,7 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info, sec->contents = new_contents; } - /* Fudge the size too, as this is used later in + /* Fudge the header size too, as this is used later in elf_bfd_final_link if we are emitting relocs. */ elf_section_data (sec)->rel_hdr.sh_size = sec->reloc_count * elf_section_data (sec)->rel_hdr.sh_entsize; @@ -7907,7 +7977,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* Strip this section if we don't need it; see the comment below. */ } - else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0) + else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela")) { if (s->size != 0) { @@ -8302,6 +8372,33 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) rl += htab->relbrlt->reloc_count++ * sizeof (Elf64_External_Rela); bfd_elf64_swap_reloca_out (htab->relbrlt->owner, &rela, rl); } + else if (info->emitrelocations) + { + Elf_Internal_Rela *relocs, *r; + struct bfd_elf_section_data *elfsec_data; + + elfsec_data = elf_section_data (htab->brlt); + relocs = elfsec_data->relocs; + if (relocs == NULL) + { + bfd_size_type relsize; + relsize = htab->brlt->reloc_count * sizeof (*relocs); + relocs = bfd_alloc (htab->brlt->owner, relsize); + if (relocs == NULL) + return FALSE; + elfsec_data->relocs = relocs; + elfsec_data->rel_hdr.sh_size = relsize; + elfsec_data->rel_hdr.sh_entsize = 24; + htab->brlt->reloc_count = 0; + } + r = relocs + htab->brlt->reloc_count; + htab->brlt->reloc_count += 1; + r->r_offset = (br_entry->offset + + htab->brlt->output_offset + + htab->brlt->output_section->vma); + r->r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE); + r->r_addend = off; + } off = (br_entry->offset + htab->brlt->output_offset @@ -8531,6 +8628,11 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) if (htab->relbrlt != NULL) htab->relbrlt->size += sizeof (Elf64_External_Rela); + else if (info->emitrelocations) + { + htab->brlt->reloc_count += 1; + htab->brlt->flags |= SEC_RELOC; + } } stub_entry->stub_type += ppc_stub_plt_branch - ppc_stub_long_branch; @@ -8538,11 +8640,11 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) if (stub_entry->stub_type != ppc_stub_plt_branch) size = 28; } - - if (info->emitrelocations - && (stub_entry->stub_type == ppc_stub_long_branch - || stub_entry->stub_type == ppc_stub_long_branch_r2off)) - stub_entry->stub_sec->reloc_count += 1; + else if (info->emitrelocations) + { + stub_entry->stub_sec->reloc_count += 1; + stub_entry->stub_sec->flags |= SEC_RELOC; + } } stub_entry->stub_sec->size += size; @@ -8925,7 +9027,29 @@ group_sections (struct ppc_link_hash_table *htab, bfd_size_type stub_group_size, bfd_boolean stubs_always_before_branch) { - asection **list = htab->input_list + htab->top_index; + asection **list; + bfd_size_type stub14_group_size; + bfd_boolean suppress_size_errors; + + suppress_size_errors = FALSE; + stub14_group_size = stub_group_size; + if (stub_group_size == 1) + { + /* Default values. */ + if (stubs_always_before_branch) + { + stub_group_size = 0x1e00000; + stub14_group_size = 0x7800; + } + else + { + stub_group_size = 0x1c00000; + stub14_group_size = 0x7000; + } + suppress_size_errors = TRUE; + } + + list = htab->input_list + htab->top_index; do { asection *tail = *list; @@ -8939,15 +9063,17 @@ group_sections (struct ppc_link_hash_table *htab, curr = tail; total = tail->size; - big_sec = total > stub_group_size; - if (big_sec) + big_sec = total > (ppc64_elf_section_data (tail)->has_14bit_branch + ? stub14_group_size : stub_group_size); + if (big_sec && !suppress_size_errors) (*_bfd_error_handler) (_("%B section %A exceeds stub group size"), tail->owner, tail); curr_toc = htab->stub_group[tail->id].toc_off; while ((prev = PREV_SEC (curr)) != NULL && ((total += curr->output_offset - prev->output_offset) - < stub_group_size) + < (ppc64_elf_section_data (prev)->has_14bit_branch + ? stub14_group_size : stub_group_size)) && htab->stub_group[prev->id].toc_off == curr_toc) curr = prev; @@ -8979,7 +9105,8 @@ group_sections (struct ppc_link_hash_table *htab, total = 0; while (prev != NULL && ((total += tail->output_offset - prev->output_offset) - < stub_group_size) + < (ppc64_elf_section_data (prev)->has_14bit_branch + ? stub14_group_size : stub_group_size)) && htab->stub_group[prev->id].toc_off == curr_toc) { tail = prev; @@ -9020,22 +9147,6 @@ ppc64_elf_size_stubs (bfd *output_bfd, stub_group_size = -group_size; else stub_group_size = group_size; - if (stub_group_size == 1) - { - /* Default values. */ - if (stubs_always_before_branch) - { - stub_group_size = 0x1e00000; - if (htab->has_14bit_branch) - stub_group_size = 0x7800; - } - else - { - stub_group_size = 0x1c00000; - if (htab->has_14bit_branch) - stub_group_size = 0x7000; - } - } group_sections (htab, stub_group_size, stubs_always_before_branch); @@ -9073,6 +9184,9 @@ ppc64_elf_size_stubs (bfd *output_bfd, /* If there aren't any relocs, then there's nothing more to do. */ if ((section->flags & SEC_RELOC) == 0 + || (section->flags & SEC_ALLOC) == 0 + || (section->flags & SEC_LOAD) == 0 + || (section->flags & SEC_CODE) == 0 || section->reloc_count == 0) continue; @@ -9322,9 +9436,12 @@ ppc64_elf_size_stubs (bfd *output_bfd, stub_sec->rawsize = stub_sec->size; stub_sec->size = 0; stub_sec->reloc_count = 0; + stub_sec->flags &= ~SEC_RELOC; } htab->brlt->size = 0; + htab->brlt->reloc_count = 0; + htab->brlt->flags &= ~SEC_RELOC; if (htab->relbrlt != NULL) htab->relbrlt->size = 0; @@ -9442,24 +9559,12 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms, stub_sec->size = 0; } - if (htab->glink != NULL && htab->glink->contents != NULL) + if (htab->glink != NULL && htab->glink->size != 0) { unsigned int indx; bfd_vma plt0; /* Build the .glink plt call stub. */ - plt0 = (htab->plt->output_section->vma - + htab->plt->output_offset - - (htab->glink->output_section->vma - + htab->glink->output_offset - + GLINK_CALL_STUB_SIZE)); - if (plt0 + 0x80008000 > 0xffffffff) - { - (*_bfd_error_handler) (_(".glink and .plt too far apart")); - bfd_set_error (bfd_error_bad_value); - return FALSE; - } - if (htab->emit_stub_syms) { struct elf_link_hash_entry *h; @@ -9470,7 +9575,7 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms, { h->root.type = bfd_link_hash_defined; h->root.u.def.section = htab->glink; - h->root.u.def.value = 0; + h->root.u.def.value = 8; h->ref_regular = 1; h->def_regular = 1; h->ref_regular_nonweak = 1; @@ -9479,29 +9584,26 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms, } } p = htab->glink->contents; - bfd_put_32 (htab->glink->owner, MFCTR_R12, p); - p += 4; - bfd_put_32 (htab->glink->owner, SLDI_R11_R0_3, p); - p += 4; - bfd_put_32 (htab->glink->owner, ADDIC_R2_R0_32K, p); - p += 4; - bfd_put_32 (htab->glink->owner, SUB_R12_R12_R11, p); - p += 4; - bfd_put_32 (htab->glink->owner, SRADI_R2_R2_63, p); - p += 4; - bfd_put_32 (htab->glink->owner, SLDI_R11_R0_2, p); + plt0 = (htab->plt->output_section->vma + + htab->plt->output_offset + - (htab->glink->output_section->vma + + htab->glink->output_offset + + 16)); + bfd_put_64 (htab->glink->owner, plt0, p); + p += 8; + bfd_put_32 (htab->glink->owner, MFLR_R12, p); p += 4; - bfd_put_32 (htab->glink->owner, AND_R2_R2_R11, p); + bfd_put_32 (htab->glink->owner, BCL_20_31, p); p += 4; - bfd_put_32 (htab->glink->owner, SUB_R12_R12_R11, p); + bfd_put_32 (htab->glink->owner, MFLR_R11, p); p += 4; - bfd_put_32 (htab->glink->owner, ADD_R12_R12_R2, p); + bfd_put_32 (htab->glink->owner, LD_R2_M16R11, p); p += 4; - bfd_put_32 (htab->glink->owner, ADDIS_R12_R12 | PPC_HA (plt0), p); + bfd_put_32 (htab->glink->owner, MTLR_R12, p); p += 4; - bfd_put_32 (htab->glink->owner, LD_R11_0R12 | PPC_LO (plt0), p); + bfd_put_32 (htab->glink->owner, ADD_R12_R2_R11, p); p += 4; - bfd_put_32 (htab->glink->owner, ADDI_R12_R12 | PPC_LO (plt0), p); + bfd_put_32 (htab->glink->owner, LD_R11_0R12, p); p += 4; bfd_put_32 (htab->glink->owner, LD_R2_0R12 | 8, p); p += 4; @@ -9511,6 +9613,11 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms, p += 4; bfd_put_32 (htab->glink->owner, BCTR, p); p += 4; + while (p - htab->glink->contents < GLINK_CALL_STUB_SIZE) + { + bfd_put_32 (htab->glink->owner, NOP, p); + p += 4; + } /* Build the .glink lazy link call stubs. */ indx = 0; @@ -9529,7 +9636,7 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms, p += 4; } bfd_put_32 (htab->glink->owner, - B_DOT | ((htab->glink->contents - p) & 0x3fffffc), p); + B_DOT | ((htab->glink->contents - p + 8) & 0x3fffffc), p); indx++; p += 4; } @@ -9554,6 +9661,9 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms, /* Build the stubs as directed by the stub hash table. */ bfd_hash_traverse (&htab->stub_hash_table, ppc_build_one_stub, info); + if (htab->relbrlt != NULL) + htab->relbrlt->reloc_count = 0; + for (stub_sec = htab->stub_bfd->sections; stub_sec != NULL; stub_sec = stub_sec->next) @@ -9698,6 +9808,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, bfd_boolean is_opd; /* Disabled until we sort out how ld should choose 'y' vs 'at'. */ bfd_boolean is_power4 = FALSE; + bfd_vma d_offset = (bfd_big_endian (output_bfd) ? 2 : 0); /* Initialize howto table if needed. */ if (!ppc64_elf_howto_table[R_PPC64_ADDR32]) @@ -9713,7 +9824,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, TOCstart = elf_gp (output_bfd); symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); - is_opd = ppc64_elf_section_data (input_section)->opd.adjust != NULL; + is_opd = ppc64_elf_section_data (input_section)->sec_type == sec_opd; rel = relocs; relend = relocs + input_section->reloc_count; @@ -9788,13 +9899,9 @@ ppc64_elf_relocate_section (bfd *output_bfd, relocation += adjust; } } - if (info->relocatable) - continue; } else { - if (info->relocatable) - continue; RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, r_symndx, symtab_hdr, sym_hashes, h_elf, sec, relocation, @@ -9804,6 +9911,21 @@ ppc64_elf_relocate_section (bfd *output_bfd, } h = (struct ppc_link_hash_entry *) h_elf; + if (sec != NULL && elf_discarded_section (sec)) + { + /* For relocs against symbols from removed linkonce sections, + or sections discarded by a linker script, we just want the + section contents zeroed. Avoid any special processing. */ + _bfd_clear_contents (ppc64_elf_howto_table[r_type], input_bfd, + contents + rel->r_offset); + rel->r_info = 0; + rel->r_addend = 0; + continue; + } + + if (info->relocatable) + continue; + /* TLS optimizations. Replace instruction sequences and relocs based on information we collected in tls_optimize. We edit RELOCS so that --emit-relocs will output something sensible @@ -9927,10 +10049,10 @@ ppc64_elf_relocate_section (bfd *output_bfd, && (tls_mask & TLS_TPREL) == 0) { toctprel: - insn = bfd_get_32 (output_bfd, contents + rel->r_offset - 2); + insn = bfd_get_32 (output_bfd, contents + rel->r_offset - d_offset); insn &= 31 << 21; insn |= 0x3c0d0000; /* addis 0,13,0 */ - bfd_put_32 (output_bfd, insn, contents + rel->r_offset - 2); + bfd_put_32 (output_bfd, insn, contents + rel->r_offset - d_offset); r_type = R_PPC64_TPREL16_HA; if (toc_symndx != 0) { @@ -9982,8 +10104,8 @@ ppc64_elf_relocate_section (bfd *output_bfd, insn |= rtra; bfd_put_32 (output_bfd, insn, contents + rel->r_offset); /* Was PPC64_TLS which sits on insn boundary, now - PPC64_TPREL16_LO which is at insn+2. */ - rel->r_offset += 2; + PPC64_TPREL16_LO which is at low-order half-word. */ + rel->r_offset += d_offset; r_type = R_PPC64_TPREL16_LO; if (toc_symndx != 0) { @@ -10016,7 +10138,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, else { bfd_put_32 (output_bfd, NOP, contents + rel->r_offset); - rel->r_offset -= 2; + rel->r_offset -= d_offset; r_type = R_PPC64_NONE; } rel->r_info = ELF64_R_INFO (r_symndx, r_type); @@ -10065,7 +10187,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, /* OK, it checks out. Replace the call. */ offset = rel[1].r_offset; insn1 = bfd_get_32 (output_bfd, - contents + rel->r_offset - 2); + contents + rel->r_offset - d_offset); insn3 = bfd_get_32 (output_bfd, contents + offset + 4); if ((tls_mask & tls_gd) != 0) @@ -10100,7 +10222,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, rel->r_info = ELF64_R_INFO (r_symndx, r_type); rel[1].r_info = ELF64_R_INFO (r_symndx, R_PPC64_TPREL16_LO); - rel[1].r_offset += 2; + rel[1].r_offset += d_offset; } if (insn3 == NOP || insn3 == CROR_151515 || insn3 == CROR_313131) @@ -10109,7 +10231,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, insn2 = NOP; rel[1].r_offset += 4; } - bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - 2); + bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - d_offset); bfd_put_32 (output_bfd, insn2, contents + offset); bfd_put_32 (output_bfd, insn3, contents + offset + 4); if (tls_gd == 0 || toc_symndx != 0) @@ -10623,7 +10745,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, relocation += htab->stub_group[sec->id].toc_off; else unresolved_reloc = TRUE; - goto dodyn2; + goto dodyn; /* TOC16 relocs. We want the offset relative to the TOC base, which is the address of the start of the TOC plus 0x8000. @@ -10723,15 +10845,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, case R_PPC64_UADDR16: case R_PPC64_UADDR32: case R_PPC64_UADDR64: - /* r_symndx will be zero only for relocs against symbols - from removed linkonce sections, or sections discarded by - a linker script. */ dodyn: - if (r_symndx == 0) - break; - /* Fall thru. */ - - dodyn2: if ((input_section->flags & SEC_ALLOC) == 0) break; @@ -10841,6 +10955,17 @@ ppc64_elf_relocate_section (bfd *output_bfd, osec = sec->output_section; indx = elf_section_data (osec)->dynindx; + if (indx == 0) + { + if ((osec->flags & SEC_READONLY) == 0 + && htab->elf.data_index_section != NULL) + osec = htab->elf.data_index_section; + else + osec = htab->elf.text_index_section; + indx = elf_section_data (osec)->dynindx; + } + BFD_ASSERT (indx != 0); + /* We are turning this relocation into one against a section symbol, so subtract out the output section's address but not the @@ -10929,17 +11054,10 @@ ppc64_elf_relocate_section (bfd *output_bfd, case R_PPC64_ADDR16_HA: case R_PPC64_ADDR16_HIGHERA: case R_PPC64_ADDR16_HIGHESTA: - case R_PPC64_GOT16_HA: - case R_PPC64_PLTGOT16_HA: - case R_PPC64_PLT16_HA: case R_PPC64_TOC16_HA: case R_PPC64_SECTOFF_HA: case R_PPC64_TPREL16_HA: case R_PPC64_DTPREL16_HA: - case R_PPC64_GOT_TLSGD16_HA: - case R_PPC64_GOT_TLSLD16_HA: - case R_PPC64_GOT_TPREL16_HA: - case R_PPC64_GOT_DTPREL16_HA: case R_PPC64_TPREL16_HIGHER: case R_PPC64_TPREL16_HIGHERA: case R_PPC64_TPREL16_HIGHEST: @@ -10952,10 +11070,20 @@ ppc64_elf_relocate_section (bfd *output_bfd, that's not actually defined anywhere. In that case, 'sec' would be NULL, and we should leave the symbol alone (it will be set to zero elsewhere in the link). */ - if (sec != NULL) - /* Add 0x10000 if sign bit in 0:15 is set. - Bits 0:15 are not used. */ - addend += 0x8000; + if (sec == NULL) + break; + /* Fall thru */ + + case R_PPC64_GOT16_HA: + case R_PPC64_PLTGOT16_HA: + case R_PPC64_PLT16_HA: + case R_PPC64_GOT_TLSGD16_HA: + case R_PPC64_GOT_TLSLD16_HA: + case R_PPC64_GOT_TPREL16_HA: + case R_PPC64_GOT_DTPREL16_HA: + /* Add 0x10000 if sign bit in 0:15 is set. + Bits 0:15 are not used. */ + addend += 0x8000; break; case R_PPC64_ADDR16_DS: @@ -11128,13 +11256,11 @@ ppc64_elf_finish_dynamic_symbol (bfd *output_bfd, Elf_Internal_Sym *sym) { struct ppc_link_hash_table *htab; - bfd *dynobj; struct plt_entry *ent; Elf_Internal_Rela rela; bfd_byte *loc; htab = ppc_hash_table (info); - dynobj = htab->elf.dynobj; for (ent = h->plt.plist; ent != NULL; ent = ent->next) if (ent->plt.offset != (bfd_vma) -1) @@ -11331,6 +11457,17 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd, = PLT_ENTRY_SIZE; } + /* brlt is SEC_LINKER_CREATED, so we need to write out relocs for + brlt ourselves if emitrelocations. */ + if (htab->brlt != NULL + && htab->brlt->reloc_count != 0 + && !_bfd_elf_link_output_relocs (output_bfd, + htab->brlt, + &elf_section_data (htab->brlt)->rel_hdr, + elf_section_data (htab->brlt)->relocs, + NULL)) + return FALSE; + /* We need to handle writing out multiple GOT sections ourselves, since we didn't add them to DYNOBJ. We know dynobj is the first bfd. */ diff --git a/contrib/binutils/bfd/elf64-s390.c b/contrib/binutils/bfd/elf64-s390.c index 1fe0c6ca915c..47fbff6bed9e 100644 --- a/contrib/binutils/bfd/elf64-s390.c +++ b/contrib/binutils/bfd/elf64-s390.c @@ -1,5 +1,5 @@ /* IBM S/390-specific support for 64-bit ELF - Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Contributed Martin Schwidefsky (schwidefsky@de.ibm.com). @@ -20,8 +20,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "bfdlink.h" #include "libbfd.h" #include "elf-bfd.h" @@ -46,12 +46,6 @@ static void elf_s390_copy_indirect_symbol static bfd_boolean elf_s390_check_relocs PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *)); -static asection *elf_s390_gc_mark_hook - PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, - struct elf_link_hash_entry *, Elf_Internal_Sym *)); -static bfd_boolean elf_s390_gc_sweep_hook - PARAMS ((bfd *, struct bfd_link_info *, asection *, - const Elf_Internal_Rela *)); struct elf_s390_link_hash_entry; static void elf_s390_adjust_gotplt PARAMS ((struct elf_s390_link_hash_entry *)); @@ -73,8 +67,6 @@ static enum elf_reloc_type_class elf_s390_reloc_type_class PARAMS ((const Elf_Internal_Rela *)); static bfd_boolean elf_s390_finish_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_boolean elf_s390_mkobject - PARAMS ((bfd *)); static bfd_boolean elf_s390_object_p PARAMS ((bfd *)); static int elf_s390_tls_transition @@ -364,6 +356,27 @@ elf_s390_reloc_type_lookup (abfd, code) return 0; } +static reloc_howto_type * +elf_s390_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (elf_howto_table) / sizeof (elf_howto_table[0]); + i++) + if (elf_howto_table[i].name != NULL + && strcasecmp (elf_howto_table[i].name, r_name) == 0) + return &elf_howto_table[i]; + + if (strcasecmp (elf64_s390_vtinherit_howto.name, r_name) == 0) + return &elf64_s390_vtinherit_howto; + if (strcasecmp (elf64_s390_vtentry_howto.name, r_name) == 0) + return &elf64_s390_vtentry_howto; + + return NULL; +} + /* We need to use ELF64_R_TYPE so we have our own copy of this function, and elf64-s390.c has its own copy. */ @@ -631,14 +644,16 @@ struct elf_s390_obj_tdata (elf_s390_tdata (abfd)->local_got_tls_type) static bfd_boolean -elf_s390_mkobject (abfd) - bfd *abfd; +elf_s390_mkobject (bfd *abfd) { - bfd_size_type amt = sizeof (struct elf_s390_obj_tdata); - abfd->tdata.any = bfd_zalloc (abfd, amt); if (abfd->tdata.any == NULL) - return FALSE; - return TRUE; + { + bfd_size_type amt = sizeof (struct elf_s390_obj_tdata); + abfd->tdata.any = bfd_zalloc (abfd, amt); + if (abfd->tdata.any == NULL) + return FALSE; + } + return bfd_elf_mkobject (abfd); } static bfd_boolean @@ -1238,7 +1253,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs) if (name == NULL) return FALSE; - if (strncmp (name, ".rela", 5) != 0 + if (! CONST_STRNEQ (name, ".rela") || strcmp (bfd_get_section_name (abfd, sec), name + 5) != 0) { @@ -1345,50 +1360,30 @@ elf_s390_check_relocs (abfd, info, sec, relocs) relocation. */ static asection * -elf_s390_gc_mark_hook (sec, info, rel, h, sym) - asection *sec; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - Elf_Internal_Rela *rel; - struct elf_link_hash_entry *h; - Elf_Internal_Sym *sym; +elf_s390_gc_mark_hook (asection *sec, + struct bfd_link_info *info, + Elf_Internal_Rela *rel, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) { if (h != NULL) - { - switch (ELF64_R_TYPE (rel->r_info)) - { - case R_390_GNU_VTINHERIT: - case R_390_GNU_VTENTRY: - break; - - default: - switch (h->root.type) - { - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - return h->root.u.def.section; - - case bfd_link_hash_common: - return h->root.u.c.p->section; - - default: - break; - } - } - } - else - return bfd_section_from_elf_index (sec->owner, sym->st_shndx); - - return NULL; + switch (ELF64_R_TYPE (rel->r_info)) + { + case R_390_GNU_VTINHERIT: + case R_390_GNU_VTENTRY: + return NULL; + } + + return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym); } /* Update the got entry reference counts for the section being removed. */ static bfd_boolean -elf_s390_gc_sweep_hook (abfd, info, sec, relocs) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - const Elf_Internal_Rela *relocs; +elf_s390_gc_sweep_hook (bfd *abfd, + struct bfd_link_info *info, + asection *sec, + const Elf_Internal_Rela *relocs) { Elf_Internal_Shdr *symtab_hdr; struct elf_link_hash_entry **sym_hashes; @@ -1562,7 +1557,6 @@ elf_s390_adjust_dynamic_symbol (info, h) { struct elf_s390_link_hash_table *htab; asection *s; - unsigned int power_of_two; /* If this is a function, put it in the procedure linkage table. We will fill in the contents of the procedure linkage table later @@ -1683,29 +1677,9 @@ elf_s390_adjust_dynamic_symbol (info, h) h->needs_copy = 1; } - /* We need to figure out the alignment required for this symbol. I - have no idea how ELF linkers handle this. */ - power_of_two = bfd_log2 (h->size); - if (power_of_two > 3) - power_of_two = 3; - - /* Apply the required alignment. */ s = htab->sdynbss; - s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); - if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s)) - { - if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two)) - return FALSE; - } - - /* Define the symbol as being at this point in the section. */ - h->root.u.def.section = s; - h->root.u.def.value = s->size; - /* Increment the section size to make room for the symbol. */ - s->size += h->size; - - return TRUE; + return _bfd_elf_adjust_dynamic_copy (h, s); } /* Allocate space in .plt, .got and associated reloc sections for @@ -2098,7 +2072,7 @@ elf_s390_size_dynamic_sections (output_bfd, info) /* Strip this section if we don't need it; see the comment below. */ } - else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0) + else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela")) { if (s->size != 0 && s != htab->srelplt) relocs = TRUE; @@ -2240,6 +2214,7 @@ invalid_tls_insn (input_bfd, input_section, rel) input_section, (long) rel->r_offset, howto->name); + bfd_set_error (bfd_error_bad_value); } /* Relocate a 390 ELF section. */ @@ -2263,9 +2238,6 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - if (info->relocatable) - return TRUE; - htab = elf_s390_hash_table (info); symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); @@ -2300,7 +2272,6 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, howto = elf_howto_table + r_type; r_symndx = ELF64_R_SYM (rel->r_info); - /* This is a final link. */ h = NULL; sym = NULL; sec = NULL; @@ -2321,6 +2292,20 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, unresolved_reloc, warned); } + if (sec != NULL && elf_discarded_section (sec)) + { + /* For relocs against symbols from removed linkonce sections, + or sections discarded by a linker script, we just want the + section contents zeroed. Avoid any special processing. */ + _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset); + rel->r_info = 0; + rel->r_addend = 0; + continue; + } + + if (info->relocatable) + continue; + switch (r_type) { case R_390_GOTPLT12: @@ -2544,11 +2529,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, case R_390_PC32: case R_390_PC32DBL: case R_390_PC64: - /* r_symndx will be zero only for relocs against symbols - from removed linkonce sections, or sections discarded by - a linker script. */ - if (r_symndx == 0 - || (input_section->flags & SEC_ALLOC) == 0) + if ((input_section->flags & SEC_ALLOC) == 0) break; if ((info->shared @@ -2636,14 +2617,19 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, osec = sec->output_section; sindx = elf_section_data (osec)->dynindx; - BFD_ASSERT (sindx > 0); + + if (sindx == 0) + { + osec = htab->elf.text_index_section; + sindx = elf_section_data (osec)->dynindx; + } + BFD_ASSERT (sindx != 0); /* We are turning this relocation into one against a section symbol, so subtract out the output section's address but not the offset of the input section in the output section. */ - outrel.r_addend -= osec->vma; } outrel.r_info = ELF64_R_INFO (sindx, r_type); @@ -2908,7 +2894,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, continue; case R_390_TLS_LDO64: - if (info->shared || (input_section->flags & SEC_CODE) == 0) + if (info->shared) relocation -= dtpoff_base (info); else /* When converting LDO to LE, we must negate. */ @@ -3462,6 +3448,7 @@ const struct elf_size_info s390_elf64_size_info = #define bfd_elf64_bfd_is_local_label_name elf_s390_is_local_label_name #define bfd_elf64_bfd_link_hash_table_create elf_s390_link_hash_table_create #define bfd_elf64_bfd_reloc_type_lookup elf_s390_reloc_type_lookup +#define bfd_elf64_bfd_reloc_name_lookup elf_s390_reloc_name_lookup #define elf_backend_adjust_dynamic_symbol elf_s390_adjust_dynamic_symbol #define elf_backend_check_relocs elf_s390_check_relocs @@ -3474,6 +3461,7 @@ const struct elf_size_info s390_elf64_size_info = #define elf_backend_reloc_type_class elf_s390_reloc_type_class #define elf_backend_relocate_section elf_s390_relocate_section #define elf_backend_size_dynamic_sections elf_s390_size_dynamic_sections +#define elf_backend_init_index_section _bfd_elf_init_1_index_section #define elf_backend_reloc_type_class elf_s390_reloc_type_class #define elf_backend_plt_sym_val elf_s390_plt_sym_val diff --git a/contrib/binutils/bfd/elf64-sparc.c b/contrib/binutils/bfd/elf64-sparc.c index dd1c302174af..2adddd994463 100644 --- a/contrib/binutils/bfd/elf64-sparc.c +++ b/contrib/binutils/bfd/elf64-sparc.c @@ -1,6 +1,6 @@ /* SPARC-specific support for 64-bit ELF Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005 Free Software Foundation, Inc. + 2003, 2004, 2005, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,8 +18,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "elf-bfd.h" #include "elf/sparc.h" @@ -814,6 +814,7 @@ const struct elf_size_info elf64_sparc_size_info = #define TARGET_BIG_NAME "elf64-sparc" #define ELF_ARCH bfd_arch_sparc #define ELF_MAXPAGESIZE 0x100000 +#define ELF_COMMONPAGESIZE 0x2000 /* This is the official ABI value. */ #define ELF_MACHINE_CODE EM_SPARCV9 @@ -858,6 +859,8 @@ const struct elf_size_info elf64_sparc_size_info = _bfd_sparc_elf_copy_indirect_symbol #define bfd_elf64_bfd_reloc_type_lookup \ _bfd_sparc_elf_reloc_type_lookup +#define bfd_elf64_bfd_reloc_name_lookup \ + _bfd_sparc_elf_reloc_name_lookup #define bfd_elf64_bfd_relax_section \ _bfd_sparc_elf_relax_section #define bfd_elf64_new_section_hook \ @@ -888,6 +891,8 @@ const struct elf_size_info elf64_sparc_size_info = _bfd_sparc_elf_gc_mark_hook #define elf_backend_gc_sweep_hook \ _bfd_sparc_elf_gc_sweep_hook +#define elf_backend_init_index_section \ + _bfd_elf_init_1_index_section #define elf_backend_can_gc_sections 1 #define elf_backend_can_refcount 1 @@ -901,3 +906,19 @@ const struct elf_size_info elf64_sparc_size_info = #define elf_backend_plt_alignment 8 #include "elf64-target.h" + +/* FreeBSD support */ +#undef TARGET_BIG_SYM +#define TARGET_BIG_SYM bfd_elf64_sparc_freebsd_vec +#undef TARGET_BIG_NAME +#define TARGET_BIG_NAME "elf64-sparc-freebsd" +#undef ELF_OSABI +#define ELF_OSABI ELFOSABI_FREEBSD + +#undef elf_backend_post_process_headers +#define elf_backend_post_process_headers _bfd_elf_set_osabi +#undef elf64_bed +#define elf64_bed elf64_sparc_fbsd_bed + +#include "elf64-target.h" + diff --git a/contrib/binutils/bfd/elf64-x86-64.c b/contrib/binutils/bfd/elf64-x86-64.c index 9befd69c5df6..0ee75ce9947a 100644 --- a/contrib/binutils/bfd/elf64-x86-64.c +++ b/contrib/binutils/bfd/elf64-x86-64.c @@ -1,5 +1,5 @@ /* X86-64 specific support for 64-bit ELF - Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Contributed by Jan Hubicka <jh@suse.cz>. @@ -19,8 +19,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "bfdlink.h" #include "libbfd.h" #include "elf-bfd.h" @@ -246,6 +246,23 @@ elf64_x86_64_reloc_type_lookup (bfd *abfd, return 0; } +static reloc_howto_type * +elf64_x86_64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (x86_64_elf_howto_table) + / sizeof (x86_64_elf_howto_table[0])); + i++) + if (x86_64_elf_howto_table[i].name != NULL + && strcasecmp (x86_64_elf_howto_table[i].name, r_name) == 0) + return &x86_64_elf_howto_table[i]; + + return NULL; +} + /* Given an x86_64 ELF reloc type, fill in an arelent structure. */ static void @@ -350,7 +367,7 @@ static const bfd_byte elf64_x86_64_plt0_entry[PLT_ENTRY_SIZE] = { 0xff, 0x35, 8, 0, 0, 0, /* pushq GOT+8(%rip) */ 0xff, 0x25, 16, 0, 0, 0, /* jmpq *GOT+16(%rip) */ - 0x90, 0x90, 0x90, 0x90 /* pad out to 16 bytes with nops. */ + 0x0f, 0x1f, 0x40, 0x00 /* nopl 0(%rax) */ }; /* Subsequent entries in a procedure linkage table look like this. */ @@ -676,11 +693,14 @@ elf64_x86_64_copy_indirect_symbol (struct bfd_link_info *info, static bfd_boolean elf64_x86_64_mkobject (bfd *abfd) { - bfd_size_type amt = sizeof (struct elf64_x86_64_obj_tdata); - abfd->tdata.any = bfd_zalloc (abfd, amt); if (abfd->tdata.any == NULL) - return FALSE; - return TRUE; + { + bfd_size_type amt = sizeof (struct elf64_x86_64_obj_tdata); + abfd->tdata.any = bfd_zalloc (abfd, amt); + if (abfd->tdata.any == NULL) + return FALSE; + } + return bfd_elf_mkobject (abfd); } static bfd_boolean @@ -994,7 +1014,7 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, && (r_type != R_X86_64_PC32) && (r_type != R_X86_64_PC64)) || (h != NULL - && (! info->symbolic + && (! SYMBOLIC_BIND (info, h) || h->root.type == bfd_link_hash_defweak || !h->def_regular)))) || (ELIMINATE_COPY_RELOCS @@ -1022,7 +1042,7 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, if (name == NULL) return FALSE; - if (strncmp (name, ".rela", 5) != 0 + if (! CONST_STRNEQ (name, ".rela") || strcmp (bfd_get_section_name (abfd, sec), name + 5) != 0) { @@ -1131,38 +1151,20 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, static asection * elf64_x86_64_gc_mark_hook (asection *sec, - struct bfd_link_info *info ATTRIBUTE_UNUSED, + struct bfd_link_info *info, Elf_Internal_Rela *rel, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { if (h != NULL) - { - switch (ELF64_R_TYPE (rel->r_info)) - { - case R_X86_64_GNU_VTINHERIT: - case R_X86_64_GNU_VTENTRY: - break; - - default: - switch (h->root.type) - { - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - return h->root.u.def.section; - - case bfd_link_hash_common: - return h->root.u.c.p->section; - - default: - break; - } - } - } - else - return bfd_section_from_elf_index (sec->owner, sym->st_shndx); - - return NULL; + switch (ELF64_R_TYPE (rel->r_info)) + { + case R_X86_64_GNU_VTINHERIT: + case R_X86_64_GNU_VTENTRY: + return NULL; + } + + return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym); } /* Update the got entry reference counts for the section being removed. */ @@ -1285,7 +1287,6 @@ elf64_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info, { struct elf64_x86_64_link_hash_table *htab; asection *s; - unsigned int power_of_two; /* If this is a function, put it in the procedure linkage table. We will fill in the contents of the procedure linkage table later, @@ -1403,32 +1404,9 @@ elf64_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info, h->needs_copy = 1; } - /* We need to figure out the alignment required for this symbol. I - have no idea how ELF linkers handle this. 16-bytes is the size - of the largest type that requires hard alignment -- long double. */ - /* FIXME: This is VERY ugly. Should be fixed for all architectures using - this construct. */ - power_of_two = bfd_log2 (h->size); - if (power_of_two > 4) - power_of_two = 4; - - /* Apply the required alignment. */ s = htab->sdynbss; - s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); - if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s)) - { - if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two)) - return FALSE; - } - - /* Define the symbol as being at this point in the section. */ - h->root.u.def.section = s; - h->root.u.def.value = s->size; - - /* Increment the section size to make room for the symbol. */ - s->size += h->size; - return TRUE; + return _bfd_elf_adjust_dynamic_copy (h, s); } /* Allocate space in .plt, .got and associated reloc sections for @@ -1880,7 +1858,7 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* Strip this section if we don't need it; see the comment below. */ } - else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0) + else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela")) { if (s->size != 0 && s != htab->srelplt) relocs = TRUE; @@ -2077,9 +2055,6 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - if (info->relocatable) - return TRUE; - htab = elf64_x86_64_hash_table (info); symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); @@ -2135,6 +2110,21 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, h, sec, relocation, unresolved_reloc, warned); } + + if (sec != NULL && elf_discarded_section (sec)) + { + /* For relocs against symbols from removed linkonce sections, + or sections discarded by a linker script, we just want the + section contents zeroed. Avoid any special processing. */ + _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset); + rel->r_info = 0; + rel->r_addend = 0; + continue; + } + + if (info->relocatable) + continue; + /* When generating a shared object, the relocations handled here are copied into the output file to be resolved at run time. */ switch (r_type) @@ -2382,11 +2372,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, /* FIXME: The ABI says the linker should make sure the value is the same when it's zeroextended to 64 bit. */ - /* r_symndx will be zero only for relocs against symbols - from removed linkonce sections, or sections discarded by - a linker script. */ - if (r_symndx == 0 - || (input_section->flags & SEC_ALLOC) == 0) + if ((input_section->flags & SEC_ALLOC) == 0) break; if ((info->shared @@ -2442,7 +2428,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, || r_type == R_X86_64_PC32 || r_type == R_X86_64_PC64 || !info->shared - || !info->symbolic + || !SYMBOLIC_BIND (info, h) || !h->def_regular)) { outrel.r_info = ELF64_R_INFO (h->dynindx, r_type); @@ -2472,9 +2458,19 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, { asection *osec; + /* We are turning this relocation into one + against a section symbol. It would be + proper to subtract the symbol's value, + osec->vma, from the emitted reloc addend, + but ld.so expects buggy relocs. */ osec = sec->output_section; sindx = elf_section_data (osec)->dynindx; - BFD_ASSERT (sindx > 0); + if (sindx == 0) + { + asection *oi = htab->elf.text_index_section; + sindx = elf_section_data (oi)->dynindx; + } + BFD_ASSERT (sindx != 0); } outrel.r_info = ELF64_R_INFO (sindx, r_type); @@ -2614,8 +2610,9 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, val = bfd_get_8 (input_bfd, contents + roff + 1); BFD_ASSERT (val == 0x10); - /* Now modify the instruction as appropriate. */ - bfd_put_8 (output_bfd, 0x90, contents + roff); + /* Now modify the instruction as appropriate. Use + xchg %ax,%ax instead of 2 nops. */ + bfd_put_8 (output_bfd, 0x66, contents + roff); bfd_put_8 (output_bfd, 0x90, contents + roff + 1); continue; } @@ -2907,8 +2904,9 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, val = bfd_get_8 (input_bfd, contents + roff + 1); BFD_ASSERT (val == 0x10); - /* Now modify the instruction as appropriate. */ - bfd_put_8 (output_bfd, 0x90, contents + roff); + /* Now modify the instruction as appropriate. Use + xchg %ax,%ax instead of 2 nops. */ + bfd_put_8 (output_bfd, 0x66, contents + roff); bfd_put_8 (output_bfd, 0x90, contents + roff + 1); continue; @@ -3030,12 +3028,6 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (r == bfd_reloc_overflow) { - if (h != NULL - && h->root.type == bfd_link_hash_undefweak - && howto->pc_relative) - /* Ignore reloc overflow on branches to undefweak syms. */ - continue; - if (! ((*info->callbacks->reloc_overflow) (info, (h ? &h->root : NULL), name, howto->name, (bfd_vma) 0, input_bfd, input_section, @@ -3594,7 +3586,8 @@ elf64_x86_64_merge_symbol (struct bfd_link_info *info ATTRIBUTE_UNUSED, } static int -elf64_x86_64_additional_program_headers (bfd *abfd) +elf64_x86_64_additional_program_headers (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { asection *s; int count = 0; @@ -3614,23 +3607,38 @@ elf64_x86_64_additional_program_headers (bfd *abfd) return count; } +/* Return TRUE if symbol should be hashed in the `.gnu.hash' section. */ + +static bfd_boolean +elf64_x86_64_hash_symbol (struct elf_link_hash_entry *h) +{ + if (h->plt.offset != (bfd_vma) -1 + && !h->def_regular + && !h->pointer_equality_needed) + return FALSE; + + return _bfd_elf_hash_symbol (h); +} + static const struct bfd_elf_special_section elf64_x86_64_special_sections[]= { - { ".gnu.linkonce.lb", 16, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_X86_64_LARGE}, - { ".gnu.linkonce.lr", 16, -2, SHT_PROGBITS, SHF_ALLOC + SHF_X86_64_LARGE}, - { ".gnu.linkonce.lt", 16, -2, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR + SHF_X86_64_LARGE}, - { ".lbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_X86_64_LARGE}, - { ".ldata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_X86_64_LARGE}, - { ".lrodata", 8, -2, SHT_PROGBITS, SHF_ALLOC + SHF_X86_64_LARGE}, - { NULL, 0, 0, 0, 0 } + { STRING_COMMA_LEN (".gnu.linkonce.lb"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_X86_64_LARGE}, + { STRING_COMMA_LEN (".gnu.linkonce.lr"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_X86_64_LARGE}, + { STRING_COMMA_LEN (".gnu.linkonce.lt"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR + SHF_X86_64_LARGE}, + { STRING_COMMA_LEN (".lbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_X86_64_LARGE}, + { STRING_COMMA_LEN (".ldata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_X86_64_LARGE}, + { STRING_COMMA_LEN (".lrodata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_X86_64_LARGE}, + { NULL, 0, 0, 0, 0 } }; #define TARGET_LITTLE_SYM bfd_elf64_x86_64_vec #define TARGET_LITTLE_NAME "elf64-x86-64" #define ELF_ARCH bfd_arch_i386 #define ELF_MACHINE_CODE EM_X86_64 -#define ELF_MAXPAGESIZE 0x100000 +#define ELF_MAXPAGESIZE 0x200000 +#define ELF_MINPAGESIZE 0x1000 +#define ELF_COMMONPAGESIZE 0x1000 #define elf_backend_can_gc_sections 1 #define elf_backend_can_refcount 1 @@ -3645,6 +3653,8 @@ static const struct bfd_elf_special_section #define bfd_elf64_bfd_link_hash_table_create \ elf64_x86_64_link_hash_table_create #define bfd_elf64_bfd_reloc_type_lookup elf64_x86_64_reloc_type_lookup +#define bfd_elf64_bfd_reloc_name_lookup \ + elf64_x86_64_reloc_name_lookup #define elf_backend_adjust_dynamic_symbol elf64_x86_64_adjust_dynamic_symbol #define elf_backend_check_relocs elf64_x86_64_check_relocs @@ -3660,6 +3670,7 @@ static const struct bfd_elf_special_section #define elf_backend_relocate_section elf64_x86_64_relocate_section #define elf_backend_size_dynamic_sections elf64_x86_64_size_dynamic_sections #define elf_backend_always_size_sections elf64_x86_64_always_size_sections +#define elf_backend_init_index_section _bfd_elf_init_1_index_section #define elf_backend_plt_sym_val elf64_x86_64_plt_sym_val #define elf_backend_object_p elf64_x86_64_elf_object_p #define bfd_elf64_mkobject elf64_x86_64_mkobject @@ -3685,5 +3696,25 @@ static const struct bfd_elf_special_section elf64_x86_64_special_sections #define elf_backend_additional_program_headers \ elf64_x86_64_additional_program_headers +#define elf_backend_hash_symbol \ + elf64_x86_64_hash_symbol + +#include "elf64-target.h" + +/* FreeBSD support. */ + +#undef TARGET_LITTLE_SYM +#define TARGET_LITTLE_SYM bfd_elf64_x86_64_freebsd_vec +#undef TARGET_LITTLE_NAME +#define TARGET_LITTLE_NAME "elf64-x86-64-freebsd" + +#undef ELF_OSABI +#define ELF_OSABI ELFOSABI_FREEBSD + +#undef elf_backend_post_process_headers +#define elf_backend_post_process_headers _bfd_elf_set_osabi + +#undef elf64_bed +#define elf64_bed elf64_x86_64_fbsd_bed #include "elf64-target.h" diff --git a/contrib/binutils/bfd/elfcode.h b/contrib/binutils/bfd/elfcode.h index 1f8ec2b2b2cb..191e124d770e 100644 --- a/contrib/binutils/bfd/elfcode.h +++ b/contrib/binutils/bfd/elfcode.h @@ -1,6 +1,7 @@ /* ELF executable support for BFD. Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + 2001, 2002, 2003, 2004, 2005, 2006, 2007 + Free Software Foundation, Inc. Written by Fred Fish @ Cygnus Support, from information published in "UNIX System V Release 4, Programmers Guide: ANSI C and @@ -64,8 +65,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. it's cast in stone. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libiberty.h" #include "bfdlink.h" #include "libbfd.h" @@ -139,10 +140,11 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. #define LOG_FILE_ALIGN 2 #endif -#ifdef DEBUG +#if DEBUG & 2 static void elf_debug_section (int, Elf_Internal_Shdr *); +#endif +#if DEBUG & 1 static void elf_debug_file (Elf_Internal_Ehdr *); -static char *elf_symbol_flags (flagword); #endif /* Structure swapping routines */ @@ -165,7 +167,7 @@ static char *elf_symbol_flags (flagword); /* Translate an ELF symbol in external format into an ELF symbol in internal format. */ -void +bfd_boolean elf_swap_symbol_in (bfd *abfd, const void *psrc, const void *pshn, @@ -187,9 +189,10 @@ elf_swap_symbol_in (bfd *abfd, if (dst->st_shndx == SHN_XINDEX) { if (shndx == NULL) - abort (); + return FALSE; dst->st_shndx = H_GET_32 (abfd, shndx->est_shndx); } + return TRUE; } /* Translate an ELF symbol in internal format into an ELF symbol in external @@ -498,6 +501,8 @@ elf_object_p (bfd *abfd) struct bfd_preserve preserve; asection *s; bfd_size_type amt; + const bfd_target *target; + const bfd_target * const *target_ptr; preserve.marker = NULL; @@ -541,10 +546,12 @@ elf_object_p (bfd *abfd) if (!bfd_preserve_save (abfd, &preserve)) goto got_no_match; + target = abfd->xvec; + /* Allocate an instance of the elf_obj_tdata structure and hook it up to the tdata pointer in the bfd. */ - if (! (*abfd->xvec->_bfd_set_format[bfd_object]) (abfd)) + if (! (*target->_bfd_set_format[bfd_object]) (abfd)) goto got_no_match; preserve.marker = elf_tdata (abfd); @@ -584,8 +591,6 @@ elf_object_p (bfd *abfd) && (ebd->elf_machine_alt2 == 0 || i_ehdrp->e_machine != ebd->elf_machine_alt2)) { - const bfd_target * const *target_ptr; - if (ebd->elf_machine_code != EM_NONE) goto got_wrong_format_error; @@ -626,6 +631,45 @@ elf_object_p (bfd *abfd) goto got_no_match; } + if (ebd->elf_machine_code != EM_NONE + && i_ehdrp->e_ident[EI_OSABI] != ebd->elf_osabi) + { + if (ebd->elf_osabi != ELFOSABI_NONE) + goto got_wrong_format_error; + + /* This is an ELFOSABI_NONE ELF target. Let it match any ELF + target of the compatible machine for which we do not have a + backend with matching ELFOSABI. */ + for (target_ptr = bfd_target_vector; + *target_ptr != NULL; + target_ptr++) + { + const struct elf_backend_data *back; + + /* Skip this target and targets with incompatible byte + order. */ + if (*target_ptr == target + || (*target_ptr)->flavour != bfd_target_elf_flavour + || (*target_ptr)->byteorder != target->byteorder + || ((*target_ptr)->header_byteorder + != target->header_byteorder)) + continue; + + back = (const struct elf_backend_data *) (*target_ptr)->backend_data; + if (back->elf_osabi == i_ehdrp->e_ident[EI_OSABI] + && (back->elf_machine_code == i_ehdrp->e_machine + || (back->elf_machine_alt1 != 0 + && back->elf_machine_alt1 == i_ehdrp->e_machine) + || (back->elf_machine_alt2 != 0 + && back->elf_machine_alt2 == i_ehdrp->e_machine))) + { + /* target_ptr is an ELF backend which matches this + object file, so reject the ELFOSABI_NONE ELF target. */ + goto got_wrong_format_error; + } + } + } + if (i_ehdrp->e_shoff != 0) { bfd_signed_vma where = i_ehdrp->e_shoff; @@ -846,7 +890,7 @@ elf_object_p (bfd *abfd) } bfd_preserve_finish (abfd, &preserve); - return abfd->xvec; + return target; got_wrong_format_error: /* There is way too much undoing of half-known state here. The caller, @@ -1235,6 +1279,12 @@ elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bfd_boolean dynamic) case STT_TLS: sym->symbol.flags |= BSF_THREAD_LOCAL; break; + case STT_RELC: + sym->symbol.flags |= BSF_RELC; + break; + case STT_SRELC: + sym->symbol.flags |= BSF_SRELC; + break; } if (dynamic) @@ -1462,7 +1512,7 @@ elf_slurp_reloc_table (bfd *abfd, return TRUE; } -#ifdef DEBUG +#if DEBUG & 2 static void elf_debug_section (int num, Elf_Internal_Shdr *hdr) { @@ -1488,7 +1538,9 @@ elf_debug_section (int num, Elf_Internal_Shdr *hdr) (long) hdr->sh_entsize); fflush (stderr); } +#endif +#if DEBUG & 1 static void elf_debug_file (Elf_Internal_Ehdr *ehdrp) { @@ -1500,77 +1552,6 @@ elf_debug_file (Elf_Internal_Ehdr *ehdrp) fprintf (stderr, "e_shnum = %ld\n", (long) ehdrp->e_shnum); fprintf (stderr, "e_shentsize = %ld\n", (long) ehdrp->e_shentsize); } - -static char * -elf_symbol_flags (flagword flags) -{ - static char buffer[1024]; - - buffer[0] = '\0'; - if (flags & BSF_LOCAL) - strcat (buffer, " local"); - - if (flags & BSF_GLOBAL) - strcat (buffer, " global"); - - if (flags & BSF_DEBUGGING) - strcat (buffer, " debug"); - - if (flags & BSF_FUNCTION) - strcat (buffer, " function"); - - if (flags & BSF_KEEP) - strcat (buffer, " keep"); - - if (flags & BSF_KEEP_G) - strcat (buffer, " keep_g"); - - if (flags & BSF_WEAK) - strcat (buffer, " weak"); - - if (flags & BSF_SECTION_SYM) - strcat (buffer, " section-sym"); - - if (flags & BSF_OLD_COMMON) - strcat (buffer, " old-common"); - - if (flags & BSF_NOT_AT_END) - strcat (buffer, " not-at-end"); - - if (flags & BSF_CONSTRUCTOR) - strcat (buffer, " constructor"); - - if (flags & BSF_WARNING) - strcat (buffer, " warning"); - - if (flags & BSF_INDIRECT) - strcat (buffer, " indirect"); - - if (flags & BSF_FILE) - strcat (buffer, " file"); - - if (flags & DYNAMIC) - strcat (buffer, " dynamic"); - - if (flags & ~(BSF_LOCAL - | BSF_GLOBAL - | BSF_DEBUGGING - | BSF_FUNCTION - | BSF_KEEP - | BSF_KEEP_G - | BSF_WEAK - | BSF_SECTION_SYM - | BSF_OLD_COMMON - | BSF_NOT_AT_END - | BSF_CONSTRUCTOR - | BSF_WARNING - | BSF_INDIRECT - | BSF_FILE - | BSF_DYNAMIC)) - strcat (buffer, " unknown-bits"); - - return buffer; -} #endif /* Create a new BFD as if by bfd_openr. Rather than opening a file, diff --git a/contrib/binutils/bfd/elflink.c b/contrib/binutils/bfd/elflink.c index 59d9c3f1389a..9f0efa5b4b7f 100644 --- a/contrib/binutils/bfd/elflink.c +++ b/contrib/binutils/bfd/elflink.c @@ -1,6 +1,6 @@ /* ELF linking support for BFD. Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006 Free Software Foundation, Inc. + 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,8 +18,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "bfdlink.h" #include "libbfd.h" #define ARCH_SIZE 0 @@ -185,16 +185,6 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) return FALSE; } - if (! info->traditional_format) - { - s = bfd_make_section_with_flags (abfd, ".eh_frame_hdr", - flags | SEC_READONLY); - if (s == NULL - || ! bfd_set_section_alignment (abfd, s, 2)) - return FALSE; - elf_hash_table (info)->eh_info.hdr_sec = s; - } - /* Create sections to hold version informations. These are removed if they are not needed. */ s = bfd_make_section_with_flags (abfd, ".gnu.version_d", @@ -240,12 +230,30 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) if (!_bfd_elf_define_linkage_sym (abfd, info, s, "_DYNAMIC")) return FALSE; - s = bfd_make_section_with_flags (abfd, ".hash", - flags | SEC_READONLY); - if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) - return FALSE; - elf_section_data (s)->this_hdr.sh_entsize = bed->s->sizeof_hash_entry; + if (info->emit_hash) + { + s = bfd_make_section_with_flags (abfd, ".hash", flags | SEC_READONLY); + if (s == NULL + || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + return FALSE; + elf_section_data (s)->this_hdr.sh_entsize = bed->s->sizeof_hash_entry; + } + + if (info->emit_gnu_hash) + { + s = bfd_make_section_with_flags (abfd, ".gnu.hash", + flags | SEC_READONLY); + if (s == NULL + || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + return FALSE; + /* For 64-bit ELF, .gnu.hash is a non-uniform entity size section: + 4 32-bit words followed by variable count of 64-bit words, then + variable count of 32-bit words. */ + if (bed->s->arch_size == 64) + elf_section_data (s)->this_hdr.sh_entsize = 0; + else + elf_section_data (s)->this_hdr.sh_entsize = 4; + } /* Let the backend create the rest of the sections. This lets the backend set the right flags. The backend will normally create @@ -426,6 +434,29 @@ bfd_elf_link_record_dynamic_symbol (struct bfd_link_info *info, return TRUE; } +/* Mark a symbol dynamic. */ + +void +bfd_elf_link_mark_dynamic_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) +{ + struct bfd_elf_dynamic_list *d = info->dynamic_list; + + /* It may be called more than once on the same H. */ + if(h->dynamic || info->relocatable) + return; + + if ((info->dynamic_data + && (h->type == STT_OBJECT + || (sym != NULL + && ELF_ST_TYPE (sym->st_info) == STT_OBJECT))) + || (d != NULL + && h->root.type == bfd_link_hash_new + && (*d->match) (&d->head, NULL, h->root.root.string))) + h->dynamic = 1; +} + /* Record an assignment to a symbol made by a linker script. We need this in case some dynamic object refers to this symbol. */ @@ -459,7 +490,10 @@ bfd_elf_record_link_assignment (bfd *output_bfd, } if (h->root.type == bfd_link_hash_new) - h->non_elf = 0; + { + bfd_elf_link_mark_dynamic_symbol (info, h, NULL); + h->non_elf = 0; + } /* If this symbol is being provided by the linker script, and it is currently defined by a dynamic object, but not by a regular @@ -676,6 +710,8 @@ _bfd_elf_link_omit_section_dynsym (bfd *output_bfd ATTRIBUTE_UNUSED, struct bfd_link_info *info, asection *p) { + struct elf_link_hash_table *htab; + switch (elf_section_data (p)->this_hdr.sh_type) { case SHT_PROGBITS: @@ -683,15 +719,21 @@ _bfd_elf_link_omit_section_dynsym (bfd *output_bfd ATTRIBUTE_UNUSED, /* If sh_type is yet undecided, assume it could be SHT_PROGBITS/SHT_NOBITS. */ case SHT_NULL: + htab = elf_hash_table (info); + if (p == htab->tls_sec) + return FALSE; + + if (htab->text_index_section != NULL) + return p != htab->text_index_section && p != htab->data_index_section; + if (strcmp (p->name, ".got") == 0 || strcmp (p->name, ".got.plt") == 0 || strcmp (p->name, ".plt") == 0) { asection *ip; - bfd *dynobj = elf_hash_table (info)->dynobj; - if (dynobj != NULL - && (ip = bfd_get_section_by_name (dynobj, p->name)) != NULL + if (htab->dynobj != NULL + && (ip = bfd_get_section_by_name (htab->dynobj, p->name)) != NULL && (ip->flags & SEC_LINKER_CREATED) && ip->output_section == p) return TRUE; @@ -727,6 +769,8 @@ _bfd_elf_link_renumber_dynsyms (bfd *output_bfd, && (p->flags & SEC_ALLOC) != 0 && !(*bed->elf_backend_omit_section_dynsym) (output_bfd, info, p)) elf_section_data (p)->dynindx = ++dynsymcount; + else + elf_section_data (p)->dynindx = 0; } *section_sym_count = dynsymcount; @@ -796,6 +840,15 @@ _bfd_elf_merge_symbol (bfd *abfd, sec = *psec; bind = ELF_ST_BIND (sym->st_info); + /* Silently discard TLS symbols from --just-syms. There's no way to + combine a static TLS block with a new TLS block for this executable. */ + if (ELF_ST_TYPE (sym->st_info) == STT_TLS + && sec->sec_info_type == ELF_INFO_TYPE_JUST_SYMS) + { + *skip = TRUE; + return TRUE; + } + if (! bfd_is_und_section (sec)) h = elf_link_hash_lookup (elf_hash_table (info), name, TRUE, FALSE, FALSE); else @@ -816,6 +869,11 @@ _bfd_elf_merge_symbol (bfd *abfd, || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + /* We have to check it for every instance since the first few may be + refereences and not all compilers emit symbol type for undefined + symbols. */ + bfd_elf_link_mark_dynamic_symbol (info, h, sym); + /* If we just created the symbol, mark it as being an ELF symbol. Other than that, there is nothing to do--there is no merge issue with a newly defined symbol--so we just return. */ @@ -889,6 +947,7 @@ _bfd_elf_merge_symbol (bfd *abfd, && h->root.type != bfd_link_hash_undefweak && h->root.type != bfd_link_hash_common); + bed = get_elf_backend_data (abfd); /* When we try to create a default indirect symbol from the dynamic definition with the default version, we skip it if its type and the type of existing regular definition mismatch. We only do it @@ -903,7 +962,9 @@ _bfd_elf_merge_symbol (bfd *abfd, && (olddef || h->root.type == bfd_link_hash_common) && ELF_ST_TYPE (sym->st_info) != h->type && ELF_ST_TYPE (sym->st_info) != STT_NOTYPE - && h->type != STT_NOTYPE) + && h->type != STT_NOTYPE + && !(bed->is_function_type (ELF_ST_TYPE (sym->st_info)) + && bed->is_function_type (h->type))) { *skip = TRUE; return TRUE; @@ -1007,7 +1068,41 @@ _bfd_elf_merge_symbol (bfd *abfd, relocatable file and the old definition comes from a dynamic object, we remove the old definition. */ if ((*sym_hash)->root.type == bfd_link_hash_indirect) - h = *sym_hash; + { + /* Handle the case where the old dynamic definition is + default versioned. We need to copy the symbol info from + the symbol with default version to the normal one if it + was referenced before. */ + if (h->ref_regular) + { + const struct elf_backend_data *bed + = get_elf_backend_data (abfd); + struct elf_link_hash_entry *vh = *sym_hash; + vh->root.type = h->root.type; + h->root.type = bfd_link_hash_indirect; + (*bed->elf_backend_copy_indirect_symbol) (info, vh, h); + /* Protected symbols will override the dynamic definition + with default version. */ + if (ELF_ST_VISIBILITY (sym->st_other) == STV_PROTECTED) + { + h->root.u.i.link = (struct bfd_link_hash_entry *) vh; + vh->dynamic_def = 1; + vh->ref_dynamic = 1; + } + else + { + h->root.type = vh->root.type; + vh->ref_dynamic = 0; + /* We have to hide it here since it was made dynamic + global with extra bits when the symbol info was + copied from the old dynamic definition. */ + (*bed->elf_backend_hide_symbol) (info, vh, TRUE); + } + h = vh; + } + else + h = *sym_hash; + } if ((h->root.u.undef.next || info->hash->undefs_tail == &h->root) && bfd_is_und_section (sec)) @@ -1060,6 +1155,11 @@ _bfd_elf_merge_symbol (bfd *abfd, if (olddef && newdyn) oldweak = FALSE; + /* Allow changes between different types of funciton symbol. */ + if (bed->is_function_type (ELF_ST_TYPE (sym->st_info)) + && bed->is_function_type (h->type)) + *type_change_ok = TRUE; + /* It's OK to change the type if either the existing symbol or the new symbol is weak. A type change is also OK if the old symbol is undefined and the new symbol is defined. */ @@ -1106,7 +1206,7 @@ _bfd_elf_merge_symbol (bfd *abfd, && (sec->flags & SEC_ALLOC) != 0 && (sec->flags & SEC_LOAD) == 0 && sym->st_size > 0 - && ELF_ST_TYPE (sym->st_info) != STT_FUNC) + && !bed->is_function_type (ELF_ST_TYPE (sym->st_info))) newdyncommon = TRUE; else newdyncommon = FALSE; @@ -1118,14 +1218,13 @@ _bfd_elf_merge_symbol (bfd *abfd, && (h->root.u.def.section->flags & SEC_ALLOC) != 0 && (h->root.u.def.section->flags & SEC_LOAD) == 0 && h->size > 0 - && h->type != STT_FUNC) + && !bed->is_function_type (h->type)) olddyncommon = TRUE; else olddyncommon = FALSE; /* We now know everything about the old and new symbols. We ask the backend to check if we can merge them. */ - bed = get_elf_backend_data (abfd); if (bed->merge_symbol && !bed->merge_symbol (info, sym_hash, h, sym, psec, pvalue, pold_alignment, skip, override, @@ -1180,7 +1279,7 @@ _bfd_elf_merge_symbol (bfd *abfd, && (olddef || (h->root.type == bfd_link_hash_common && (newweak - || ELF_ST_TYPE (sym->st_info) == STT_FUNC)))) + || bed->is_function_type (ELF_ST_TYPE (sym->st_info)))))) { *override = TRUE; newdef = FALSE; @@ -1235,7 +1334,7 @@ _bfd_elf_merge_symbol (bfd *abfd, && (newdef || (bfd_is_com_section (sec) && (oldweak - || h->type == STT_FUNC))) + || bed->is_function_type (h->type)))) && olddyn && olddef && h->def_dynamic) @@ -1464,6 +1563,10 @@ _bfd_elf_add_default_symbol (bfd *abfd, hi = h; } + /* Check if HI is a warning symbol. */ + if (hi->root.type == bfd_link_hash_warning) + hi = (struct elf_link_hash_entry *) hi->root.u.i.link; + /* If there is a duplicate definition somewhere, then HI may not point to an indirect symbol. We will have reported an error to the user in that case. */ @@ -1574,6 +1677,10 @@ _bfd_elf_export_symbol (struct elf_link_hash_entry *h, void *data) { struct elf_info_failed *eif = data; + /* Ignore this if we won't export it. */ + if (!eif->info->export_dynamic && !h->dynamic) + return TRUE; + /* Ignore indirect symbols. These are added by the versioning code. */ if (h->root.type == bfd_link_hash_indirect) return TRUE; @@ -1840,7 +1947,7 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data) /* We could not find the version for a symbol when generating a shared archive. Return an error. */ (*_bfd_error_handler) - (_("%B: undefined versioned symbol name %s"), + (_("%B: version node not found for symbol %s"), sinfo->output_bfd, h->root.root.string); bfd_set_error (bfd_error_bad_value); sinfo->failed = TRUE; @@ -2327,7 +2434,7 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h, if (h->needs_plt && eif->info->shared && is_elf_hash_table (eif->info->hash) - && (eif->info->symbolic + && (SYMBOLIC_BIND (eif->info, h) || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) && h->def_regular) { @@ -2502,6 +2609,52 @@ _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data) return TRUE; } +/* Adjust the dynamic symbol, H, for copy in the dynamic bss section, + DYNBSS. */ + +bfd_boolean +_bfd_elf_adjust_dynamic_copy (struct elf_link_hash_entry *h, + asection *dynbss) +{ + unsigned int power_of_two; + bfd_vma mask; + asection *sec = h->root.u.def.section; + + /* The section aligment of definition is the maximum alignment + requirement of symbols defined in the section. Since we don't + know the symbol alignment requirement, we start with the + maximum alignment and check low bits of the symbol address + for the minimum alignment. */ + power_of_two = bfd_get_section_alignment (sec->owner, sec); + mask = ((bfd_vma) 1 << power_of_two) - 1; + while ((h->root.u.def.value & mask) != 0) + { + mask >>= 1; + --power_of_two; + } + + if (power_of_two > bfd_get_section_alignment (dynbss->owner, + dynbss)) + { + /* Adjust the section alignment if needed. */ + if (! bfd_set_section_alignment (dynbss->owner, dynbss, + power_of_two)) + return FALSE; + } + + /* We make sure that the symbol will be aligned properly. */ + dynbss->size = BFD_ALIGN (dynbss->size, mask + 1); + + /* Define the symbol as being at this point in DYNBSS. */ + h->root.u.def.section = dynbss; + h->root.u.def.value = dynbss->size; + + /* Increment the size of DYNBSS to make room for the symbol. */ + dynbss->size += h->size; + + return TRUE; +} + /* Adjust all external symbols pointing into SEC_MERGE sections to reflect the object merging within the sections. */ @@ -2540,6 +2693,8 @@ _bfd_elf_dynamic_symbol_p (struct elf_link_hash_entry *h, bfd_boolean ignore_protected) { bfd_boolean binding_stays_local_p; + const struct elf_backend_data *bed; + struct elf_link_hash_table *hash_table; if (h == NULL) return FALSE; @@ -2556,7 +2711,7 @@ _bfd_elf_dynamic_symbol_p (struct elf_link_hash_entry *h, /* Identify the cases where name binding rules say that a visible symbol resolves locally. */ - binding_stays_local_p = info->executable || info->symbolic; + binding_stays_local_p = info->executable || SYMBOLIC_BIND (info, h); switch (ELF_ST_VISIBILITY (h->other)) { @@ -2565,10 +2720,16 @@ _bfd_elf_dynamic_symbol_p (struct elf_link_hash_entry *h, return FALSE; case STV_PROTECTED: + hash_table = elf_hash_table (info); + if (!is_elf_hash_table (hash_table)) + return FALSE; + + bed = get_elf_backend_data (hash_table->dynobj); + /* Proper resolution for function pointer equality may require that these symbols perhaps be resolved dynamically, even though we should be resolving them to the current module. */ - if (!ignore_protected || h->type != STT_FUNC) + if (!ignore_protected || !bed->is_function_type (h->type)) binding_stays_local_p = TRUE; break; @@ -2595,6 +2756,9 @@ _bfd_elf_symbol_refs_local_p (struct elf_link_hash_entry *h, struct bfd_link_info *info, bfd_boolean local_protected) { + const struct elf_backend_data *bed; + struct elf_link_hash_table *hash_table; + /* If it's a local sym, of course we resolve locally. */ if (h == NULL) return TRUE; @@ -2619,7 +2783,7 @@ _bfd_elf_symbol_refs_local_p (struct elf_link_hash_entry *h, /* At this point, we know the symbol is defined and dynamic. In an executable it must resolve locally, likewise when building symbolic shared libraries. */ - if (info->executable || info->symbolic) + if (info->executable || SYMBOLIC_BIND (info, h)) return TRUE; /* Now deal with defined dynamic symbols in shared libraries. Ones @@ -2631,8 +2795,14 @@ _bfd_elf_symbol_refs_local_p (struct elf_link_hash_entry *h, if (ELF_ST_VISIBILITY (h->other) != STV_PROTECTED) return TRUE; + hash_table = elf_hash_table (info); + if (!is_elf_hash_table (hash_table)) + return TRUE; + + bed = get_elf_backend_data (hash_table->dynobj); + /* STV_PROTECTED non-function symbols are local. */ - if (h->type != STT_FUNC) + if (!bed->is_function_type (h->type)) return TRUE; /* Function pointer equality tests may require that STV_PROTECTED @@ -2681,8 +2851,9 @@ is_global_data_symbol_definition (bfd *abfd ATTRIBUTE_UNUSED, && ELF_ST_BIND (sym->st_info) < STB_LOOS) return FALSE; + bed = get_elf_backend_data (abfd); /* Function symbols do not count. */ - if (ELF_ST_TYPE (sym->st_info) == STT_FUNC) + if (bed->is_function_type (ELF_ST_TYPE (sym->st_info))) return FALSE; /* If the section is undefined, then so is the symbol. */ @@ -2691,7 +2862,6 @@ is_global_data_symbol_definition (bfd *abfd ATTRIBUTE_UNUSED, /* If the symbol is defined in the common section, then it is a common definition and so does not count. */ - bed = get_elf_backend_data (abfd); if (bed->common_definition (sym)) return FALSE; @@ -3080,6 +3250,9 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) struct elf_link_hash_table *htab; bfd_size_type amt; void *alloc_mark = NULL; + struct bfd_hash_entry **old_table = NULL; + unsigned int old_size = 0; + unsigned int old_count = 0; void *old_tab = NULL; void *old_hash; void *old_ent; @@ -3126,7 +3299,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) const char *name; name = bfd_get_section_name (abfd, s); - if (strncmp (name, ".gnu.warning.", sizeof ".gnu.warning." - 1) == 0) + if (CONST_STRNEQ (name, ".gnu.warning.")) { char *msg; bfd_size_type sz; @@ -3511,6 +3684,9 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) memcpy (old_hash, sym_hash, hashsize); old_undefs = htab->root.undefs; old_undefs_tail = htab->root.undefs_tail; + old_table = htab->root.table.table; + old_size = htab->root.table.size; + old_count = htab->root.table.count; old_dynsymcount = htab->dynsymcount; for (i = 0; i < htab->root.table.size; i++) @@ -3592,12 +3768,10 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) sec = bfd_abs_section_ptr; else if (sec->kept_section) { - /* Symbols from discarded section are undefined, and have - default visibility. */ + /* Symbols from discarded section are undefined. We keep + its visibility. */ sec = bfd_und_section_ptr; isym->st_shndx = SHN_UNDEF; - isym->st_other = (STV_DEFAULT - | (isym->st_other & ~ ELF_ST_VISIBILITY (-1))); } else if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0) value -= sec->vma; @@ -3622,7 +3796,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) goto error_free_vers; if (isym->st_shndx == SHN_COMMON - && ELF_ST_TYPE (isym->st_info) == STT_TLS) + && ELF_ST_TYPE (isym->st_info) == STT_TLS + && !info->relocatable) { asection *tcomm = bfd_get_section_by_name (abfd, ".tcommon"); @@ -3694,8 +3869,9 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) if it is not a function, because it might be the version symbol itself. FIXME: What if it isn't? */ if ((iver.vs_vers & VERSYM_HIDDEN) != 0 - || (vernum > 1 && (! bfd_is_abs_section (sec) - || ELF_ST_TYPE (isym->st_info) == STT_FUNC))) + || (vernum > 1 + && (!bfd_is_abs_section (sec) + || bed->is_function_type (ELF_ST_TYPE (isym->st_info))))) { const char *verstr; size_t namelen, verlen, newlen; @@ -3842,7 +4018,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) if (dynamic && definition && (flags & BSF_WEAK) != 0 - && ELF_ST_TYPE (isym->st_info) != STT_FUNC + && !bed->is_function_type (ELF_ST_TYPE (isym->st_info)) && is_elf_hash_table (htab) && h->u.weakdef == NULL) { @@ -3929,18 +4105,30 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) } if (normal_align < common_align) - (*_bfd_error_handler) - (_("Warning: alignment %u of symbol `%s' in %B" - " is smaller than %u in %B"), - normal_bfd, common_bfd, - 1 << normal_align, name, 1 << common_align); + { + /* PR binutils/2735 */ + if (normal_bfd == NULL) + (*_bfd_error_handler) + (_("Warning: alignment %u of common symbol `%s' in %B" + " is greater than the alignment (%u) of its section %A"), + common_bfd, h->root.u.def.section, + 1 << common_align, name, 1 << normal_align); + else + (*_bfd_error_handler) + (_("Warning: alignment %u of symbol `%s' in %B" + " is smaller than %u in %B"), + normal_bfd, common_bfd, + 1 << normal_align, name, 1 << common_align); + } } - /* Remember the symbol size and type. */ - if (isym->st_size != 0 + /* Remember the symbol size if it isn't undefined. */ + if ((isym->st_size != 0 && isym->st_shndx != SHN_UNDEF) && (definition || h->size == 0)) { - if (h->size != 0 && h->size != isym->st_size && ! size_change_ok) + if (h->size != 0 + && h->size != isym->st_size + && ! size_change_ok) (*_bfd_error_handler) (_("Warning: size of symbol `%s' changed" " from %lu in %B to %lu in %B"), @@ -3955,7 +4143,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) to be the size of the common symbol. The code just above won't fix the size if a common symbol becomes larger. We don't warn about a size change here, because that is - covered by --warn-common. */ + covered by --warn-common. Allow changed between different + function types. */ if (h->root.type == bfd_link_hash_common) h->size = h->root.u.c.size; @@ -3989,13 +4178,13 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) isym->st_other = (STV_HIDDEN | (isym->st_other & ~ELF_ST_VISIBILITY (-1))); - if (isym->st_other != 0 && !dynamic) + if (ELF_ST_VISIBILITY (isym->st_other) != 0 && !dynamic) { unsigned char hvis, symvis, other, nvis; - /* Take the balance of OTHER from the definition. */ - other = (definition ? isym->st_other : h->other); - other &= ~ ELF_ST_VISIBILITY (-1); + /* Only merge the visibility. Leave the remainder of the + st_other field to elf_backend_merge_symbol_attribute. */ + other = h->other & ~ELF_ST_VISIBILITY (-1); /* Combine visibilities, using the most constraining one. */ hvis = ELF_ST_VISIBILITY (h->other); @@ -4045,6 +4234,13 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) dynsym = TRUE; } + if (definition && (sec->flags & SEC_DEBUGGING)) + { + /* We don't want to make debug symbol dynamic. */ + (*bed->elf_backend_hide_symbol) (info, h, TRUE); + dynsym = FALSE; + } + /* Check to see if we need to add an indirect symbol for the default name. */ if (definition || h->root.type == bfd_link_hash_common) @@ -4145,9 +4341,14 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) unsigned int i; /* Restore the symbol table. */ + if (bed->as_needed_cleanup) + (*bed->as_needed_cleanup) (abfd, info); old_hash = (char *) old_tab + tabsize; old_ent = (char *) old_hash + hashsize; sym_hash = elf_sym_hashes (abfd); + htab->root.table.table = old_table; + htab->root.table.size = old_size; + htab->root.table.count = old_count; memcpy (htab->root.table.table, old_tab, tabsize); memcpy (sym_hash, old_hash, hashsize); htab->root.undefs = old_undefs; @@ -4285,7 +4486,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) h = *hpp; if (h != NULL && h->root.type == bfd_link_hash_defined - && h->type != STT_FUNC) + && !bed->is_function_type (h->type)) { *sym_hash = h; sym_hash++; @@ -4457,7 +4658,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) asection *stab; for (stab = abfd->sections; stab; stab = stab->next) - if (strncmp (".stab", stab->name, 5) == 0 + if (CONST_STRNEQ (stab->name, ".stab") && (!stab->name[5] || (stab->name[5] == '.' && ISDIGIT (stab->name[6]))) && (stab->flags & SEC_MERGE) == 0 @@ -4807,6 +5008,131 @@ elf_collect_hash_codes (struct elf_link_hash_entry *h, void *data) return TRUE; } +struct collect_gnu_hash_codes +{ + bfd *output_bfd; + const struct elf_backend_data *bed; + unsigned long int nsyms; + unsigned long int maskbits; + unsigned long int *hashcodes; + unsigned long int *hashval; + unsigned long int *indx; + unsigned long int *counts; + bfd_vma *bitmask; + bfd_byte *contents; + long int min_dynindx; + unsigned long int bucketcount; + unsigned long int symindx; + long int local_indx; + long int shift1, shift2; + unsigned long int mask; +}; + +/* This function will be called though elf_link_hash_traverse to store + all hash value of the exported symbols in an array. */ + +static bfd_boolean +elf_collect_gnu_hash_codes (struct elf_link_hash_entry *h, void *data) +{ + struct collect_gnu_hash_codes *s = data; + const char *name; + char *p; + unsigned long ha; + char *alc = NULL; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* Ignore indirect symbols. These are added by the versioning code. */ + if (h->dynindx == -1) + return TRUE; + + /* Ignore also local symbols and undefined symbols. */ + if (! (*s->bed->elf_hash_symbol) (h)) + return TRUE; + + name = h->root.root.string; + p = strchr (name, ELF_VER_CHR); + if (p != NULL) + { + alc = bfd_malloc (p - name + 1); + memcpy (alc, name, p - name); + alc[p - name] = '\0'; + name = alc; + } + + /* Compute the hash value. */ + ha = bfd_elf_gnu_hash (name); + + /* Store the found hash value in the array for compute_bucket_count, + and also for .dynsym reordering purposes. */ + s->hashcodes[s->nsyms] = ha; + s->hashval[h->dynindx] = ha; + ++s->nsyms; + if (s->min_dynindx < 0 || s->min_dynindx > h->dynindx) + s->min_dynindx = h->dynindx; + + if (alc != NULL) + free (alc); + + return TRUE; +} + +/* This function will be called though elf_link_hash_traverse to do + final dynaminc symbol renumbering. */ + +static bfd_boolean +elf_renumber_gnu_hash_syms (struct elf_link_hash_entry *h, void *data) +{ + struct collect_gnu_hash_codes *s = data; + unsigned long int bucket; + unsigned long int val; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* Ignore indirect symbols. */ + if (h->dynindx == -1) + return TRUE; + + /* Ignore also local symbols and undefined symbols. */ + if (! (*s->bed->elf_hash_symbol) (h)) + { + if (h->dynindx >= s->min_dynindx) + h->dynindx = s->local_indx++; + return TRUE; + } + + bucket = s->hashval[h->dynindx] % s->bucketcount; + val = (s->hashval[h->dynindx] >> s->shift1) + & ((s->maskbits >> s->shift1) - 1); + s->bitmask[val] |= ((bfd_vma) 1) << (s->hashval[h->dynindx] & s->mask); + s->bitmask[val] + |= ((bfd_vma) 1) << ((s->hashval[h->dynindx] >> s->shift2) & s->mask); + val = s->hashval[h->dynindx] & ~(unsigned long int) 1; + if (s->counts[bucket] == 1) + /* Last element terminates the chain. */ + val |= 1; + bfd_put_32 (s->output_bfd, val, + s->contents + (s->indx[bucket] - s->symindx) * 4); + --s->counts[bucket]; + h->dynindx = s->indx[bucket]++; + return TRUE; +} + +/* Return TRUE if symbol should be hashed in the `.gnu.hash' section. */ + +bfd_boolean +_bfd_elf_hash_symbol (struct elf_link_hash_entry *h) +{ + return !(h->forced_local + || h->root.type == bfd_link_hash_undefined + || h->root.type == bfd_link_hash_undefweak + || ((h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && h->root.u.def.section->output_section == NULL)); +} + /* Array used to determine the number of hash table buckets to use based on the number of symbols there are. If there are fewer than 3 symbols we use 1 bucket, fewer than 17 symbols we use 3 buckets, @@ -4828,42 +5154,26 @@ static const size_t elf_buckets[] = Therefore the result is always a good payoff between few collisions (= short chain lengths) and table size. */ static size_t -compute_bucket_count (struct bfd_link_info *info) +compute_bucket_count (struct bfd_link_info *info, unsigned long int *hashcodes, + unsigned long int nsyms, int gnu_hash) { size_t dynsymcount = elf_hash_table (info)->dynsymcount; size_t best_size = 0; - unsigned long int *hashcodes; - unsigned long int *hashcodesp; unsigned long int i; bfd_size_type amt; - /* Compute the hash values for all exported symbols. At the same - time store the values in an array so that we could use them for - optimizations. */ - amt = dynsymcount; - amt *= sizeof (unsigned long int); - hashcodes = bfd_malloc (amt); - if (hashcodes == NULL) - return 0; - hashcodesp = hashcodes; - - /* Put all hash values in HASHCODES. */ - elf_link_hash_traverse (elf_hash_table (info), - elf_collect_hash_codes, &hashcodesp); - /* We have a problem here. The following code to optimize the table size requires an integer type with more the 32 bits. If BFD_HOST_U_64_BIT is set we know about such a type. */ #ifdef BFD_HOST_U_64_BIT if (info->optimize) { - unsigned long int nsyms = hashcodesp - hashcodes; size_t minsize; size_t maxsize; BFD_HOST_U_64_BIT best_chlen = ~((BFD_HOST_U_64_BIT) 0); - unsigned long int *counts ; bfd *dynobj = elf_hash_table (info)->dynobj; const struct elf_backend_data *bed = get_elf_backend_data (dynobj); + unsigned long int *counts; /* Possible optimization parameters: if we have NSYMS symbols we say that the hashing table must at least have NSYMS/4 and at most @@ -4872,6 +5182,13 @@ compute_bucket_count (struct bfd_link_info *info) if (minsize == 0) minsize = 1; best_size = maxsize = nsyms * 2; + if (gnu_hash) + { + if (minsize < 2) + minsize = 2; + if ((best_size & 31) == 0) + ++best_size; + } /* Create array where we count the collisions in. We must use bfd_malloc since the size could be large. */ @@ -4879,10 +5196,7 @@ compute_bucket_count (struct bfd_link_info *info) amt *= sizeof (unsigned long int); counts = bfd_malloc (amt); if (counts == NULL) - { - free (hashcodes); - return 0; - } + return 0; /* Compute the "optimal" size for the hash table. The criteria is a minimal chain length. The minor criteria is (of course) the size @@ -4894,6 +5208,9 @@ compute_bucket_count (struct bfd_link_info *info) unsigned long int j; unsigned long int fact; + if (gnu_hash && (i & 31) == 0) + continue; + memset (counts, '\0', i * sizeof (unsigned long int)); /* Determine how often each hash bucket is used. */ @@ -4909,9 +5226,9 @@ compute_bucket_count (struct bfd_link_info *info) # define BFD_TARGET_PAGESIZE (4096) # endif - /* We in any case need 2 + NSYMS entries for the size values and - the chains. */ - max = (2 + nsyms) * (bed->s->arch_size / 8); + /* We in any case need 2 + DYNSYMCOUNT entries for the size values + and the chains. */ + max = (2 + dynsymcount) * bed->s->sizeof_hash_entry; # if 1 /* Variant 1: optimize for short chains. We add the squares @@ -4921,7 +5238,7 @@ compute_bucket_count (struct bfd_link_info *info) max += counts[j] * counts[j]; /* This adds penalties for the overall size of the table. */ - fact = i / (BFD_TARGET_PAGESIZE / (bed->s->arch_size / 8)) + 1; + fact = i / (BFD_TARGET_PAGESIZE / bed->s->sizeof_hash_entry) + 1; max *= fact * fact; # else /* Variant 2: Optimize a lot more for small table. Here we @@ -4932,7 +5249,7 @@ compute_bucket_count (struct bfd_link_info *info) /* The overall size of the table is considered, but not as strong as in variant 1, where it is squared. */ - fact = i / (BFD_TARGET_PAGESIZE / (bed->s->arch_size / 8)) + 1; + fact = i / (BFD_TARGET_PAGESIZE / bed->s->sizeof_hash_entry) + 1; max *= fact; # endif @@ -4955,14 +5272,13 @@ compute_bucket_count (struct bfd_link_info *info) for (i = 0; elf_buckets[i] != 0; i++) { best_size = elf_buckets[i]; - if (dynsymcount < elf_buckets[i + 1]) + if (nsyms < elf_buckets[i + 1]) break; } + if (gnu_hash && best_size < 2) + best_size = 2; } - /* Free the arrays we needed. */ - free (hashcodes); - return best_size; } @@ -4993,6 +5309,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, if (!is_elf_hash_table (info->hash)) return TRUE; + bed = get_elf_backend_data (output_bfd); elf_tdata (output_bfd)->relro = info->relro; if (info->execstack) elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X; @@ -5019,7 +5336,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, exec = PF_X; notesec = s; } - else + else if (bed->default_execstack) exec = PF_X; } if (notesec) @@ -5040,11 +5357,13 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, /* The backend may have to create some sections regardless of whether we're dynamic or not. */ - bed = get_elf_backend_data (output_bfd); if (bed->elf_backend_always_size_sections && ! (*bed->elf_backend_always_size_sections) (output_bfd, info)) return FALSE; + if (! _bfd_elf_maybe_strip_eh_frame_hdr (info)) + return FALSE; + dynobj = elf_hash_table (info)->dynobj; /* If there were no dynamic objects in the link, there is nothing to @@ -5052,9 +5371,6 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, if (dynobj == NULL) return TRUE; - if (! _bfd_elf_maybe_strip_eh_frame_hdr (info)) - return FALSE; - if (elf_hash_table (info)->dynamic_sections_created) { struct elf_info_failed eif; @@ -5135,7 +5451,8 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, /* If we are supposed to export all symbols into the dynamic symbol table (this is not the normal case), then do so. */ - if (info->export_dynamic) + if (info->export_dynamic + || (info->executable && info->dynamic)) { elf_link_hash_traverse (elf_hash_table (info), _bfd_elf_export_symbol, @@ -5277,15 +5594,16 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) - for (o = sub->sections; o != NULL; o = o->next) - if (elf_section_data (o)->this_hdr.sh_type - == SHT_PREINIT_ARRAY) - { - (*_bfd_error_handler) - (_("%B: .preinit_array section is not allowed in DSO"), - sub); - break; - } + if (bfd_get_flavour (sub) == bfd_target_elf_flavour) + for (o = sub->sections; o != NULL; o = o->next) + if (elf_section_data (o)->this_hdr.sh_type + == SHT_PREINIT_ARRAY) + { + (*_bfd_error_handler) + (_("%B: .preinit_array section is not allowed in DSO"), + sub); + break; + } bfd_set_error (bfd_error_nonrepresentable_section); return FALSE; @@ -5320,7 +5638,10 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, bfd_size_type strsize; strsize = _bfd_elf_strtab_size (elf_hash_table (info)->dynstr); - if (!_bfd_elf_add_dynamic_entry (info, DT_HASH, 0) + if ((info->emit_hash + && !_bfd_elf_add_dynamic_entry (info, DT_HASH, 0)) + || (info->emit_gnu_hash + && !_bfd_elf_add_dynamic_entry (info, DT_GNU_HASH, 0)) || !_bfd_elf_add_dynamic_entry (info, DT_STRTAB, 0) || !_bfd_elf_add_dynamic_entry (info, DT_SYMTAB, 0) || !_bfd_elf_add_dynamic_entry (info, DT_STRSZ, strsize) @@ -5709,21 +6030,68 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, return TRUE; } +/* Find the first non-excluded output section. We'll use its + section symbol for some emitted relocs. */ +void +_bfd_elf_init_1_index_section (bfd *output_bfd, struct bfd_link_info *info) +{ + asection *s; + + for (s = output_bfd->sections; s != NULL; s = s->next) + if ((s->flags & (SEC_EXCLUDE | SEC_ALLOC)) == SEC_ALLOC + && !_bfd_elf_link_omit_section_dynsym (output_bfd, info, s)) + { + elf_hash_table (info)->text_index_section = s; + break; + } +} + +/* Find two non-excluded output sections, one for code, one for data. + We'll use their section symbols for some emitted relocs. */ +void +_bfd_elf_init_2_index_sections (bfd *output_bfd, struct bfd_link_info *info) +{ + asection *s; + + for (s = output_bfd->sections; s != NULL; s = s->next) + if (((s->flags & (SEC_EXCLUDE | SEC_ALLOC | SEC_READONLY)) + == (SEC_ALLOC | SEC_READONLY)) + && !_bfd_elf_link_omit_section_dynsym (output_bfd, info, s)) + { + elf_hash_table (info)->text_index_section = s; + break; + } + + for (s = output_bfd->sections; s != NULL; s = s->next) + if (((s->flags & (SEC_EXCLUDE | SEC_ALLOC | SEC_READONLY)) == SEC_ALLOC) + && !_bfd_elf_link_omit_section_dynsym (output_bfd, info, s)) + { + elf_hash_table (info)->data_index_section = s; + break; + } + + if (elf_hash_table (info)->text_index_section == NULL) + elf_hash_table (info)->text_index_section + = elf_hash_table (info)->data_index_section; +} + bfd_boolean bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info) { + const struct elf_backend_data *bed; + if (!is_elf_hash_table (info->hash)) return TRUE; + bed = get_elf_backend_data (output_bfd); + (*bed->elf_backend_init_index_section) (output_bfd, info); + if (elf_hash_table (info)->dynamic_sections_created) { bfd *dynobj; - const struct elf_backend_data *bed; asection *s; bfd_size_type dynsymcount; unsigned long section_sym_count; - size_t bucketcount = 0; - size_t hash_entry_size; unsigned int dtagcount; dynobj = elf_hash_table (info)->dynobj; @@ -5759,7 +6127,6 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info) section as we went along in elf_link_add_object_symbols. */ s = bfd_get_section_by_name (dynobj, ".dynsym"); BFD_ASSERT (s != NULL); - bed = get_elf_backend_data (output_bfd); s->size = dynsymcount * bed->s->sizeof_sym; if (dynsymcount != 0) @@ -5774,23 +6141,215 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info) memset (s->contents, 0, section_sym_count * bed->s->sizeof_sym); } + elf_hash_table (info)->bucketcount = 0; + /* Compute the size of the hashing table. As a side effect this computes the hash values for all the names we export. */ - bucketcount = compute_bucket_count (info); + if (info->emit_hash) + { + unsigned long int *hashcodes; + unsigned long int *hashcodesp; + bfd_size_type amt; + unsigned long int nsyms; + size_t bucketcount; + size_t hash_entry_size; + + /* Compute the hash values for all exported symbols. At the same + time store the values in an array so that we could use them for + optimizations. */ + amt = dynsymcount * sizeof (unsigned long int); + hashcodes = bfd_malloc (amt); + if (hashcodes == NULL) + return FALSE; + hashcodesp = hashcodes; - s = bfd_get_section_by_name (dynobj, ".hash"); - BFD_ASSERT (s != NULL); - hash_entry_size = elf_section_data (s)->this_hdr.sh_entsize; - s->size = ((2 + bucketcount + dynsymcount) * hash_entry_size); - s->contents = bfd_zalloc (output_bfd, s->size); - if (s->contents == NULL) - return FALSE; + /* Put all hash values in HASHCODES. */ + elf_link_hash_traverse (elf_hash_table (info), + elf_collect_hash_codes, &hashcodesp); - bfd_put (8 * hash_entry_size, output_bfd, bucketcount, s->contents); - bfd_put (8 * hash_entry_size, output_bfd, dynsymcount, - s->contents + hash_entry_size); + nsyms = hashcodesp - hashcodes; + bucketcount + = compute_bucket_count (info, hashcodes, nsyms, 0); + free (hashcodes); - elf_hash_table (info)->bucketcount = bucketcount; + if (bucketcount == 0) + return FALSE; + + elf_hash_table (info)->bucketcount = bucketcount; + + s = bfd_get_section_by_name (dynobj, ".hash"); + BFD_ASSERT (s != NULL); + hash_entry_size = elf_section_data (s)->this_hdr.sh_entsize; + s->size = ((2 + bucketcount + dynsymcount) * hash_entry_size); + s->contents = bfd_zalloc (output_bfd, s->size); + if (s->contents == NULL) + return FALSE; + + bfd_put (8 * hash_entry_size, output_bfd, bucketcount, s->contents); + bfd_put (8 * hash_entry_size, output_bfd, dynsymcount, + s->contents + hash_entry_size); + } + + if (info->emit_gnu_hash) + { + size_t i, cnt; + unsigned char *contents; + struct collect_gnu_hash_codes cinfo; + bfd_size_type amt; + size_t bucketcount; + + memset (&cinfo, 0, sizeof (cinfo)); + + /* Compute the hash values for all exported symbols. At the same + time store the values in an array so that we could use them for + optimizations. */ + amt = dynsymcount * 2 * sizeof (unsigned long int); + cinfo.hashcodes = bfd_malloc (amt); + if (cinfo.hashcodes == NULL) + return FALSE; + + cinfo.hashval = cinfo.hashcodes + dynsymcount; + cinfo.min_dynindx = -1; + cinfo.output_bfd = output_bfd; + cinfo.bed = bed; + + /* Put all hash values in HASHCODES. */ + elf_link_hash_traverse (elf_hash_table (info), + elf_collect_gnu_hash_codes, &cinfo); + + bucketcount + = compute_bucket_count (info, cinfo.hashcodes, cinfo.nsyms, 1); + + if (bucketcount == 0) + { + free (cinfo.hashcodes); + return FALSE; + } + + s = bfd_get_section_by_name (dynobj, ".gnu.hash"); + BFD_ASSERT (s != NULL); + + if (cinfo.nsyms == 0) + { + /* Empty .gnu.hash section is special. */ + BFD_ASSERT (cinfo.min_dynindx == -1); + free (cinfo.hashcodes); + s->size = 5 * 4 + bed->s->arch_size / 8; + contents = bfd_zalloc (output_bfd, s->size); + if (contents == NULL) + return FALSE; + s->contents = contents; + /* 1 empty bucket. */ + bfd_put_32 (output_bfd, 1, contents); + /* SYMIDX above the special symbol 0. */ + bfd_put_32 (output_bfd, 1, contents + 4); + /* Just one word for bitmask. */ + bfd_put_32 (output_bfd, 1, contents + 8); + /* Only hash fn bloom filter. */ + bfd_put_32 (output_bfd, 0, contents + 12); + /* No hashes are valid - empty bitmask. */ + bfd_put (bed->s->arch_size, output_bfd, 0, contents + 16); + /* No hashes in the only bucket. */ + bfd_put_32 (output_bfd, 0, + contents + 16 + bed->s->arch_size / 8); + } + else + { + unsigned long int maskwords, maskbitslog2; + BFD_ASSERT (cinfo.min_dynindx != -1); + + maskbitslog2 = bfd_log2 (cinfo.nsyms) + 1; + if (maskbitslog2 < 3) + maskbitslog2 = 5; + else if ((1 << (maskbitslog2 - 2)) & cinfo.nsyms) + maskbitslog2 = maskbitslog2 + 3; + else + maskbitslog2 = maskbitslog2 + 2; + if (bed->s->arch_size == 64) + { + if (maskbitslog2 == 5) + maskbitslog2 = 6; + cinfo.shift1 = 6; + } + else + cinfo.shift1 = 5; + cinfo.mask = (1 << cinfo.shift1) - 1; + cinfo.shift2 = maskbitslog2; + cinfo.maskbits = 1 << maskbitslog2; + maskwords = 1 << (maskbitslog2 - cinfo.shift1); + amt = bucketcount * sizeof (unsigned long int) * 2; + amt += maskwords * sizeof (bfd_vma); + cinfo.bitmask = bfd_malloc (amt); + if (cinfo.bitmask == NULL) + { + free (cinfo.hashcodes); + return FALSE; + } + + cinfo.counts = (void *) (cinfo.bitmask + maskwords); + cinfo.indx = cinfo.counts + bucketcount; + cinfo.symindx = dynsymcount - cinfo.nsyms; + memset (cinfo.bitmask, 0, maskwords * sizeof (bfd_vma)); + + /* Determine how often each hash bucket is used. */ + memset (cinfo.counts, 0, bucketcount * sizeof (cinfo.counts[0])); + for (i = 0; i < cinfo.nsyms; ++i) + ++cinfo.counts[cinfo.hashcodes[i] % bucketcount]; + + for (i = 0, cnt = cinfo.symindx; i < bucketcount; ++i) + if (cinfo.counts[i] != 0) + { + cinfo.indx[i] = cnt; + cnt += cinfo.counts[i]; + } + BFD_ASSERT (cnt == dynsymcount); + cinfo.bucketcount = bucketcount; + cinfo.local_indx = cinfo.min_dynindx; + + s->size = (4 + bucketcount + cinfo.nsyms) * 4; + s->size += cinfo.maskbits / 8; + contents = bfd_zalloc (output_bfd, s->size); + if (contents == NULL) + { + free (cinfo.bitmask); + free (cinfo.hashcodes); + return FALSE; + } + + s->contents = contents; + bfd_put_32 (output_bfd, bucketcount, contents); + bfd_put_32 (output_bfd, cinfo.symindx, contents + 4); + bfd_put_32 (output_bfd, maskwords, contents + 8); + bfd_put_32 (output_bfd, cinfo.shift2, contents + 12); + contents += 16 + cinfo.maskbits / 8; + + for (i = 0; i < bucketcount; ++i) + { + if (cinfo.counts[i] == 0) + bfd_put_32 (output_bfd, 0, contents); + else + bfd_put_32 (output_bfd, cinfo.indx[i], contents); + contents += 4; + } + + cinfo.contents = contents; + + /* Renumber dynamic symbols, populate .gnu.hash section. */ + elf_link_hash_traverse (elf_hash_table (info), + elf_renumber_gnu_hash_syms, &cinfo); + + contents = s->contents + 16; + for (i = 0; i < maskwords; ++i) + { + bfd_put (bed->s->arch_size, output_bfd, cinfo.bitmask[i], + contents); + contents += bed->s->arch_size / 8; + } + + free (cinfo.bitmask); + free (cinfo.hashcodes); + } + } s = bfd_get_section_by_name (dynobj, ".dynstr"); BFD_ASSERT (s != NULL); @@ -5866,6 +6425,719 @@ struct elf_outext_info struct elf_final_link_info *finfo; }; + +/* Support for evaluating a complex relocation. + + Complex relocations are generalized, self-describing relocations. The + implementation of them consists of two parts: complex symbols, and the + relocations themselves. + + The relocations are use a reserved elf-wide relocation type code (R_RELC + external / BFD_RELOC_RELC internal) and an encoding of relocation field + information (start bit, end bit, word width, etc) into the addend. This + information is extracted from CGEN-generated operand tables within gas. + + Complex symbols are mangled symbols (BSF_RELC external / STT_RELC + internal) representing prefix-notation expressions, including but not + limited to those sorts of expressions normally encoded as addends in the + addend field. The symbol mangling format is: + + <node> := <literal> + | <unary-operator> ':' <node> + | <binary-operator> ':' <node> ':' <node> + ; + + <literal> := 's' <digits=N> ':' <N character symbol name> + | 'S' <digits=N> ':' <N character section name> + | '#' <hexdigits> + ; + + <binary-operator> := as in C + <unary-operator> := as in C, plus "0-" for unambiguous negation. */ + +static void +set_symbol_value (bfd * bfd_with_globals, + struct elf_final_link_info * finfo, + int symidx, + bfd_vma val) +{ + bfd_boolean is_local; + Elf_Internal_Sym * sym; + struct elf_link_hash_entry ** sym_hashes; + struct elf_link_hash_entry * h; + + sym_hashes = elf_sym_hashes (bfd_with_globals); + sym = finfo->internal_syms + symidx; + is_local = ELF_ST_BIND(sym->st_info) == STB_LOCAL; + + if (is_local) + { + /* It is a local symbol: move it to the + "absolute" section and give it a value. */ + sym->st_shndx = SHN_ABS; + sym->st_value = val; + } + else + { + /* It is a global symbol: set its link type + to "defined" and give it a value. */ + h = sym_hashes [symidx]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + h->root.type = bfd_link_hash_defined; + h->root.u.def.value = val; + h->root.u.def.section = bfd_abs_section_ptr; + } +} + +static bfd_boolean +resolve_symbol (const char * name, + bfd * input_bfd, + struct elf_final_link_info * finfo, + bfd_vma * result, + size_t locsymcount) +{ + Elf_Internal_Sym * sym; + struct bfd_link_hash_entry * global_entry; + const char * candidate = NULL; + Elf_Internal_Shdr * symtab_hdr; + asection * sec = NULL; + size_t i; + + symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; + + for (i = 0; i < locsymcount; ++ i) + { + sym = finfo->internal_syms + i; + sec = finfo->sections [i]; + + if (ELF_ST_BIND (sym->st_info) != STB_LOCAL) + continue; + + candidate = bfd_elf_string_from_elf_section (input_bfd, + symtab_hdr->sh_link, + sym->st_name); +#ifdef DEBUG + printf ("Comparing string: '%s' vs. '%s' = 0x%x\n", + name, candidate, (unsigned int)sym->st_value); +#endif + if (candidate && strcmp (candidate, name) == 0) + { + * result = sym->st_value; + + if (sym->st_shndx > SHN_UNDEF && + sym->st_shndx < SHN_LORESERVE) + { +#ifdef DEBUG + printf ("adjusting for sec '%s' @ 0x%x + 0x%x\n", + sec->output_section->name, + (unsigned int)sec->output_section->vma, + (unsigned int)sec->output_offset); +#endif + * result += sec->output_offset + sec->output_section->vma; + } +#ifdef DEBUG + printf ("Found symbol with effective value %8.8x\n", (unsigned int)* result); +#endif + return TRUE; + } + } + + /* Hmm, haven't found it yet. perhaps it is a global. */ + global_entry = bfd_link_hash_lookup (finfo->info->hash, name, FALSE, FALSE, TRUE); + if (!global_entry) + return FALSE; + + if (global_entry->type == bfd_link_hash_defined + || global_entry->type == bfd_link_hash_defweak) + { + * result = global_entry->u.def.value + + global_entry->u.def.section->output_section->vma + + global_entry->u.def.section->output_offset; +#ifdef DEBUG + printf ("Found GLOBAL symbol '%s' with value %8.8x\n", + global_entry->root.string, (unsigned int)*result); +#endif + return TRUE; + } + + if (global_entry->type == bfd_link_hash_common) + { + *result = global_entry->u.def.value + + bfd_com_section_ptr->output_section->vma + + bfd_com_section_ptr->output_offset; +#ifdef DEBUG + printf ("Found COMMON symbol '%s' with value %8.8x\n", + global_entry->root.string, (unsigned int)*result); +#endif + return TRUE; + } + + return FALSE; +} + +static bfd_boolean +resolve_section (const char * name, + asection * sections, + bfd_vma * result) +{ + asection * curr; + unsigned int len; + + for (curr = sections; curr; curr = curr->next) + if (strcmp (curr->name, name) == 0) + { + *result = curr->vma; + return TRUE; + } + + /* Hmm. still haven't found it. try pseudo-section names. */ + for (curr = sections; curr; curr = curr->next) + { + len = strlen (curr->name); + if (len > strlen (name)) + continue; + + if (strncmp (curr->name, name, len) == 0) + { + if (strncmp (".end", name + len, 4) == 0) + { + *result = curr->vma + curr->size; + return TRUE; + } + + /* Insert more pseudo-section names here, if you like. */ + } + } + + return FALSE; +} + +static void +undefined_reference (const char * reftype, + const char * name) +{ + _bfd_error_handler (_("undefined %s reference in complex symbol: %s"), reftype, name); +} + +static bfd_boolean +eval_symbol (bfd_vma * result, + char * sym, + char ** advanced, + bfd * input_bfd, + struct elf_final_link_info * finfo, + bfd_vma addr, + bfd_vma section_offset, + size_t locsymcount, + int signed_p) +{ + int len; + int symlen; + bfd_vma a; + bfd_vma b; + const int bufsz = 4096; + char symbuf [bufsz]; + const char * symend; + bfd_boolean symbol_is_section = FALSE; + + len = strlen (sym); + symend = sym + len; + + if (len < 1 || len > bufsz) + { + bfd_set_error (bfd_error_invalid_operation); + return FALSE; + } + + switch (* sym) + { + case '.': + * result = addr + section_offset; + * advanced = sym + 1; + return TRUE; + + case '#': + ++ sym; + * result = strtoul (sym, advanced, 16); + return TRUE; + + case 'S': + symbol_is_section = TRUE; + case 's': + ++ sym; + symlen = strtol (sym, &sym, 10); + ++ sym; /* Skip the trailing ':'. */ + + if ((symend < sym) || ((symlen + 1) > bufsz)) + { + bfd_set_error (bfd_error_invalid_operation); + return FALSE; + } + + memcpy (symbuf, sym, symlen); + symbuf [symlen] = '\0'; + * advanced = sym + symlen; + + /* Is it always possible, with complex symbols, that gas "mis-guessed" + the symbol as a section, or vice-versa. so we're pretty liberal in our + interpretation here; section means "try section first", not "must be a + section", and likewise with symbol. */ + + if (symbol_is_section) + { + if ((resolve_section (symbuf, finfo->output_bfd->sections, result) != TRUE) + && (resolve_symbol (symbuf, input_bfd, finfo, result, locsymcount) != TRUE)) + { + undefined_reference ("section", symbuf); + return FALSE; + } + } + else + { + if ((resolve_symbol (symbuf, input_bfd, finfo, result, locsymcount) != TRUE) + && (resolve_section (symbuf, finfo->output_bfd->sections, + result) != TRUE)) + { + undefined_reference ("symbol", symbuf); + return FALSE; + } + } + + return TRUE; + + /* All that remains are operators. */ + +#define UNARY_OP(op) \ + if (strncmp (sym, #op, strlen (#op)) == 0) \ + { \ + sym += strlen (#op); \ + if (* sym == ':') \ + ++ sym; \ + if (eval_symbol (& a, sym, & sym, input_bfd, finfo, addr, \ + section_offset, locsymcount, signed_p) \ + != TRUE) \ + return FALSE; \ + if (signed_p) \ + * result = op ((signed)a); \ + else \ + * result = op a; \ + * advanced = sym; \ + return TRUE; \ + } + +#define BINARY_OP(op) \ + if (strncmp (sym, #op, strlen (#op)) == 0) \ + { \ + sym += strlen (#op); \ + if (* sym == ':') \ + ++ sym; \ + if (eval_symbol (& a, sym, & sym, input_bfd, finfo, addr, \ + section_offset, locsymcount, signed_p) \ + != TRUE) \ + return FALSE; \ + ++ sym; \ + if (eval_symbol (& b, sym, & sym, input_bfd, finfo, addr, \ + section_offset, locsymcount, signed_p) \ + != TRUE) \ + return FALSE; \ + if (signed_p) \ + * result = ((signed) a) op ((signed) b); \ + else \ + * result = a op b; \ + * advanced = sym; \ + return TRUE; \ + } + + default: + UNARY_OP (0-); + BINARY_OP (<<); + BINARY_OP (>>); + BINARY_OP (==); + BINARY_OP (!=); + BINARY_OP (<=); + BINARY_OP (>=); + BINARY_OP (&&); + BINARY_OP (||); + UNARY_OP (~); + UNARY_OP (!); + BINARY_OP (*); + BINARY_OP (/); + BINARY_OP (%); + BINARY_OP (^); + BINARY_OP (|); + BINARY_OP (&); + BINARY_OP (+); + BINARY_OP (-); + BINARY_OP (<); + BINARY_OP (>); +#undef UNARY_OP +#undef BINARY_OP + _bfd_error_handler (_("unknown operator '%c' in complex symbol"), * sym); + bfd_set_error (bfd_error_invalid_operation); + return FALSE; + } +} + +/* Entry point to evaluator, called from elf_link_input_bfd. */ + +static bfd_boolean +evaluate_complex_relocation_symbols (bfd * input_bfd, + struct elf_final_link_info * finfo, + size_t locsymcount) +{ + const struct elf_backend_data * bed; + Elf_Internal_Shdr * symtab_hdr; + struct elf_link_hash_entry ** sym_hashes; + asection * reloc_sec; + bfd_boolean result = TRUE; + + /* For each section, we're going to check and see if it has any + complex relocations, and we're going to evaluate any of them + we can. */ + + if (finfo->info->relocatable) + return TRUE; + + symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + bed = get_elf_backend_data (input_bfd); + + for (reloc_sec = input_bfd->sections; reloc_sec; reloc_sec = reloc_sec->next) + { + Elf_Internal_Rela * internal_relocs; + unsigned long i; + + /* This section was omitted from the link. */ + if (! reloc_sec->linker_mark) + continue; + + /* Only process sections containing relocs. */ + if ((reloc_sec->flags & SEC_RELOC) == 0) + continue; + + if (reloc_sec->reloc_count == 0) + continue; + + /* Read in the relocs for this section. */ + internal_relocs + = _bfd_elf_link_read_relocs (input_bfd, reloc_sec, NULL, + (Elf_Internal_Rela *) NULL, + FALSE); + if (internal_relocs == NULL) + continue; + + for (i = reloc_sec->reloc_count; i--;) + { + Elf_Internal_Rela * rel; + char * sym_name; + bfd_vma index; + Elf_Internal_Sym * sym; + bfd_vma result; + bfd_vma section_offset; + bfd_vma addr; + int signed_p = 0; + + rel = internal_relocs + i; + section_offset = reloc_sec->output_section->vma + + reloc_sec->output_offset; + addr = rel->r_offset; + + index = ELF32_R_SYM (rel->r_info); + if (bed->s->arch_size == 64) + index >>= 24; + + if (index == STN_UNDEF) + continue; + + if (index < locsymcount) + { + /* The symbol is local. */ + sym = finfo->internal_syms + index; + + /* We're only processing STT_RELC or STT_SRELC type symbols. */ + if ((ELF_ST_TYPE (sym->st_info) != STT_RELC) && + (ELF_ST_TYPE (sym->st_info) != STT_SRELC)) + continue; + + sym_name = bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name); + + signed_p = (ELF_ST_TYPE (sym->st_info) == STT_SRELC); + } + else + { + /* The symbol is global. */ + struct elf_link_hash_entry * h; + + if (elf_bad_symtab (input_bfd)) + continue; + + h = sym_hashes [index - locsymcount]; + while ( h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + if (h->type != STT_RELC && h->type != STT_SRELC) + continue; + + signed_p = (h->type == STT_SRELC); + sym_name = (char *) h->root.root.string; + } +#ifdef DEBUG + printf ("Encountered a complex symbol!"); + printf (" (input_bfd %s, section %s, reloc %ld\n", + input_bfd->filename, reloc_sec->name, i); + printf (" symbol: idx %8.8lx, name %s\n", + index, sym_name); + printf (" reloc : info %8.8lx, addr %8.8lx\n", + rel->r_info, addr); + printf (" Evaluating '%s' ...\n ", sym_name); +#endif + if (eval_symbol (& result, sym_name, & sym_name, input_bfd, + finfo, addr, section_offset, locsymcount, + signed_p)) + /* Symbol evaluated OK. Update to absolute value. */ + set_symbol_value (input_bfd, finfo, index, result); + + else + result = FALSE; + } + + if (internal_relocs != elf_section_data (reloc_sec)->relocs) + free (internal_relocs); + } + + /* If nothing went wrong, then we adjusted + everything we wanted to adjust. */ + return result; +} + +static void +put_value (bfd_vma size, + unsigned long chunksz, + bfd * input_bfd, + bfd_vma x, + bfd_byte * location) +{ + location += (size - chunksz); + + for (; size; size -= chunksz, location -= chunksz, x >>= (chunksz * 8)) + { + switch (chunksz) + { + default: + case 0: + abort (); + case 1: + bfd_put_8 (input_bfd, x, location); + break; + case 2: + bfd_put_16 (input_bfd, x, location); + break; + case 4: + bfd_put_32 (input_bfd, x, location); + break; + case 8: +#ifdef BFD64 + bfd_put_64 (input_bfd, x, location); +#else + abort (); +#endif + break; + } + } +} + +static bfd_vma +get_value (bfd_vma size, + unsigned long chunksz, + bfd * input_bfd, + bfd_byte * location) +{ + bfd_vma x = 0; + + for (; size; size -= chunksz, location += chunksz) + { + switch (chunksz) + { + default: + case 0: + abort (); + case 1: + x = (x << (8 * chunksz)) | bfd_get_8 (input_bfd, location); + break; + case 2: + x = (x << (8 * chunksz)) | bfd_get_16 (input_bfd, location); + break; + case 4: + x = (x << (8 * chunksz)) | bfd_get_32 (input_bfd, location); + break; + case 8: +#ifdef BFD64 + x = (x << (8 * chunksz)) | bfd_get_64 (input_bfd, location); +#else + abort (); +#endif + break; + } + } + return x; +} + +static void +decode_complex_addend + (unsigned long * start, /* in bits */ + unsigned long * oplen, /* in bits */ + unsigned long * len, /* in bits */ + unsigned long * wordsz, /* in bytes */ + unsigned long * chunksz, /* in bytes */ + unsigned long * lsb0_p, + unsigned long * signed_p, + unsigned long * trunc_p, + unsigned long encoded) +{ + * start = encoded & 0x3F; + * len = (encoded >> 6) & 0x3F; + * oplen = (encoded >> 12) & 0x3F; + * wordsz = (encoded >> 18) & 0xF; + * chunksz = (encoded >> 22) & 0xF; + * lsb0_p = (encoded >> 27) & 1; + * signed_p = (encoded >> 28) & 1; + * trunc_p = (encoded >> 29) & 1; +} + +void +bfd_elf_perform_complex_relocation + (bfd * output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info * info, + bfd * input_bfd, + asection * input_section, + bfd_byte * contents, + Elf_Internal_Rela * rel, + Elf_Internal_Sym * local_syms, + asection ** local_sections) +{ + const struct elf_backend_data * bed; + Elf_Internal_Shdr * symtab_hdr; + asection * sec; + bfd_vma relocation = 0, shift, x; + bfd_vma r_symndx; + bfd_vma mask; + unsigned long start, oplen, len, wordsz, + chunksz, lsb0_p, signed_p, trunc_p; + + /* Perform this reloc, since it is complex. + (this is not to say that it necessarily refers to a complex + symbol; merely that it is a self-describing CGEN based reloc. + i.e. the addend has the complete reloc information (bit start, end, + word size, etc) encoded within it.). */ + r_symndx = ELF32_R_SYM (rel->r_info); + bed = get_elf_backend_data (input_bfd); + if (bed->s->arch_size == 64) + r_symndx >>= 24; + +#ifdef DEBUG + printf ("Performing complex relocation %ld...\n", r_symndx); +#endif + + symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; + if (r_symndx < symtab_hdr->sh_info) + { + /* The symbol is local. */ + Elf_Internal_Sym * sym; + + sym = local_syms + r_symndx; + sec = local_sections [r_symndx]; + relocation = sym->st_value; + if (sym->st_shndx > SHN_UNDEF && + sym->st_shndx < SHN_LORESERVE) + relocation += (sec->output_offset + + sec->output_section->vma); + } + else + { + /* The symbol is global. */ + struct elf_link_hash_entry **sym_hashes; + struct elf_link_hash_entry * h; + + sym_hashes = elf_sym_hashes (input_bfd); + h = sym_hashes [r_symndx]; + + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + sec = h->root.u.def.section; + relocation = h->root.u.def.value; + + if (! bfd_is_abs_section (sec)) + relocation += (sec->output_section->vma + + sec->output_offset); + } + if (h->root.type == bfd_link_hash_undefined + && !((*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, + input_section, rel->r_offset, + info->unresolved_syms_in_objects == RM_GENERATE_ERROR + || ELF_ST_VISIBILITY (h->other)))) + return; + } + + decode_complex_addend (& start, & oplen, & len, & wordsz, + & chunksz, & lsb0_p, & signed_p, + & trunc_p, rel->r_addend); + + mask = (((1L << (len - 1)) - 1) << 1) | 1; + + if (lsb0_p) + shift = (start + 1) - len; + else + shift = (8 * wordsz) - (start + len); + + x = get_value (wordsz, chunksz, input_bfd, contents + rel->r_offset); + +#ifdef DEBUG + printf ("Doing complex reloc: " + "lsb0? %ld, signed? %ld, trunc? %ld, wordsz %ld, " + "chunksz %ld, start %ld, len %ld, oplen %ld\n" + " dest: %8.8lx, mask: %8.8lx, reloc: %8.8lx\n", + lsb0_p, signed_p, trunc_p, wordsz, chunksz, start, len, + oplen, x, mask, relocation); +#endif + + if (! trunc_p) + { + /* Now do an overflow check. */ + if (bfd_check_overflow ((signed_p ? + complain_overflow_signed : + complain_overflow_unsigned), + len, 0, (8 * wordsz), + relocation) == bfd_reloc_overflow) + (*_bfd_error_handler) + ("%s (%s + 0x%lx): relocation overflow: 0x%lx %sdoes not fit " + "within 0x%lx", + input_bfd->filename, input_section->name, rel->r_offset, + relocation, (signed_p ? "(signed) " : ""), mask); + } + + /* Do the deed. */ + x = (x & ~(mask << shift)) | ((relocation & mask) << shift); + +#ifdef DEBUG + printf (" relocation: %8.8lx\n" + " shifted mask: %8.8lx\n" + " shifted/masked reloc: %8.8lx\n" + " result: %8.8lx\n", + relocation, (mask << shift), + ((relocation & mask) << shift), x); +#endif + put_value (wordsz, chunksz, input_bfd, x, contents + rel->r_offset); +} + /* When performing a relocatable link, the input relocations are preserved. But, if they reference global symbols, the indices referenced must be updated. Update all the relocations in @@ -5994,7 +7266,9 @@ elf_link_sort_cmp2 (const void *A, const void *B) static size_t elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec) { - asection *reldyn; + asection *dynamic_relocs; + asection *rela_dyn; + asection *rel_dyn; bfd_size_type count, size; size_t i, ret, sort_elt, ext_size; bfd_byte *sort, *s_non_relative, *p; @@ -6005,39 +7279,170 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec) void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *); struct bfd_link_order *lo; bfd_vma r_sym_mask; + bfd_boolean use_rela; - reldyn = bfd_get_section_by_name (abfd, ".rela.dyn"); - if (reldyn == NULL || reldyn->size == 0) + /* Find a dynamic reloc section. */ + rela_dyn = bfd_get_section_by_name (abfd, ".rela.dyn"); + rel_dyn = bfd_get_section_by_name (abfd, ".rel.dyn"); + if (rela_dyn != NULL && rela_dyn->size > 0 + && rel_dyn != NULL && rel_dyn->size > 0) { - reldyn = bfd_get_section_by_name (abfd, ".rel.dyn"); - if (reldyn == NULL || reldyn->size == 0) - return 0; - ext_size = bed->s->sizeof_rel; - swap_in = bed->s->swap_reloc_in; - swap_out = bed->s->swap_reloc_out; + bfd_boolean use_rela_initialised = FALSE; + + /* This is just here to stop gcc from complaining. + It's initialization checking code is not perfect. */ + use_rela = TRUE; + + /* Both sections are present. Examine the sizes + of the indirect sections to help us choose. */ + for (lo = rela_dyn->map_head.link_order; lo != NULL; lo = lo->next) + if (lo->type == bfd_indirect_link_order) + { + asection *o = lo->u.indirect.section; + + if ((o->size % bed->s->sizeof_rela) == 0) + { + if ((o->size % bed->s->sizeof_rel) == 0) + /* Section size is divisible by both rel and rela sizes. + It is of no help to us. */ + ; + else + { + /* Section size is only divisible by rela. */ + if (use_rela_initialised && (use_rela == FALSE)) + { + _bfd_error_handler + (_("%B: Unable to sort relocs - they are in more than one size"), abfd); + bfd_set_error (bfd_error_invalid_operation); + return 0; + } + else + { + use_rela = TRUE; + use_rela_initialised = TRUE; + } + } + } + else if ((o->size % bed->s->sizeof_rel) == 0) + { + /* Section size is only divisible by rel. */ + if (use_rela_initialised && (use_rela == TRUE)) + { + _bfd_error_handler + (_("%B: Unable to sort relocs - they are in more than one size"), abfd); + bfd_set_error (bfd_error_invalid_operation); + return 0; + } + else + { + use_rela = FALSE; + use_rela_initialised = TRUE; + } + } + else + { + /* The section size is not divisible by either - something is wrong. */ + _bfd_error_handler + (_("%B: Unable to sort relocs - they are of an unknown size"), abfd); + bfd_set_error (bfd_error_invalid_operation); + return 0; + } + } + + for (lo = rel_dyn->map_head.link_order; lo != NULL; lo = lo->next) + if (lo->type == bfd_indirect_link_order) + { + asection *o = lo->u.indirect.section; + + if ((o->size % bed->s->sizeof_rela) == 0) + { + if ((o->size % bed->s->sizeof_rel) == 0) + /* Section size is divisible by both rel and rela sizes. + It is of no help to us. */ + ; + else + { + /* Section size is only divisible by rela. */ + if (use_rela_initialised && (use_rela == FALSE)) + { + _bfd_error_handler + (_("%B: Unable to sort relocs - they are in more than one size"), abfd); + bfd_set_error (bfd_error_invalid_operation); + return 0; + } + else + { + use_rela = TRUE; + use_rela_initialised = TRUE; + } + } + } + else if ((o->size % bed->s->sizeof_rel) == 0) + { + /* Section size is only divisible by rel. */ + if (use_rela_initialised && (use_rela == TRUE)) + { + _bfd_error_handler + (_("%B: Unable to sort relocs - they are in more than one size"), abfd); + bfd_set_error (bfd_error_invalid_operation); + return 0; + } + else + { + use_rela = FALSE; + use_rela_initialised = TRUE; + } + } + else + { + /* The section size is not divisible by either - something is wrong. */ + _bfd_error_handler + (_("%B: Unable to sort relocs - they are of an unknown size"), abfd); + bfd_set_error (bfd_error_invalid_operation); + return 0; + } + } + + if (! use_rela_initialised) + /* Make a guess. */ + use_rela = TRUE; } + else if (rela_dyn != NULL && rela_dyn->size > 0) + use_rela = TRUE; + else if (rel_dyn != NULL && rel_dyn->size > 0) + use_rela = FALSE; else + return 0; + + if (use_rela) { + dynamic_relocs = rela_dyn; ext_size = bed->s->sizeof_rela; swap_in = bed->s->swap_reloca_in; swap_out = bed->s->swap_reloca_out; } - count = reldyn->size / ext_size; + else + { + dynamic_relocs = rel_dyn; + ext_size = bed->s->sizeof_rel; + swap_in = bed->s->swap_reloc_in; + swap_out = bed->s->swap_reloc_out; + } size = 0; - for (lo = reldyn->map_head.link_order; lo != NULL; lo = lo->next) + for (lo = dynamic_relocs->map_head.link_order; lo != NULL; lo = lo->next) if (lo->type == bfd_indirect_link_order) - { - asection *o = lo->u.indirect.section; - size += o->size; - } + size += lo->u.indirect.section->size; - if (size != reldyn->size) + if (size != dynamic_relocs->size) return 0; sort_elt = (sizeof (struct elf_link_sort_rela) + (i2e - 1) * sizeof (Elf_Internal_Rela)); + + count = dynamic_relocs->size / ext_size; sort = bfd_zmalloc (sort_elt * count); + if (sort == NULL) { (*info->callbacks->warning) @@ -6050,7 +7455,7 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec) else r_sym_mask = ~(bfd_vma) 0xffffffff; - for (lo = reldyn->map_head.link_order; lo != NULL; lo = lo->next) + for (lo = dynamic_relocs->map_head.link_order; lo != NULL; lo = lo->next) if (lo->type == bfd_indirect_link_order) { bfd_byte *erel, *erelend; @@ -6067,9 +7472,11 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec) erel = o->contents; erelend = o->contents + o->size; p = sort + o->output_offset / ext_size * sort_elt; + while (erel < erelend) { struct elf_link_sort_rela *s = (struct elf_link_sort_rela *) p; + (*swap_in) (abfd, erel, s->rela); s->type = (*bed->elf_backend_reloc_type_class) (s->rela); s->u.sym_mask = r_sym_mask; @@ -6100,7 +7507,7 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec) qsort (s_non_relative, count - ret, sort_elt, elf_link_sort_cmp2); - for (lo = reldyn->map_head.link_order; lo != NULL; lo = lo->next) + for (lo = dynamic_relocs->map_head.link_order; lo != NULL; lo = lo->next) if (lo->type == bfd_indirect_link_order) { bfd_byte *erel, *erelend; @@ -6119,7 +7526,7 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec) } free (sort); - *psec = reldyn; + *psec = dynamic_relocs; return ret; } @@ -6657,11 +8064,6 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data) if (h->dynindx != -1 && elf_hash_table (finfo->info)->dynamic_sections_created) { - size_t bucketcount; - size_t bucket; - size_t hash_entry_size; - bfd_byte *bucketpos; - bfd_vma chain; bfd_byte *esym; sym.st_name = h->dynstr_index; @@ -6673,17 +8075,27 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data) } bed->s->swap_symbol_out (finfo->output_bfd, &sym, esym, 0); - bucketcount = elf_hash_table (finfo->info)->bucketcount; - bucket = h->u.elf_hash_value % bucketcount; - hash_entry_size - = elf_section_data (finfo->hash_sec)->this_hdr.sh_entsize; - bucketpos = ((bfd_byte *) finfo->hash_sec->contents - + (bucket + 2) * hash_entry_size); - chain = bfd_get (8 * hash_entry_size, finfo->output_bfd, bucketpos); - bfd_put (8 * hash_entry_size, finfo->output_bfd, h->dynindx, bucketpos); - bfd_put (8 * hash_entry_size, finfo->output_bfd, chain, - ((bfd_byte *) finfo->hash_sec->contents - + (bucketcount + 2 + h->dynindx) * hash_entry_size)); + if (finfo->hash_sec != NULL) + { + size_t hash_entry_size; + bfd_byte *bucketpos; + bfd_vma chain; + size_t bucketcount; + size_t bucket; + + bucketcount = elf_hash_table (finfo->info)->bucketcount; + bucket = h->u.elf_hash_value % bucketcount; + + hash_entry_size + = elf_section_data (finfo->hash_sec)->this_hdr.sh_entsize; + bucketpos = ((bfd_byte *) finfo->hash_sec->contents + + (bucket + 2) * hash_entry_size); + chain = bfd_get (8 * hash_entry_size, finfo->output_bfd, bucketpos); + bfd_put (8 * hash_entry_size, finfo->output_bfd, h->dynindx, bucketpos); + bfd_put (8 * hash_entry_size, finfo->output_bfd, chain, + ((bfd_byte *) finfo->hash_sec->contents + + (bucketcount + 2 + h->dynindx) * hash_entry_size)); + } if (finfo->symver_sec != NULL && finfo->symver_sec->contents != NULL) { @@ -6784,14 +8196,15 @@ _bfd_elf_default_action_discarded (asection *sec) /* Find a match between a section and a member of a section group. */ static asection * -match_group_member (asection *sec, asection *group) +match_group_member (asection *sec, asection *group, + struct bfd_link_info *info) { asection *first = elf_next_in_group (group); asection *s = first; while (s != NULL) { - if (bfd_elf_match_symbols_in_sections (s, sec)) + if (bfd_elf_match_symbols_in_sections (s, sec, info)) return s; s = elf_next_in_group (s); @@ -6803,21 +8216,22 @@ match_group_member (asection *sec, asection *group) } /* Check if the kept section of a discarded section SEC can be used - to replace it. Return the replacement if it is OK. Otherwise return - NULL. */ + to replace it. Return the replacement if it is OK. Otherwise return + NULL. */ asection * -_bfd_elf_check_kept_section (asection *sec) +_bfd_elf_check_kept_section (asection *sec, struct bfd_link_info *info) { asection *kept; kept = sec->kept_section; if (kept != NULL) { - if (elf_sec_group (sec) != NULL) - kept = match_group_member (sec, kept); + if ((kept->flags & SEC_GROUP) != 0) + kept = match_group_member (sec, kept, info); if (kept != NULL && sec->size != kept->size) kept = NULL; + sec->kept_section = kept; } return kept; } @@ -6830,7 +8244,7 @@ _bfd_elf_check_kept_section (asection *sec) static bfd_boolean elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) { - bfd_boolean (*relocate_section) + int (*relocate_section) (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **); bfd *output_bfd; @@ -6844,7 +8258,6 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) asection **ppsection; asection *o; const struct elf_backend_data *bed; - bfd_boolean emit_relocs; struct elf_link_hash_entry **sym_hashes; output_bfd = finfo->output_bfd; @@ -6857,9 +8270,6 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) if ((input_bfd->flags & DYNAMIC) != 0) return TRUE; - emit_relocs = (finfo->info->relocatable - || finfo->info->emitrelocations); - symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; if (elf_bad_symtab (input_bfd)) { @@ -6883,6 +8293,15 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) if (isymbuf == NULL) return FALSE; } + /* evaluate_complex_relocation_symbols looks for symbols in + finfo->internal_syms. */ + else if (isymbuf != NULL && locsymcount != 0) + { + bfd_elf_get_elf_syms (input_bfd, symtab_hdr, locsymcount, 0, + finfo->internal_syms, + finfo->external_syms, + finfo->locsym_shndx); + } /* Find local symbol sections and adjust values of symbols in SEC_MERGE sections. Write out those local symbols we know are @@ -7020,6 +8439,9 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) return FALSE; } + if (! evaluate_complex_relocation_symbols (input_bfd, finfo, locsymcount)) + return FALSE; + /* Relocate the contents of each section. */ sym_hashes = elf_sym_hashes (input_bfd); for (o = input_bfd->sections; o != NULL; o = o->next) @@ -7063,6 +8485,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) Elf_Internal_Rela *internal_relocs; bfd_vma r_type_mask; int r_sym_shift; + int ret; /* Get the swapped relocs. */ internal_relocs @@ -7168,23 +8591,14 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) { asection *kept; - kept = _bfd_elf_check_kept_section (sec); + kept = _bfd_elf_check_kept_section (sec, + finfo->info); if (kept != NULL) { *ps = kept; continue; } } - - /* Remove the symbol reference from the reloc, but - don't kill the reloc completely. This is so that - a zero value will be written into the section, - which may have non-zero contents put there by the - assembler. Zero in things like an eh_frame fde - pc_begin allows stack unwinders to recognize the - fde as bogus. */ - rel->r_info &= r_type_mask; - rel->r_addend = 0; } } } @@ -7209,14 +8623,17 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) corresponding to the output section, which will require the addend to be adjusted. */ - if (! (*relocate_section) (output_bfd, finfo->info, + ret = (*relocate_section) (output_bfd, finfo->info, input_bfd, o, contents, internal_relocs, isymbuf, - finfo->sections)) + finfo->sections); + if (!ret) return FALSE; - if (emit_relocs) + if (ret == 2 + || finfo->info->relocatable + || finfo->info->emitrelocations) { Elf_Internal_Rela *irela; Elf_Internal_Rela *irelaend; @@ -7263,7 +8680,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) /* This is a reloc for a deleted entry or somesuch. Turn it into an R_*_NONE reloc, at the same offset as the last reloc. elf_eh_frame.c and - elf_bfd_discard_info rely on reloc offsets + bfd_elf_discard_info rely on reloc offsets being ordered. */ irela->r_offset = last_offset; irela->r_info = 0; @@ -7338,8 +8755,10 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) /* If we have discarded a section, the output section will be the absolute section. In - case of discarded link-once and discarded - SEC_MERGE sections, use the kept section. */ + case of discarded SEC_MERGE sections, use + the kept section. relocate_section should + have already handled discarded linkonce + sections. */ if (bfd_is_abs_section (osec) && sec->kept_section != NULL && sec->kept_section->output_section != NULL) @@ -7351,6 +8770,24 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) if (!bfd_is_abs_section (osec)) { r_symndx = osec->target_index; + if (r_symndx == 0) + { + struct elf_link_hash_table *htab; + asection *oi; + + htab = elf_hash_table (finfo->info); + oi = htab->text_index_section; + if ((osec->flags & SEC_READONLY) == 0 + && htab->data_index_section != NULL) + oi = htab->data_index_section; + + if (oi != NULL) + { + irela->r_addend += osec->vma - oi->vma; + r_symndx = oi->target_index; + } + } + BFD_ASSERT (r_symndx != 0); } } @@ -7446,7 +8883,8 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) /* Write out the modified section contents. */ if (bed->elf_backend_write_section - && (*bed->elf_backend_write_section) (output_bfd, o, contents)) + && (*bed->elf_backend_write_section) (output_bfd, finfo->info, o, + contents)) { /* Section written out. */ } @@ -7828,6 +9266,9 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) size_t relativecount = 0; asection *reldyn = 0; bfd_size_type amt; + asection *attr_section = NULL; + bfd_vma attr_size = 0; + const char *std_attrs_section; if (! is_elf_hash_table (info->hash)) return FALSE; @@ -7857,7 +9298,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) { finfo.dynsym_sec = bfd_get_section_by_name (dynobj, ".dynsym"); finfo.hash_sec = bfd_get_section_by_name (dynobj, ".hash"); - BFD_ASSERT (finfo.dynsym_sec != NULL && finfo.hash_sec != NULL); + BFD_ASSERT (finfo.dynsym_sec != NULL); finfo.symver_sec = bfd_get_section_by_name (dynobj, ".gnu.version"); /* Note that it is OK if symver_sec is NULL. */ } @@ -7875,6 +9316,40 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) finfo.symbuf_count = 0; finfo.shndxbuf_size = 0; + /* The object attributes have been merged. Remove the input + sections from the link, and set the contents of the output + secton. */ + std_attrs_section = get_elf_backend_data (abfd)->obj_attrs_section; + for (o = abfd->sections; o != NULL; o = o->next) + { + if ((std_attrs_section && strcmp (o->name, std_attrs_section) == 0) + || strcmp (o->name, ".gnu.attributes") == 0) + { + for (p = o->map_head.link_order; p != NULL; p = p->next) + { + asection *input_section; + + if (p->type != bfd_indirect_link_order) + continue; + input_section = p->u.indirect.section; + /* Hack: reset the SEC_HAS_CONTENTS flag so that + elf_link_input_bfd ignores this section. */ + input_section->flags &= ~SEC_HAS_CONTENTS; + } + + attr_size = bfd_elf_obj_attr_size (abfd); + if (attr_size) + { + bfd_set_section_size (abfd, o, attr_size); + attr_section = o; + /* Skip this section later on. */ + o->map_head.link_order = NULL; + } + else + o->flags |= SEC_EXCLUDE; + } + } + /* Count up the number of relocations we will output for each output section, so that we know the sizes of the reloc sections. We also figure out some maximum sizes. */ @@ -7920,13 +9395,18 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) { Elf_Internal_Rela * relocs; - relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL, + relocs = _bfd_elf_link_read_relocs (sec->owner, sec, + NULL, NULL, info->keep_memory); - reloc_count = (*bed->elf_backend_count_relocs) (sec, relocs); + if (relocs != NULL) + { + reloc_count + = (*bed->elf_backend_count_relocs) (sec, relocs); - if (elf_section_data (o)->relocs != relocs) - free (relocs); + if (elf_section_data (sec)->relocs != relocs) + free (relocs); + } } if (sec->rawsize > max_contents_size) @@ -8141,18 +9621,19 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) elfsym.st_size = 0; elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION); elfsym.st_other = 0; + elfsym.st_value = 0; for (i = 1; i < elf_numsections (abfd); i++) { o = bfd_section_from_elf_index (abfd, i); if (o != NULL) - o->target_index = bfd_get_symcount (abfd); - elfsym.st_shndx = i; - if (info->relocatable || o == NULL) - elfsym.st_value = 0; - else - elfsym.st_value = o->vma; - if (! elf_link_output_sym (&finfo, NULL, &elfsym, o, NULL)) - goto error_return; + { + o->target_index = bfd_get_symcount (abfd); + elfsym.st_shndx = i; + if (!info->relocatable) + elfsym.st_value = o->vma; + if (!elf_link_output_sym (&finfo, NULL, &elfsym, o, NULL)) + goto error_return; + } if (i == SHN_LORESERVE - 1) i += SHN_HIRESERVE + 1 - SHN_LORESERVE; } @@ -8298,6 +9779,18 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) } } + /* Free symbol buffer if needed. */ + if (!info->reduce_memory_overheads) + { + for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) + if (bfd_get_flavour (sub) == bfd_target_elf_flavour + && elf_tdata (sub)->symbuf) + { + free (elf_tdata (sub)->symbuf); + elf_tdata (sub)->symbuf = NULL; + } + } + /* Output any global symbols that got converted to local in a version script or due to symbol visibility. We do this in a separate step since ELF requires all local symbols to appear @@ -8312,6 +9805,19 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) if (eoinfo.failed) return FALSE; + /* If backend needs to output some local symbols not present in the hash + table, do it now. */ + if (bed->elf_backend_output_arch_local_syms) + { + typedef bfd_boolean (*out_sym_func) + (void *, const char *, Elf_Internal_Sym *, asection *, + struct elf_link_hash_entry *); + + if (! ((*bed->elf_backend_output_arch_local_syms) + (abfd, info, &finfo, (out_sym_func) elf_link_output_sym))) + return FALSE; + } + /* That wrote out all the local symbols. Finish up the symbol table with the global symbols. Even if we want to strip everything we can, we still need to deal with those global symbols that got @@ -8603,6 +10109,9 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) case DT_HASH: name = ".hash"; goto get_vma; + case DT_GNU_HASH: + name = ".gnu.hash"; + goto get_vma; case DT_STRTAB: name = ".dynstr"; goto get_vma; @@ -8686,8 +10195,8 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) if (dyn.d_tag == DT_TEXTREL) { - _bfd_error_handler - (_("warning: creating a DT_TEXTREL in a shared object.")); + info->callbacks->einfo + (_("%P: warning: creating a DT_TEXTREL in a shared object.\n")); break; } } @@ -8785,6 +10294,16 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) elf_tdata (abfd)->linker = TRUE; + if (attr_section) + { + bfd_byte *contents = bfd_malloc (attr_size); + if (contents == NULL) + goto error_return; + bfd_elf_set_obj_attr_contents (abfd, contents, attr_size); + bfd_set_section_contents (abfd, attr_section, contents, 0, attr_size); + free (contents); + } + return TRUE; error_return: @@ -8822,18 +10341,44 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) /* Garbage collect unused sections. */ +/* Default gc_mark_hook. */ + +asection * +_bfd_elf_gc_mark_hook (asection *sec, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + Elf_Internal_Rela *rel ATTRIBUTE_UNUSED, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) +{ + if (h != NULL) + { + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + + default: + break; + } + } + else + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + return NULL; +} + /* The mark phase of garbage collection. For a given section, mark it and any sections in this section's group, and all the sections which define symbols to which it refers. */ -typedef asection * (*gc_mark_hook_fn) - (asection *, struct bfd_link_info *, Elf_Internal_Rela *, - struct elf_link_hash_entry *, Elf_Internal_Sym *); - bfd_boolean _bfd_elf_gc_mark (struct bfd_link_info *info, asection *sec, - gc_mark_hook_fn gc_mark_hook) + elf_gc_mark_hook_fn gc_mark_hook) { bfd_boolean ret; bfd_boolean is_eh; @@ -8954,7 +10499,8 @@ _bfd_elf_gc_mark (struct bfd_link_info *info, /* Sweep symbols in swept sections. Called via elf_link_hash_traverse. */ -struct elf_gc_sweep_symbol_info { +struct elf_gc_sweep_symbol_info +{ struct bfd_link_info *info; void (*hide_symbol) (struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean); @@ -9017,6 +10563,9 @@ elf_gc_sweep (bfd *abfd, struct bfd_link_info *info) to remove a section from the output. */ o->flags |= SEC_EXCLUDE; + if (info->print_gc_sections && o->size != 0) + _bfd_error_handler (_("Removing unused section '%s' in file '%B'"), sub, o->name); + /* But we also have to update some of the relocation info we collected before. */ if (gc_sweep_hook @@ -9198,9 +10747,7 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info) { bfd_boolean ok = TRUE; bfd *sub; - asection * (*gc_mark_hook) - (asection *, struct bfd_link_info *, Elf_Internal_Rela *, - struct elf_link_hash_entry *h, Elf_Internal_Sym *); + elf_gc_mark_hook_fn gc_mark_hook; const struct elf_backend_data *bed = get_elf_backend_data (abfd); if (!bed->can_gc_sections @@ -9242,11 +10789,15 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info) continue; for (o = sub->sections; o != NULL; o = o->next) - if ((o->flags & SEC_KEEP) != 0 && !o->gc_mark) + if ((o->flags & (SEC_EXCLUDE | SEC_KEEP)) == SEC_KEEP && !o->gc_mark) if (!_bfd_elf_gc_mark (info, o, gc_mark_hook)) return FALSE; } + /* Allow the backend to mark additional target specific sections. */ + if (bed->gc_mark_extra_sections) + bed->gc_mark_extra_sections(info, gc_mark_hook); + /* ... again for sections marked from eh_frame. */ for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) { @@ -9262,30 +10813,38 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info) easily due to needing special relocs to handle the difference of two symbols in separate sections. Don't keep code sections referenced by .eh_frame. */ +#define TEXT_PREFIX ".text." +#define TEXT_PREFIX2 ".gnu.linkonce.t." +#define GCC_EXCEPT_TABLE_PREFIX ".gcc_except_table." for (o = sub->sections; o != NULL; o = o->next) if (!o->gc_mark && o->gc_mark_from_eh && (o->flags & SEC_CODE) == 0) { - if (strncmp (o->name, ".gcc_except_table.", 18) == 0) + if (CONST_STRNEQ (o->name, GCC_EXCEPT_TABLE_PREFIX)) { - unsigned long len; char *fn_name; + const char *sec_name; asection *fn_text; - - len = strlen (o->name + 18) + 1; - fn_name = bfd_malloc (len + 16); + unsigned o_name_prefix_len , fn_name_prefix_len, tmp; + + o_name_prefix_len = strlen (GCC_EXCEPT_TABLE_PREFIX); + sec_name = o->name + o_name_prefix_len; + fn_name_prefix_len = strlen (TEXT_PREFIX); + tmp = strlen (TEXT_PREFIX2); + if (tmp > fn_name_prefix_len) + fn_name_prefix_len = tmp; + fn_name + = bfd_malloc (fn_name_prefix_len + strlen (sec_name) + 1); if (fn_name == NULL) return FALSE; /* Try the first prefix. */ - memcpy (fn_name, ".text.", 6); - memcpy (fn_name + 6, o->name + 18, len); + sprintf (fn_name, "%s%s", TEXT_PREFIX, sec_name); fn_text = bfd_get_section_by_name (sub, fn_name); /* Try the second prefix. */ if (fn_text == NULL) { - memcpy (fn_name, ".gnu.linkonce.t.", 16); - memcpy (fn_name + 16, o->name + 18, len); + sprintf (fn_name, "%s%s", TEXT_PREFIX2, sec_name); fn_text = bfd_get_section_by_name (sub, fn_name); } @@ -9637,12 +11196,15 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info) if ((abfd->flags & DYNAMIC) != 0) continue; - eh = bfd_get_section_by_name (abfd, ".eh_frame"); - if (info->relocatable - || (eh != NULL + eh = NULL; + if (!info->relocatable) + { + eh = bfd_get_section_by_name (abfd, ".eh_frame"); + if (eh != NULL && (eh->size == 0 - || bfd_is_abs_section (eh->output_section)))) - eh = NULL; + || bfd_is_abs_section (eh->output_section))) + eh = NULL; + } stab = bfd_get_section_by_name (abfd, ".stab"); if (stab != NULL @@ -9683,7 +11245,10 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info) cookie.locsymcount, 0, NULL, NULL, NULL); if (cookie.locsyms == NULL) - return FALSE; + { + info->callbacks->einfo (_("%P%X: can not read symbols: %E\n")); + return FALSE; + } } if (stab != NULL) @@ -9753,39 +11318,28 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info) } void -_bfd_elf_section_already_linked (bfd *abfd, struct bfd_section * sec) +_bfd_elf_section_already_linked (bfd *abfd, struct bfd_section *sec, + struct bfd_link_info *info) { flagword flags; const char *name, *p; struct bfd_section_already_linked *l; struct bfd_section_already_linked_hash_entry *already_linked_list; - asection *group; - /* A single member comdat group section may be discarded by a - linkonce section. See below. */ if (sec->output_section == bfd_abs_section_ptr) return; flags = sec->flags; - /* Check if it belongs to a section group. */ - group = elf_sec_group (sec); - - /* Return if it isn't a linkonce section nor a member of a group. A - comdat group section also has SEC_LINK_ONCE set. */ - if ((flags & SEC_LINK_ONCE) == 0 && group == NULL) + /* Return if it isn't a linkonce section. A comdat group section + also has SEC_LINK_ONCE set. */ + if ((flags & SEC_LINK_ONCE) == 0) return; - if (group) - { - /* If this is the member of a single member comdat group, check if - the group should be discarded. */ - if (elf_next_in_group (sec) == sec - && (group->flags & SEC_LINK_ONCE) != 0) - sec = group; - else - return; - } + /* Don't put group member sections on our list of already linked + sections. They are handled as a group via their group section. */ + if (elf_sec_group (sec) != NULL) + return; /* FIXME: When doing a relocatable link, we may have trouble copying relocations in other sections that refer to local symbols @@ -9806,7 +11360,7 @@ _bfd_elf_section_already_linked (bfd *abfd, struct bfd_section * sec) name = bfd_get_section_name (abfd, sec); - if (strncmp (name, ".gnu.linkonce.", sizeof (".gnu.linkonce.") - 1) == 0 + if (CONST_STRNEQ (name, ".gnu.linkonce.") && (p = strchr (name + sizeof (".gnu.linkonce.") - 1, '.')) != NULL) p++; else @@ -9816,11 +11370,8 @@ _bfd_elf_section_already_linked (bfd *abfd, struct bfd_section * sec) for (l = already_linked_list->entry; l != NULL; l = l->next) { - /* We may have 3 different sections on the list: group section, - comdat section and linkonce section. SEC may be a linkonce or - group section. We match a group section with a group section, - a linkonce section with a linkonce section, and ignore comdat - section. */ + /* We may have 2 different types of sections on the list: group + sections and linkonce sections. Match like sections. */ if ((flags & SEC_GROUP) == (l->sec->flags & SEC_GROUP) && strcmp (name, l->sec->name) == 0 && bfd_coff_get_comdat_section (l->sec->owner, l->sec) == NULL) @@ -9908,31 +11459,28 @@ _bfd_elf_section_already_linked (bfd *abfd, struct bfd_section * sec) } } - if (group) + /* A single member comdat group section may be discarded by a + linkonce section and vice versa. */ + + if ((flags & SEC_GROUP) != 0) { - /* If this is the member of a single member comdat group and the - group hasn't be discarded, we check if it matches a linkonce - section. We only record the discarded comdat group. Otherwise - the undiscarded group will be discarded incorrectly later since - itself has been recorded. */ - for (l = already_linked_list->entry; l != NULL; l = l->next) - if ((l->sec->flags & SEC_GROUP) == 0 - && bfd_coff_get_comdat_section (l->sec->owner, l->sec) == NULL - && bfd_elf_match_symbols_in_sections (l->sec, - elf_next_in_group (sec))) - { - elf_next_in_group (sec)->output_section = bfd_abs_section_ptr; - elf_next_in_group (sec)->kept_section = l->sec; - group->output_section = bfd_abs_section_ptr; - break; - } - if (l == NULL) - return; + asection *first = elf_next_in_group (sec); + + if (first != NULL && elf_next_in_group (first) == first) + /* Check this single member group against linkonce sections. */ + for (l = already_linked_list->entry; l != NULL; l = l->next) + if ((l->sec->flags & SEC_GROUP) == 0 + && bfd_coff_get_comdat_section (l->sec->owner, l->sec) == NULL + && bfd_elf_match_symbols_in_sections (l->sec, first, info)) + { + first->output_section = bfd_abs_section_ptr; + first->kept_section = l->sec; + sec->output_section = bfd_abs_section_ptr; + break; + } } else - /* There is no direct match. But for linkonce section, we should - check if there is a match with comdat group member. We always - record the linkonce section, discarded or not. */ + /* Check this linkonce section against single member groups. */ for (l = already_linked_list->entry; l != NULL; l = l->next) if (l->sec->flags & SEC_GROUP) { @@ -9940,10 +11488,10 @@ _bfd_elf_section_already_linked (bfd *abfd, struct bfd_section * sec) if (first != NULL && elf_next_in_group (first) == first - && bfd_elf_match_symbols_in_sections (first, sec)) + && bfd_elf_match_symbols_in_sections (first, sec, info)) { sec->output_section = bfd_abs_section_ptr; - sec->kept_section = l->sec; + sec->kept_section = first; break; } } diff --git a/contrib/binutils/bfd/elfn32-mips.c b/contrib/binutils/bfd/elfn32-mips.c index b1211f0c65e5..e0994a0dd068 100644 --- a/contrib/binutils/bfd/elfn32-mips.c +++ b/contrib/binutils/bfd/elfn32-mips.c @@ -1,6 +1,6 @@ /* MIPS-specific support for 32-bit ELF Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005 Free Software Foundation, Inc. + 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Most of the information added by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>. @@ -29,8 +29,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. different MIPS ELF from other targets. This matters when linking. This file supports both, switching at runtime. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "bfdlink.h" #include "genlink.h" @@ -61,8 +61,6 @@ static bfd_reloc_status_type gprel32_with_gp (bfd *, asymbol *, arelent *, asection *, bfd_boolean, void *, bfd_vma); static bfd_reloc_status_type mips_elf_shift6_reloc (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); -static bfd_reloc_status_type mips16_jump_reloc - (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips16_gprel_reloc (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup @@ -756,6 +754,21 @@ static reloc_howto_type elf_mips_howto_table_rel[] = 0x0000ffff, /* src_mask */ 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ + + /* 32 bit relocation with no addend. */ + HOWTO (R_MIPS_GLOB_DAT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_mips_elf_generic_reloc, /* special_function */ + "R_MIPS_GLOB_DAT", /* name */ + FALSE, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ }; /* The relocation table used for SHT_RELA sections. */ @@ -1429,6 +1442,21 @@ static reloc_howto_type elf_mips_howto_table_rela[] = 0x0000ffff, /* src_mask */ 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ + + /* 32 bit relocation with no addend. */ + HOWTO (R_MIPS_GLOB_DAT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_mips_elf_generic_reloc, /* special_function */ + "R_MIPS_GLOB_DAT", /* name */ + FALSE, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ }; static reloc_howto_type elf_mips16_howto_table_rel[] = @@ -1444,7 +1472,7 @@ static reloc_howto_type elf_mips16_howto_table_rel[] = /* This needs complex overflow detection, because the upper four bits must match the PC. */ - mips16_jump_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS16_26", /* name */ TRUE, /* partial_inplace */ 0x3ffffff, /* src_mask */ @@ -1516,7 +1544,7 @@ static reloc_howto_type elf_mips16_howto_table_rela[] = /* This needs complex overflow detection, because the upper four bits must match the PC. */ - mips16_jump_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS16_26", /* name */ FALSE, /* partial_inplace */ 0x3ffffff, /* src_mask */ @@ -1901,28 +1929,6 @@ mips_elf_shift6_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, error_message); } -/* Handle a mips16 jump. */ - -static bfd_reloc_status_type -mips16_jump_reloc (bfd *abfd ATTRIBUTE_UNUSED, - arelent *reloc_entry ATTRIBUTE_UNUSED, - asymbol *symbol ATTRIBUTE_UNUSED, - void *data ATTRIBUTE_UNUSED, - asection *input_section, bfd *output_bfd ATTRIBUTE_UNUSED, - char **error_message ATTRIBUTE_UNUSED) -{ - static bfd_boolean warned = FALSE; - - /* FIXME. */ - if (! warned) - (*_bfd_error_handler) - (_("Linking mips16 objects into %s format is not supported"), - bfd_get_target (input_section->output_section->owner)); - warned = TRUE; - - return bfd_reloc_undefined; -} - /* Handle a mips16 GP relative reloc. */ static bfd_reloc_status_type @@ -2075,6 +2081,40 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, } } +static reloc_howto_type * +bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (elf_mips_howto_table_rela) + / sizeof (elf_mips_howto_table_rela[0])); + i++) + if (elf_mips_howto_table_rela[i].name != NULL + && strcasecmp (elf_mips_howto_table_rela[i].name, r_name) == 0) + return &elf_mips_howto_table_rela[i]; + + for (i = 0; + i < (sizeof (elf_mips16_howto_table_rela) + / sizeof (elf_mips16_howto_table_rela[0])); + i++) + if (elf_mips16_howto_table_rela[i].name != NULL + && strcasecmp (elf_mips16_howto_table_rela[i].name, r_name) == 0) + return &elf_mips16_howto_table_rela[i]; + + if (strcasecmp (elf_mips_gnu_vtinherit_howto.name, r_name) == 0) + return &elf_mips_gnu_vtinherit_howto; + if (strcasecmp (elf_mips_gnu_vtentry_howto.name, r_name) == 0) + return &elf_mips_gnu_vtentry_howto; + if (strcasecmp (elf_mips_gnu_rel16_s2.name, r_name) == 0) + return &elf_mips_gnu_rel16_s2; + if (strcasecmp (elf_mips_gnu_rela16_s2.name, r_name) == 0) + return &elf_mips_gnu_rela16_s2; + + return NULL; +} + /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */ static reloc_howto_type * @@ -2317,12 +2357,15 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { #define elf_backend_create_dynamic_sections \ _bfd_mips_elf_create_dynamic_sections #define elf_backend_check_relocs _bfd_mips_elf_check_relocs +#define elf_backend_merge_symbol_attribute \ + _bfd_mips_elf_merge_symbol_attribute #define elf_backend_adjust_dynamic_symbol \ _bfd_mips_elf_adjust_dynamic_symbol #define elf_backend_always_size_sections \ _bfd_mips_elf_always_size_sections #define elf_backend_size_dynamic_sections \ _bfd_mips_elf_size_dynamic_sections +#define elf_backend_init_index_section _bfd_elf_init_1_index_section #define elf_backend_relocate_section _bfd_mips_elf_relocate_section #define elf_backend_finish_dynamic_symbol \ _bfd_mips_elf_finish_dynamic_symbol @@ -2380,10 +2423,8 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { #define TARGET_BIG_SYM bfd_elf32_nbigmips_vec #define TARGET_BIG_NAME "elf32-nbigmips" -/* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses - a value of 0x1000, and we are compatible. - FIXME: How does this affect NewABI? */ -#define ELF_MAXPAGESIZE 0x1000 +#define ELF_MAXPAGESIZE 0x10000 +#define ELF_COMMONPAGESIZE 0x1000 #include "elf32-target.h" @@ -2394,15 +2435,15 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { #undef TARGET_BIG_NAME #undef ELF_MAXPAGESIZE +#undef ELF_COMMONPAGESIZE #define TARGET_LITTLE_SYM bfd_elf32_ntradlittlemips_vec #define TARGET_LITTLE_NAME "elf32-ntradlittlemips" #define TARGET_BIG_SYM bfd_elf32_ntradbigmips_vec #define TARGET_BIG_NAME "elf32-ntradbigmips" -/* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses - page sizes of up to that limit, so we need to respect it. */ #define ELF_MAXPAGESIZE 0x10000 +#define ELF_COMMONPAGESIZE 0x1000 #define elf32_bed elf32_tradbed /* Include the target file again for this target. */ diff --git a/contrib/binutils/bfd/elfxx-ia64.c b/contrib/binutils/bfd/elfxx-ia64.c index 6b3257afdf13..68f2010c6192 100644 --- a/contrib/binutils/bfd/elfxx-ia64.c +++ b/contrib/binutils/bfd/elfxx-ia64.c @@ -1,5 +1,5 @@ /* IA-64 support for 64-bit ELF - Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Contributed by David Mosberger-Tang <davidm@hpl.hp.com> @@ -19,8 +19,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "elf-bfd.h" #include "opcode/ia64.h" @@ -215,10 +215,6 @@ static bfd_boolean elfNN_ia64_add_symbol_hook PARAMS ((bfd *abfd, struct bfd_link_info *info, Elf_Internal_Sym *sym, const char **namep, flagword *flagsp, asection **secp, bfd_vma *valp)); -static int elfNN_ia64_additional_program_headers - PARAMS ((bfd *abfd)); -static bfd_boolean elfNN_ia64_modify_segment_map - PARAMS ((bfd *, struct bfd_link_info *)); static bfd_boolean elfNN_ia64_is_local_label_name PARAMS ((bfd *abfd, const char *name)); static bfd_boolean elfNN_ia64_dynamic_symbol_p @@ -617,6 +613,22 @@ elfNN_ia64_reloc_type_lookup (abfd, bfd_code) return lookup_howto (rtype); } +static reloc_howto_type * +elfNN_ia64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (ia64_howto_table) / sizeof (ia64_howto_table[0]); + i++) + if (ia64_howto_table[i].name != NULL + && strcasecmp (ia64_howto_table[i].name, r_name) == 0) + return &ia64_howto_table[i]; + + return NULL; +} + /* Given a ELF reloc, return the matching HOWTO structure. */ static void @@ -1428,22 +1440,15 @@ elfNN_ia64_relax_ldxmov (contents, off) /* Return TRUE if NAME is an unwind table section name. */ static inline bfd_boolean -is_unwind_section_name (abfd, name) - bfd *abfd; - const char *name; +is_unwind_section_name (bfd *abfd, const char *name) { - size_t len1, len2, len3; - if (elfNN_ia64_hpux_vec (abfd->xvec) && !strcmp (name, ELF_STRING_ia64_unwind_hdr)) return FALSE; - len1 = sizeof (ELF_STRING_ia64_unwind) - 1; - len2 = sizeof (ELF_STRING_ia64_unwind_info) - 1; - len3 = sizeof (ELF_STRING_ia64_unwind_once) - 1; - return ((strncmp (name, ELF_STRING_ia64_unwind, len1) == 0 - && strncmp (name, ELF_STRING_ia64_unwind_info, len2) != 0) - || strncmp (name, ELF_STRING_ia64_unwind_once, len3) == 0); + return ((CONST_STRNEQ (name, ELF_STRING_ia64_unwind) + && ! CONST_STRNEQ (name, ELF_STRING_ia64_unwind_info)) + || CONST_STRNEQ (name, ELF_STRING_ia64_unwind_once)); } /* Handle an IA-64 specific section when reading an object file. This @@ -1637,8 +1642,8 @@ elfNN_ia64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) /* Return the number of additional phdrs we will need. */ static int -elfNN_ia64_additional_program_headers (abfd) - bfd *abfd; +elfNN_ia64_additional_program_headers (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { asection *s; int ret = 0; @@ -1657,9 +1662,8 @@ elfNN_ia64_additional_program_headers (abfd) } static bfd_boolean -elfNN_ia64_modify_segment_map (abfd, info) - bfd *abfd; - struct bfd_link_info *info ATTRIBUTE_UNUSED; +elfNN_ia64_modify_segment_map (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { struct elf_segment_map *m, **pm; Elf_Internal_Shdr *hdr; @@ -1742,17 +1746,30 @@ elfNN_ia64_modify_segment_map (abfd, info) } } - /* Turn on PF_IA_64_NORECOV if needed. This involves traversing all of - the input sections for each output section in the segment and testing - for SHF_IA_64_NORECOV on each. */ - for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next) + return TRUE; +} + +/* Turn on PF_IA_64_NORECOV if needed. This involves traversing all of + the input sections for each output section in the segment and testing + for SHF_IA_64_NORECOV on each. */ + +static bfd_boolean +elfNN_ia64_modify_program_headers (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) +{ + struct elf_obj_tdata *tdata = elf_tdata (abfd); + struct elf_segment_map *m; + Elf_Internal_Phdr *p; + + for (p = tdata->phdr, m = tdata->segment_map; m != NULL; m = m->next, p++) if (m->p_type == PT_LOAD) { int i; for (i = m->count - 1; i >= 0; --i) { struct bfd_link_order *order = m->sections[i]->map_head.link_order; - while (order) + + while (order != NULL) { if (order->type == bfd_indirect_link_order) { @@ -1760,7 +1777,7 @@ elfNN_ia64_modify_segment_map (abfd, info) bfd_vma flags = elf_section_data(is)->this_hdr.sh_flags; if (flags & SHF_IA_64_NORECOV) { - m->p_flags |= PF_IA_64_NORECOV; + p->p_flags |= PF_IA_64_NORECOV; goto found; } } @@ -2208,7 +2225,7 @@ addend_compare (const void *xp, const void *yp) const struct elfNN_ia64_dyn_sym_info *y = (const struct elfNN_ia64_dyn_sym_info *) yp; - return x->addend - y->addend; + return x->addend < y->addend ? -1 : x->addend > y->addend ? 1 : 0; } /* Sort elfNN_ia64_dyn_sym_info array and remove duplicates. */ @@ -2217,37 +2234,62 @@ static unsigned int sort_dyn_sym_info (struct elfNN_ia64_dyn_sym_info *info, unsigned int count) { - bfd_vma curr, prev; - unsigned int i, dup, diff, dest, src, len; + bfd_vma curr, prev, got_offset; + unsigned int i, kept, dup, diff, dest, src, len; qsort (info, count, sizeof (*info), addend_compare); /* Find the first duplicate. */ prev = info [0].addend; + got_offset = info [0].got_offset; for (i = 1; i < count; i++) { curr = info [i].addend; if (curr == prev) - break; + { + /* For duplicates, make sure that GOT_OFFSET is valid. */ + if (got_offset == (bfd_vma) -1) + got_offset = info [i].got_offset; + break; + } + got_offset = info [i].got_offset; prev = curr; } + /* We may move a block of elements to here. */ + dest = i++; + /* Remove duplicates. */ if (i < count) { - /* We need to move a block of elements to here. */ - dest = i++; while (i < count) { + /* For duplicates, make sure that the kept one has a valid + got_offset. */ + kept = dest - 1; + if (got_offset != (bfd_vma) -1) + info [kept].got_offset = got_offset; + curr = info [i].addend; + got_offset = info [i].got_offset; /* Move a block of elements whose first one is different from the previous. */ if (curr == prev) { for (src = i + 1; src < count; src++) - if (info [src].addend != curr) - break; + { + if (info [src].addend != curr) + break; + /* For duplicates, make sure that GOT_OFFSET is + valid. */ + if (got_offset == (bfd_vma) -1) + got_offset = info [src].got_offset; + } + + /* Make sure that the kept one has a valid got_offset. */ + if (got_offset != (bfd_vma) -1) + info [kept].got_offset = got_offset; } else src = i; @@ -2255,13 +2297,25 @@ sort_dyn_sym_info (struct elfNN_ia64_dyn_sym_info *info, if (src >= count) break; - /* Find the next duplicate. */ + /* Find the next duplicate. SRC will be kept. */ prev = info [src].addend; + got_offset = info [src].got_offset; for (dup = src + 1; dup < count; dup++) { curr = info [dup].addend; if (curr == prev) - break; + { + /* Make sure that got_offset is valid. */ + if (got_offset == (bfd_vma) -1) + got_offset = info [dup].got_offset; + + /* For duplicates, make sure that the kept one has + a valid got_offset. */ + if (got_offset != (bfd_vma) -1) + info [dup - 1].got_offset = got_offset; + break; + } + got_offset = info [dup].got_offset; prev = curr; } @@ -2272,20 +2326,41 @@ sort_dyn_sym_info (struct elfNN_ia64_dyn_sym_info *info, if (len == 1 && dup < count) { /* If we only move 1 element, we combine it with the next - one. Find the next different one. */ + one. There must be at least a duplicate. Find the + next different one. */ for (diff = dup + 1, src++; diff < count; diff++, src++) - if (info [diff].addend != curr) - break; + { + if (info [diff].addend != curr) + break; + /* Make sure that got_offset is valid. */ + if (got_offset == (bfd_vma) -1) + got_offset = info [diff].got_offset; + } + + /* Makre sure that the last duplicated one has an valid + offset. */ + BFD_ASSERT (curr == prev); + if (got_offset != (bfd_vma) -1) + info [diff - 1].got_offset = got_offset; if (diff < count) { - /* Find the next duplicate. */ + /* Find the next duplicate. Track the current valid + offset. */ prev = info [diff].addend; + got_offset = info [diff].got_offset; for (dup = diff + 1; dup < count; dup++) { curr = info [dup].addend; if (curr == prev) - break; + { + /* For duplicates, make sure that GOT_OFFSET + is valid. */ + if (got_offset == (bfd_vma) -1) + got_offset = info [dup].got_offset; + break; + } + got_offset = info [dup].got_offset; prev = curr; diff++; } @@ -2302,6 +2377,19 @@ sort_dyn_sym_info (struct elfNN_ia64_dyn_sym_info *info, count = dest; } + else + { + /* When we get here, either there is no duplicate at all or + the only duplicate is the last element. */ + if (dest < count) + { + /* If the last element is a duplicate, make sure that the + kept one has a valid got_offset. We also update count. */ + if (got_offset != (bfd_vma) -1) + info [dest - 1].got_offset = got_offset; + count = dest; + } + } return count; } @@ -2424,6 +2512,7 @@ has_space: /* Append the new one to the array. */ dyn_i = info + count; memset (dyn_i, 0, sizeof (*dyn_i)); + dyn_i->got_offset = (bfd_vma) -1; dyn_i->addend = addend; /* We increment count only since the new ones are unsorted and @@ -2613,10 +2702,10 @@ get_reloc_section (abfd, ia64_info, sec, create) if (srel_name == NULL) return NULL; - BFD_ASSERT ((strncmp (srel_name, ".rela", 5) == 0 + BFD_ASSERT ((CONST_STRNEQ (srel_name, ".rela") && strcmp (bfd_get_section_name (abfd, sec), srel_name+5) == 0) - || (strncmp (srel_name, ".rel", 4) == 0 + || (CONST_STRNEQ (srel_name, ".rel") && strcmp (bfd_get_section_name (abfd, sec), srel_name+4) == 0)); @@ -2733,7 +2822,7 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs) have yet been processed. Do something with what we know, as this may help reduce memory usage and processing time later. */ maybe_dynamic = (h && ((!info->executable - && (!info->symbolic + && (!SYMBOLIC_BIND (info, h) || info->unresolved_syms_in_shared_libs == RM_IGNORE)) || !h->def_regular || h->root.type == bfd_link_hash_defweak)); @@ -2905,7 +2994,7 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs) have yet been processed. Do something with what we know, as this may help reduce memory usage and processing time later. */ maybe_dynamic = (h && ((!info->executable - && (!info->symbolic + && (!SYMBOLIC_BIND (info, h) || info->unresolved_syms_in_shared_libs == RM_IGNORE)) || !h->def_regular || h->root.type == bfd_link_hash_defweak)); @@ -3694,7 +3783,7 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info) if (strcmp (name, ".got.plt") == 0) strip = FALSE; - else if (strncmp (name, ".rel", 4) == 0) + else if (CONST_STRNEQ (name, ".rel")) { if (!strip) { @@ -4358,7 +4447,7 @@ elfNN_ia64_choose_gp (abfd, info) continue; lo = os->vma; - hi = os->vma + os->size; + hi = os->vma + (os->rawsize ? os->rawsize : os->size); if (hi < lo) hi = (bfd_vma) -1; @@ -4556,7 +4645,6 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, elf_section_data(input_section->output_section) ->this_hdr.sh_flags |= flags; - return TRUE; } gp_val = _bfd_get_gp_value (output_bfd); @@ -4605,7 +4693,8 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, sym_sec = local_sections[r_symndx]; msec = sym_sec; value = _bfd_elf_rela_local_sym (output_bfd, sym, &msec, rel); - if ((sym_sec->flags & SEC_MERGE) + if (!info->relocatable + && (sym_sec->flags & SEC_MERGE) != 0 && ELF_ST_TYPE (sym->st_info) == STT_SECTION && sym_sec->sec_info_type == ELF_INFO_TYPE_MERGE) { @@ -4634,9 +4723,15 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, - sym_sec->output_section->vma - sym_sec->output_offset; } - - qsort (loc_h->info, loc_h->count, - sizeof (*loc_h->info), addend_compare); + + /* We may have introduced duplicated entries. We need + to remove them properly. */ + count = sort_dyn_sym_info (loc_h->info, loc_h->count); + if (count != loc_h->count) + { + loc_h->count = count; + loc_h->sorted_count = count; + } loc_h->sec_merge_done = 1; } @@ -4659,6 +4754,20 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, continue; } + /* For relocs against symbols from removed linkonce sections, + or sections discarded by a linker script, we just want the + section contents zeroed. Avoid any special processing. */ + if (sym_sec != NULL && elf_discarded_section (sym_sec)) + { + _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset); + rel->r_info = 0; + rel->r_addend = 0; + continue; + } + + if (info->relocatable) + continue; + hit_addr = contents + rel->r_offset; value += rel->r_addend; dynamic_symbol_p = elfNN_ia64_dynamic_symbol_p (h, info, r_type); @@ -4990,13 +5099,6 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, case R_IA64_SEGREL32LSB: case R_IA64_SEGREL64MSB: case R_IA64_SEGREL64LSB: - if (r_symndx == 0) - { - /* If the input section was discarded from the output, then - do nothing. */ - r = bfd_reloc_ok; - } - else { struct elf_segment_map *m; Elf_Internal_Phdr *p; @@ -5561,9 +5663,9 @@ elfNN_ia64_reloc_type_class (rela) static const struct bfd_elf_special_section elfNN_ia64_special_sections[] = { - { ".sbss", 5, -1, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT }, - { ".sdata", 6, -1, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT }, - { NULL, 0, 0, 0, 0 } + { STRING_COMMA_LEN (".sbss"), -1, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT }, + { STRING_COMMA_LEN (".sdata"), -1, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT }, + { NULL, 0, 0, 0, 0 } }; static bfd_boolean @@ -5590,7 +5692,7 @@ elfNN_ia64_object_p (bfd *abfd) if (elf_sec_group (sec) == NULL && ((sec->flags & (SEC_LINK_ONCE | SEC_CODE | SEC_GROUP)) == (SEC_LINK_ONCE | SEC_CODE)) - && strncmp (sec->name, ".gnu.linkonce.t.", 16) == 0) + && CONST_STRNEQ (sec->name, ".gnu.linkonce.t.")) { name = sec->name + 16; @@ -5673,7 +5775,7 @@ elfNN_hpux_post_process_headers (abfd, info) { Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd); - i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_HPUX; + i_ehdrp->e_ident[EI_OSABI] = get_elf_backend_data (abfd)->elf_osabi; i_ehdrp->e_ident[EI_ABIVERSION] = 1; } @@ -5717,6 +5819,7 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, #define ELF_MACHINE_ALT1 1999 /* EAS2.3 */ #define ELF_MACHINE_ALT2 1998 /* EAS2.2 */ #define ELF_MAXPAGESIZE 0x10000 /* 64KB */ +#define ELF_COMMONPAGESIZE 0x4000 /* 16KB */ #define elf_backend_section_from_shdr \ elfNN_ia64_section_from_shdr @@ -5732,11 +5835,15 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, elfNN_ia64_additional_program_headers #define elf_backend_modify_segment_map \ elfNN_ia64_modify_segment_map +#define elf_backend_modify_program_headers \ + elfNN_ia64_modify_program_headers #define elf_info_to_howto \ elfNN_ia64_info_to_howto #define bfd_elfNN_bfd_reloc_type_lookup \ elfNN_ia64_reloc_type_lookup +#define bfd_elfNN_bfd_reloc_name_lookup \ + elfNN_ia64_reloc_name_lookup #define bfd_elfNN_bfd_is_local_label_name \ elfNN_ia64_is_local_label_name #define bfd_elfNN_bfd_relax_section \ @@ -5758,6 +5865,8 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, elfNN_ia64_adjust_dynamic_symbol #define elf_backend_size_dynamic_sections \ elfNN_ia64_size_dynamic_sections +#define elf_backend_omit_section_dynsym \ + ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true) #define elf_backend_relocate_section \ elfNN_ia64_relocate_section #define elf_backend_finish_dynamic_symbol \ @@ -5789,6 +5898,7 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, #define elf_backend_reloc_type_class elfNN_ia64_reloc_type_class #define elf_backend_rela_normal 1 #define elf_backend_special_sections elfNN_ia64_special_sections +#define elf_backend_default_execstack 0 /* FIXME: PR 290: The Intel C compiler generates SHT_IA_64_UNWIND with SHF_LINK_ORDER. But it doesn't set the sh_link or sh_info fields. @@ -5823,7 +5933,10 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, #define elf_backend_want_p_paddr_set_to_zero 1 #undef ELF_MAXPAGESIZE -#define ELF_MAXPAGESIZE 0x1000 /* 1K */ +#define ELF_MAXPAGESIZE 0x1000 /* 4K */ +#undef ELF_COMMONPAGESIZE +#undef ELF_OSABI +#define ELF_OSABI ELFOSABI_HPUX #undef elfNN_bed #define elfNN_bed elfNN_ia64_hpux_bed diff --git a/contrib/binutils/bfd/elfxx-mips.c b/contrib/binutils/bfd/elfxx-mips.c index a9aea661f442..eac685ff0ab5 100644 --- a/contrib/binutils/bfd/elfxx-mips.c +++ b/contrib/binutils/bfd/elfxx-mips.c @@ -1,6 +1,6 @@ /* MIPS-specific support for ELF Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Most of the information added by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>. @@ -27,8 +27,8 @@ /* This file handles functionality common to the different MIPS ABI's. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "libiberty.h" #include "elf-bfd.h" @@ -488,12 +488,12 @@ typedef struct runtime_pdr { static struct mips_got_entry *mips_elf_create_local_got_entry (bfd *, struct bfd_link_info *, bfd *, struct mips_got_info *, asection *, - asection *, bfd_vma, unsigned long, struct mips_elf_link_hash_entry *, int); + bfd_vma, unsigned long, struct mips_elf_link_hash_entry *, int); static bfd_boolean mips_elf_sort_hash_table_f (struct mips_elf_link_hash_entry *, void *); static bfd_vma mips_elf_high (bfd_vma); -static bfd_boolean mips_elf_stub_section_p +static bfd_boolean mips16_stub_section_p (bfd *, asection *); static bfd_boolean mips_elf_create_dynamic_relocation (bfd *, struct bfd_link_info *, const Elf_Internal_Rela *, @@ -709,6 +709,10 @@ static bfd *reldyn_sorting_bfd; #define FN_STUB ".mips16.fn." #define CALL_STUB ".mips16.call." #define CALL_FP_STUB ".mips16.call.fp." + +#define FN_STUB_P(name) CONST_STRNEQ (name, FN_STUB) +#define CALL_STUB_P(name) CONST_STRNEQ (name, CALL_STUB) +#define CALL_FP_STUB_P(name) CONST_STRNEQ (name, CALL_FP_STUB) /* The format of the first PLT entry in a VxWorks executable. */ static const bfd_vma mips_vxworks_exec_plt0_entry[] = { @@ -838,13 +842,16 @@ mips_elf_link_hash_newfunc (struct bfd_hash_entry *entry, bfd_boolean _bfd_mips_elf_new_section_hook (bfd *abfd, asection *sec) { - struct _mips_elf_section_data *sdata; - bfd_size_type amt = sizeof (*sdata); + if (!sec->used_by_bfd) + { + struct _mips_elf_section_data *sdata; + bfd_size_type amt = sizeof (*sdata); - sdata = bfd_zalloc (abfd, amt); - if (sdata == NULL) - return FALSE; - sec->used_by_bfd = sdata; + sdata = bfd_zalloc (abfd, amt); + if (sdata == NULL) + return FALSE; + sec->used_by_bfd = sdata; + } return _bfd_elf_new_section_hook (abfd, sec); } @@ -1689,11 +1696,20 @@ sort_dynamic_relocs (const void *arg1, const void *arg2) { Elf_Internal_Rela int_reloc1; Elf_Internal_Rela int_reloc2; + int diff; bfd_elf32_swap_reloc_in (reldyn_sorting_bfd, arg1, &int_reloc1); bfd_elf32_swap_reloc_in (reldyn_sorting_bfd, arg2, &int_reloc2); - return ELF32_R_SYM (int_reloc1.r_info) - ELF32_R_SYM (int_reloc2.r_info); + diff = ELF32_R_SYM (int_reloc1.r_info) - ELF32_R_SYM (int_reloc2.r_info); + if (diff != 0) + return diff; + + if (int_reloc1.r_offset < int_reloc2.r_offset) + return -1; + if (int_reloc1.r_offset > int_reloc2.r_offset) + return 1; + return 0; } /* Like sort_dynamic_relocs, but used for elf64 relocations. */ @@ -1711,8 +1727,16 @@ sort_dynamic_relocs_64 (const void *arg1 ATTRIBUTE_UNUSED, (*get_elf_backend_data (reldyn_sorting_bfd)->s->swap_reloc_in) (reldyn_sorting_bfd, arg2, int_reloc2); - return (ELF64_R_SYM (int_reloc1[0].r_info) - - ELF64_R_SYM (int_reloc2[0].r_info)); + if (ELF64_R_SYM (int_reloc1[0].r_info) < ELF64_R_SYM (int_reloc2[0].r_info)) + return -1; + if (ELF64_R_SYM (int_reloc1[0].r_info) > ELF64_R_SYM (int_reloc2[0].r_info)) + return 1; + + if (int_reloc1[0].r_offset < int_reloc2[0].r_offset) + return -1; + if (int_reloc1[0].r_offset > int_reloc2[0].r_offset) + return 1; + return 0; #else abort (); #endif @@ -2389,16 +2413,14 @@ mips_elf_gotplt_index (struct bfd_link_info *info, return got_address - got_value; } -/* Return the GOT offset for address VALUE, which was derived from - a symbol belonging to INPUT_SECTION. If there is not yet a GOT +/* Return the GOT offset for address VALUE. If there is not yet a GOT entry for this value, create one. If R_SYMNDX refers to a TLS symbol, create a TLS GOT entry instead. Return -1 if no satisfactory GOT offset can be found. */ static bfd_vma mips_elf_local_got_index (bfd *abfd, bfd *ibfd, struct bfd_link_info *info, - asection *input_section, bfd_vma value, - unsigned long r_symndx, + bfd_vma value, unsigned long r_symndx, struct mips_elf_link_hash_entry *h, int r_type) { asection *sgot; @@ -2408,8 +2430,7 @@ mips_elf_local_got_index (bfd *abfd, bfd *ibfd, struct bfd_link_info *info, g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot); entry = mips_elf_create_local_got_entry (abfd, info, ibfd, g, sgot, - input_section, value, - r_symndx, h, r_type); + value, r_symndx, h, r_type); if (!entry) return MINUS_ONE; @@ -2510,16 +2531,15 @@ mips_elf_global_got_index (bfd *abfd, bfd *ibfd, struct elf_link_hash_entry *h, return index; } -/* Find a GOT page entry that points to within 32KB of VALUE, which was - calculated from a symbol belonging to INPUT_SECTION. These entries - are supposed to be placed at small offsets in the GOT, i.e., within - 32KB of GP. Return the index of the GOT entry, or -1 if no entry - could be created. If OFFSETP is nonnull, use it to return the +/* Find a GOT page entry that points to within 32KB of VALUE. These + entries are supposed to be placed at small offsets in the GOT, i.e., + within 32KB of GP. Return the index of the GOT entry, or -1 if no + entry could be created. If OFFSETP is nonnull, use it to return the offset of the GOT entry from VALUE. */ static bfd_vma mips_elf_got_page (bfd *abfd, bfd *ibfd, struct bfd_link_info *info, - asection *input_section, bfd_vma value, bfd_vma *offsetp) + bfd_vma value, bfd_vma *offsetp) { asection *sgot; struct mips_got_info *g; @@ -2530,8 +2550,7 @@ mips_elf_got_page (bfd *abfd, bfd *ibfd, struct bfd_link_info *info, page = (value + 0x8000) & ~(bfd_vma) 0xffff; entry = mips_elf_create_local_got_entry (abfd, info, ibfd, g, sgot, - input_section, page, 0, - NULL, R_MIPS_GOT_PAGE); + page, 0, NULL, R_MIPS_GOT_PAGE); if (!entry) return MINUS_ONE; @@ -2544,15 +2563,13 @@ mips_elf_got_page (bfd *abfd, bfd *ibfd, struct bfd_link_info *info, return index; } -/* Find a local GOT entry for an R_MIPS_GOT16 relocation against VALUE, - which was calculated from a symbol belonging to INPUT_SECTION. +/* Find a local GOT entry for an R_MIPS_GOT16 relocation against VALUE. EXTERNAL is true if the relocation was against a global symbol that has been forced local. */ static bfd_vma mips_elf_got16_entry (bfd *abfd, bfd *ibfd, struct bfd_link_info *info, - asection *input_section, bfd_vma value, - bfd_boolean external) + bfd_vma value, bfd_boolean external) { asection *sgot; struct mips_got_info *g; @@ -2568,8 +2585,7 @@ mips_elf_got16_entry (bfd *abfd, bfd *ibfd, struct bfd_link_info *info, g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot); entry = mips_elf_create_local_got_entry (abfd, info, ibfd, g, sgot, - input_section, value, 0, - NULL, R_MIPS_GOT16); + value, 0, NULL, R_MIPS_GOT16); if (entry) return entry->gotidx; else @@ -2602,8 +2618,8 @@ mips_elf_got_offset_from_index (bfd *dynobj, bfd *output_bfd, static struct mips_got_entry * mips_elf_create_local_got_entry (bfd *abfd, struct bfd_link_info *info, bfd *ibfd, struct mips_got_info *gg, - asection *sgot, asection *input_section, - bfd_vma value, unsigned long r_symndx, + asection *sgot, bfd_vma value, + unsigned long r_symndx, struct mips_elf_link_hash_entry *h, int r_type) { @@ -2684,30 +2700,23 @@ mips_elf_create_local_got_entry (bfd *abfd, struct bfd_link_info *info, MIPS_ELF_PUT_WORD (abfd, value, (sgot->contents + entry.gotidx)); - /* These GOT entries need a dynamic relocation on VxWorks. Because - the offset between segments is not fixed, the relocation must be - against a symbol in the same segment as the original symbol. - The easiest way to do this is to take INPUT_SECTION's output - section and emit a relocation against its section symbol. */ + /* These GOT entries need a dynamic relocation on VxWorks. */ if (htab->is_vxworks) { Elf_Internal_Rela outrel; - asection *s, *output_section; + asection *s; bfd_byte *loc; bfd_vma got_address; - int dynindx; s = mips_elf_rel_dyn_section (info, FALSE); - output_section = input_section->output_section; - dynindx = elf_section_data (output_section)->dynindx; got_address = (sgot->output_section->vma + sgot->output_offset + entry.gotidx); loc = s->contents + (s->reloc_count++ * sizeof (Elf32_External_Rela)); outrel.r_offset = got_address; - outrel.r_info = ELF32_R_INFO (dynindx, R_MIPS_32); - outrel.r_addend = value - output_section->vma; + outrel.r_info = ELF32_R_INFO (STN_UNDEF, R_MIPS_32); + outrel.r_addend = value; bfd_elf32_swap_reloca_out (abfd, &outrel, loc); } @@ -3085,8 +3094,7 @@ mips_elf_merge_gots (void **bfd2got_, void *p) if (tcount > 0) { unsigned int primary_total = lcount + tcount + arg->global_count; - if (primary_total * MIPS_ELF_GOT_SIZE (bfd2got->bfd) - >= MIPS_ELF_GOT_MAX_SIZE (arg->info)) + if (primary_total > maxcnt) too_many_for_tls = TRUE; } @@ -3178,6 +3186,7 @@ mips_elf_initialize_tls_index (void **entryp, void *p) struct mips_got_entry *entry = (struct mips_got_entry *)*entryp; struct mips_got_info *g = p; bfd_vma next_index; + unsigned char tls_type; /* We're only interested in TLS symbols. */ if (entry->tls_type == 0) @@ -3193,6 +3202,7 @@ mips_elf_initialize_tls_index (void **entryp, void *p) return 1; entry->d.h->tls_type |= GOT_TLS_OFFSET_DONE; entry->d.h->tls_got_offset = next_index; + tls_type = entry->d.h->tls_type; } else { @@ -3209,12 +3219,13 @@ mips_elf_initialize_tls_index (void **entryp, void *p) g->tls_ldm_offset = next_index; } entry->gotidx = next_index; + tls_type = entry->tls_type; } /* Account for the entries we've just allocated. */ - if (entry->tls_type & (GOT_TLS_GD | GOT_TLS_LDM)) + if (tls_type & (GOT_TLS_GD | GOT_TLS_LDM)) g->tls_assigned_gotno += 2; - if (entry->tls_type & GOT_TLS_IE) + if (tls_type & GOT_TLS_IE) g->tls_assigned_gotno += 1; return 1; @@ -3580,16 +3591,18 @@ mips_elf_next_relocation (bfd *abfd ATTRIBUTE_UNUSED, unsigned int r_type, const Elf_Internal_Rela *relocation, const Elf_Internal_Rela *relend) { + unsigned long r_symndx = ELF_R_SYM (abfd, relocation->r_info); + while (relocation < relend) { - if (ELF_R_TYPE (abfd, relocation->r_info) == r_type) + if (ELF_R_TYPE (abfd, relocation->r_info) == r_type + && ELF_R_SYM (abfd, relocation->r_info) == r_symndx) return relocation; ++relocation; } /* We didn't find it. */ - bfd_set_error (bfd_error_bad_value); return NULL; } @@ -4056,9 +4069,10 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, a stub. */ if (r_type != R_MIPS16_26 && !info->relocatable && ((h != NULL && h->fn_stub != NULL) - || (local_p && elf_tdata (input_bfd)->local_stubs != NULL + || (local_p + && elf_tdata (input_bfd)->local_stubs != NULL && elf_tdata (input_bfd)->local_stubs[r_symndx] != NULL)) - && !mips_elf_stub_section_p (input_bfd, input_section)) + && !mips16_stub_section_p (input_bfd, input_section)) { /* This is a 32- or 64-bit call to a 16-bit function. We should have already noticed that we were going to need the @@ -4072,38 +4086,46 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, } symbol = sec->output_section->vma + sec->output_offset; + /* The target is 16-bit, but the stub isn't. */ + target_is_16_bit_code_p = FALSE; } /* If this is a 16-bit call to a 32- or 64-bit function with a stub, we need to redirect the call to the stub. */ else if (r_type == R_MIPS16_26 && !info->relocatable - && h != NULL - && (h->call_stub != NULL || h->call_fp_stub != NULL) + && ((h != NULL && (h->call_stub != NULL || h->call_fp_stub != NULL)) + || (local_p + && elf_tdata (input_bfd)->local_call_stubs != NULL + && elf_tdata (input_bfd)->local_call_stubs[r_symndx] != NULL)) && !target_is_16_bit_code_p) { - /* If both call_stub and call_fp_stub are defined, we can figure - out which one to use by seeing which one appears in the input - file. */ - if (h->call_stub != NULL && h->call_fp_stub != NULL) + if (local_p) + sec = elf_tdata (input_bfd)->local_call_stubs[r_symndx]; + else { - asection *o; - - sec = NULL; - for (o = input_bfd->sections; o != NULL; o = o->next) + /* If both call_stub and call_fp_stub are defined, we can figure + out which one to use by checking which one appears in the input + file. */ + if (h->call_stub != NULL && h->call_fp_stub != NULL) { - if (strncmp (bfd_get_section_name (input_bfd, o), - CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0) + asection *o; + + sec = NULL; + for (o = input_bfd->sections; o != NULL; o = o->next) { - sec = h->call_fp_stub; - break; + if (CALL_FP_STUB_P (bfd_get_section_name (input_bfd, o))) + { + sec = h->call_fp_stub; + break; + } } + if (sec == NULL) + sec = h->call_stub; } - if (sec == NULL) + else if (h->call_stub != NULL) sec = h->call_stub; - } - else if (h->call_stub != NULL) - sec = h->call_stub; - else - sec = h->call_fp_stub; + else + sec = h->call_fp_stub; + } BFD_ASSERT (sec->size > 0); symbol = sec->output_section->vma + sec->output_offset; @@ -4145,7 +4167,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, if (r_type == R_MIPS_TLS_LDM) { g = mips_elf_local_got_index (abfd, input_bfd, info, - sec, 0, 0, NULL, r_type); + 0, 0, NULL, r_type); if (g == MINUS_ONE) return bfd_reloc_outofrange; } @@ -4191,7 +4213,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, break; else { - g = mips_elf_local_got_index (abfd, input_bfd, info, sec, + g = mips_elf_local_got_index (abfd, input_bfd, info, symbol + addend, r_symndx, h, r_type); if (g == MINUS_ONE) return bfd_reloc_outofrange; @@ -4240,6 +4262,13 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, outrel.r_info = ELF32_R_INFO (h->root.dynindx, r_type); outrel.r_addend = addend; bfd_elf32_swap_reloca_out (abfd, &outrel, loc); + + /* If we've written this relocation for a readonly section, + we need to set DF_TEXTREL again, so that we do not delete the + DT_TEXTREL tag. */ + if (MIPS_ELF_READONLY_SECTION (input_section)) + info->flags |= DF_TEXTREL; + *valuep = 0; return bfd_reloc_ok; } @@ -4326,6 +4355,8 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, break; case R_MIPS_TLS_DTPREL_LO16: + case R_MIPS_TLS_DTPREL32: + case R_MIPS_TLS_DTPREL64: value = (symbol + addend - dtprel_base (info)) & howto->dst_mask; break; @@ -4435,7 +4466,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, forced = ! mips_elf_local_relocation_p (input_bfd, relocation, local_sections, FALSE); - value = mips_elf_got16_entry (abfd, input_bfd, info, sec, + value = mips_elf_got16_entry (abfd, input_bfd, info, symbol + addend, forced); if (value == MINUS_ONE) return bfd_reloc_outofrange; @@ -4466,7 +4497,8 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, case R_MIPS_GNU_REL16_S2: value = symbol + _bfd_mips_elf_sign_extend (addend, 18) - p; overflowed_p = mips_elf_overflow_p (value, 18); - value = (value >> 2) & howto->dst_mask; + value >>= howto->rightshift; + value &= howto->dst_mask; break; case R_MIPS_GOT_HI16: @@ -4490,8 +4522,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, 0. */ if (! local_p) goto got_disp; - value = mips_elf_got_page (abfd, input_bfd, info, sec, - symbol + addend, NULL); + value = mips_elf_got_page (abfd, input_bfd, info, symbol + addend, NULL); if (value == MINUS_ONE) return bfd_reloc_outofrange; value = mips_elf_got_offset_from_index (dynobj, abfd, input_bfd, value); @@ -4500,8 +4531,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, case R_MIPS_GOT_OFST: if (local_p) - mips_elf_got_page (abfd, input_bfd, info, sec, - symbol + addend, &value); + mips_elf_got_page (abfd, input_bfd, info, symbol + addend, &value); else value = addend; overflowed_p = mips_elf_overflow_p (value, 16); @@ -4677,13 +4707,11 @@ mips_elf_perform_relocation (struct bfd_link_info *info, /* Returns TRUE if SECTION is a MIPS16 stub section. */ static bfd_boolean -mips_elf_stub_section_p (bfd *abfd ATTRIBUTE_UNUSED, asection *section) +mips16_stub_section_p (bfd *abfd ATTRIBUTE_UNUSED, asection *section) { const char *name = bfd_get_section_name (abfd, section); - return (strncmp (name, FN_STUB, sizeof FN_STUB - 1) == 0 - || strncmp (name, CALL_STUB, sizeof CALL_STUB - 1) == 0 - || strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0); + return FN_STUB_P (name) || CALL_STUB_P (name) || CALL_FP_STUB_P (name); } /* Add room for N relocations to the .rel(a).dyn section in ABFD. */ @@ -4745,10 +4773,13 @@ mips_elf_create_dynamic_relocation (bfd *output_bfd, outrel[0].r_offset = _bfd_elf_section_offset (output_bfd, info, input_section, rel[0].r_offset); - outrel[1].r_offset = - _bfd_elf_section_offset (output_bfd, info, input_section, rel[1].r_offset); - outrel[2].r_offset = - _bfd_elf_section_offset (output_bfd, info, input_section, rel[2].r_offset); + if (ABI_64_P (output_bfd)) + { + outrel[1].r_offset = + _bfd_elf_section_offset (output_bfd, info, input_section, rel[1].r_offset); + outrel[2].r_offset = + _bfd_elf_section_offset (output_bfd, info, input_section, rel[2].r_offset); + } if (outrel[0].r_offset == MINUS_ONE) /* The relocation field has been deleted. */ @@ -4792,6 +4823,11 @@ mips_elf_create_dynamic_relocation (bfd *output_bfd, { indx = elf_section_data (sec->output_section)->dynindx; if (indx == 0) + { + asection *osec = htab->root.text_index_section; + indx = elf_section_data (osec)->dynindx; + } + if (indx == 0) abort (); } @@ -4976,39 +5012,30 @@ _bfd_elf_mips_mach (flagword flags) default: case E_MIPS_ARCH_1: return bfd_mach_mips3000; - break; case E_MIPS_ARCH_2: return bfd_mach_mips6000; - break; case E_MIPS_ARCH_3: return bfd_mach_mips4000; - break; case E_MIPS_ARCH_4: return bfd_mach_mips8000; - break; case E_MIPS_ARCH_5: return bfd_mach_mips5; - break; case E_MIPS_ARCH_32: return bfd_mach_mipsisa32; - break; case E_MIPS_ARCH_64: return bfd_mach_mipsisa64; - break; case E_MIPS_ARCH_32R2: return bfd_mach_mipsisa32r2; - break; case E_MIPS_ARCH_64R2: return bfd_mach_mipsisa64r2; - break; } } @@ -5098,6 +5125,7 @@ _bfd_mips_elf_symbol_processing (bfd *abfd, asymbol *asym) /* Common symbols less than the GP size are automatically treated as SHN_MIPS_SCOMMON symbols on IRIX5. */ if (asym->value > elf_gp_size (abfd) + || ELF_ST_TYPE (elfsym->internal_elf_sym.st_info) == STT_TLS || IRIX_COMPAT (abfd) == ict_irix6) break; /* Fall through. */ @@ -5409,7 +5437,7 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd, return FALSE; break; case SHT_MIPS_GPTAB: - if (strncmp (name, ".gptab.", sizeof ".gptab." - 1) != 0) + if (! CONST_STRNEQ (name, ".gptab.")) return FALSE; break; case SHT_MIPS_UCODE: @@ -5432,7 +5460,7 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd, return FALSE; break; case SHT_MIPS_CONTENT: - if (strncmp (name, ".MIPS.content", sizeof ".MIPS.content" - 1) != 0) + if (! CONST_STRNEQ (name, ".MIPS.content")) return FALSE; break; case SHT_MIPS_OPTIONS: @@ -5440,7 +5468,7 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd, return FALSE; break; case SHT_MIPS_DWARF: - if (strncmp (name, ".debug_", sizeof ".debug_" - 1) != 0) + if (! CONST_STRNEQ (name, ".debug_")) return FALSE; break; case SHT_MIPS_SYMBOL_LIB: @@ -5448,9 +5476,8 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd, return FALSE; break; case SHT_MIPS_EVENTS: - if (strncmp (name, ".MIPS.events", sizeof ".MIPS.events" - 1) != 0 - && strncmp (name, ".MIPS.post_rel", - sizeof ".MIPS.post_rel" - 1) != 0) + if (! CONST_STRNEQ (name, ".MIPS.events") + && ! CONST_STRNEQ (name, ".MIPS.post_rel")) return FALSE; break; default: @@ -5556,11 +5583,7 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd, bfd_boolean _bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec) { - register const char *name; - unsigned int sh_type; - - name = bfd_get_section_name (abfd, sec); - sh_type = hdr->sh_type; + const char *name = bfd_get_section_name (abfd, sec); if (strcmp (name, ".liblist") == 0) { @@ -5570,7 +5593,7 @@ _bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec) } else if (strcmp (name, ".conflict") == 0) hdr->sh_type = SHT_MIPS_CONFLICT; - else if (strncmp (name, ".gptab.", sizeof ".gptab." - 1) == 0) + else if (CONST_STRNEQ (name, ".gptab.")) { hdr->sh_type = SHT_MIPS_GPTAB; hdr->sh_entsize = sizeof (Elf32_External_gptab); @@ -5627,7 +5650,7 @@ _bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec) hdr->sh_type = SHT_MIPS_IFACE; hdr->sh_flags |= SHF_MIPS_NOSTRIP; } - else if (strncmp (name, ".MIPS.content", strlen (".MIPS.content")) == 0) + else if (CONST_STRNEQ (name, ".MIPS.content")) { hdr->sh_type = SHT_MIPS_CONTENT; hdr->sh_flags |= SHF_MIPS_NOSTRIP; @@ -5639,7 +5662,7 @@ _bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec) hdr->sh_entsize = 1; hdr->sh_flags |= SHF_MIPS_NOSTRIP; } - else if (strncmp (name, ".debug_", sizeof ".debug_" - 1) == 0) + else if (CONST_STRNEQ (name, ".debug_")) hdr->sh_type = SHT_MIPS_DWARF; else if (strcmp (name, ".MIPS.symlib") == 0) { @@ -5647,9 +5670,8 @@ _bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec) /* The sh_link and sh_info fields are set in final_write_processing. */ } - else if (strncmp (name, ".MIPS.events", sizeof ".MIPS.events" - 1) == 0 - || strncmp (name, ".MIPS.post_rel", - sizeof ".MIPS.post_rel" - 1) == 0) + else if (CONST_STRNEQ (name, ".MIPS.events") + || CONST_STRNEQ (name, ".MIPS.post_rel")) { hdr->sh_type = SHT_MIPS_EVENTS; hdr->sh_flags |= SHF_MIPS_NOSTRIP; @@ -5662,12 +5684,6 @@ _bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec) hdr->sh_entsize = 8; } - /* In the unlikely event a special section is empty it has to lose its - special meaning. This may happen e.g. when using `strip' with the - "--only-keep-debug" option. */ - if (sec->size > 0 && !(sec->flags & SEC_HAS_CONTENTS)) - hdr->sh_type = sh_type; - /* The generic elf_fake_sections will set up REL_HDR using the default kind of relocations. We used to set up a second header for the non-default kind of relocations here, but only NewABI would use @@ -5738,6 +5754,7 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, /* Common symbols less than the GP size are automatically treated as SHN_MIPS_SCOMMON symbols. */ if (sym->st_size > elf_gp_size (abfd) + || ELF_ST_TYPE (sym->st_info) == STT_TLS || IRIX_COMPAT (abfd) == ict_irix6) break; /* Fall through. */ @@ -6119,7 +6136,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, /* Check for the mips16 stub sections. */ name = bfd_get_section_name (abfd, sec); - if (strncmp (name, FN_STUB, sizeof FN_STUB - 1) == 0) + if (FN_STUB_P (name)) { unsigned long r_symndx; @@ -6144,12 +6161,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, /* We can ignore stub sections when looking for relocs. */ if ((o->flags & SEC_RELOC) == 0 || o->reloc_count == 0 - || strncmp (bfd_get_section_name (abfd, o), FN_STUB, - sizeof FN_STUB - 1) == 0 - || strncmp (bfd_get_section_name (abfd, o), CALL_STUB, - sizeof CALL_STUB - 1) == 0 - || strncmp (bfd_get_section_name (abfd, o), CALL_FP_STUB, - sizeof CALL_FP_STUB - 1) == 0) + || mips16_stub_section_p (abfd, o)) continue; sec_relocs @@ -6201,6 +6213,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, elf_tdata (abfd)->local_stubs = n; } + sec->flags |= SEC_KEEP; elf_tdata (abfd)->local_stubs[r_symndx] = sec; /* We don't need to set mips16_stubs_seen in this case. @@ -6221,12 +6234,23 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, /* H is the symbol this stub is for. */ + /* If we already have an appropriate stub for this function, we + don't need another one, so we can discard this one. Since + this function is called before the linker maps input sections + to output sections, we can easily discard it by setting the + SEC_EXCLUDE flag. */ + if (h->fn_stub != NULL) + { + sec->flags |= SEC_EXCLUDE; + return TRUE; + } + + sec->flags |= SEC_KEEP; h->fn_stub = sec; mips_elf_hash_table (info)->mips16_stubs_seen = TRUE; } } - else if (strncmp (name, CALL_STUB, sizeof CALL_STUB - 1) == 0 - || strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0) + else if (CALL_STUB_P (name) || CALL_FP_STUB_P (name)) { unsigned long r_symndx; struct mips_elf_link_hash_entry *h; @@ -6240,42 +6264,106 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, if (r_symndx < extsymoff || sym_hashes[r_symndx - extsymoff] == NULL) { - /* This stub was actually built for a static symbol defined - in the same file. We assume that all static symbols in - mips16 code are themselves mips16, so we can simply - discard this stub. Since this function is called before - the linker maps input sections to output sections, we can - easily discard it by setting the SEC_EXCLUDE flag. */ - sec->flags |= SEC_EXCLUDE; - return TRUE; - } + asection *o; - h = ((struct mips_elf_link_hash_entry *) - sym_hashes[r_symndx - extsymoff]); + /* This stub is for a local symbol. This stub will only be + needed if there is some relocation (R_MIPS16_26) in this BFD + that refers to this symbol. */ + for (o = abfd->sections; o != NULL; o = o->next) + { + Elf_Internal_Rela *sec_relocs; + const Elf_Internal_Rela *r, *rend; + + /* We can ignore stub sections when looking for relocs. */ + if ((o->flags & SEC_RELOC) == 0 + || o->reloc_count == 0 + || mips16_stub_section_p (abfd, o)) + continue; - /* H is the symbol this stub is for. */ + sec_relocs + = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL, + info->keep_memory); + if (sec_relocs == NULL) + return FALSE; - if (strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0) - loc = &h->call_fp_stub; - else - loc = &h->call_stub; - - /* If we already have an appropriate stub for this function, we - don't need another one, so we can discard this one. Since - this function is called before the linker maps input sections - to output sections, we can easily discard it by setting the - SEC_EXCLUDE flag. We can also discard this section if we - happen to already know that this is a mips16 function; it is - not necessary to check this here, as it is checked later, but - it is slightly faster to check now. */ - if (*loc != NULL || h->root.other == STO_MIPS16) - { - sec->flags |= SEC_EXCLUDE; - return TRUE; + rend = sec_relocs + o->reloc_count; + for (r = sec_relocs; r < rend; r++) + if (ELF_R_SYM (abfd, r->r_info) == r_symndx + && ELF_R_TYPE (abfd, r->r_info) == R_MIPS16_26) + break; + + if (elf_section_data (o)->relocs != sec_relocs) + free (sec_relocs); + + if (r < rend) + break; + } + + if (o == NULL) + { + /* There is no non-call reloc for this stub, so we do + not need it. Since this function is called before + the linker maps input sections to output sections, we + can easily discard it by setting the SEC_EXCLUDE + flag. */ + sec->flags |= SEC_EXCLUDE; + return TRUE; + } + + /* Record this stub in an array of local symbol call_stubs for + this BFD. */ + if (elf_tdata (abfd)->local_call_stubs == NULL) + { + unsigned long symcount; + asection **n; + bfd_size_type amt; + + if (elf_bad_symtab (abfd)) + symcount = NUM_SHDR_ENTRIES (symtab_hdr); + else + symcount = symtab_hdr->sh_info; + amt = symcount * sizeof (asection *); + n = bfd_zalloc (abfd, amt); + if (n == NULL) + return FALSE; + elf_tdata (abfd)->local_call_stubs = n; + } + + sec->flags |= SEC_KEEP; + elf_tdata (abfd)->local_call_stubs[r_symndx] = sec; + + /* We don't need to set mips16_stubs_seen in this case. + That flag is used to see whether we need to look through + the global symbol table for stubs. We don't need to set + it here, because we just have a local stub. */ } + else + { + h = ((struct mips_elf_link_hash_entry *) + sym_hashes[r_symndx - extsymoff]); + + /* H is the symbol this stub is for. */ + + if (CALL_FP_STUB_P (name)) + loc = &h->call_fp_stub; + else + loc = &h->call_stub; + + /* If we already have an appropriate stub for this function, we + don't need another one, so we can discard this one. Since + this function is called before the linker maps input sections + to output sections, we can easily discard it by setting the + SEC_EXCLUDE flag. */ + if (*loc != NULL) + { + sec->flags |= SEC_EXCLUDE; + return TRUE; + } - *loc = sec; - mips_elf_hash_table (info)->mips16_stubs_seen = TRUE; + sec->flags |= SEC_KEEP; + *loc = sec; + mips_elf_hash_table (info)->mips16_stubs_seen = TRUE; + } } if (dynobj == NULL) @@ -6395,6 +6483,10 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, return FALSE; } mips_elf_allocate_dynamic_relocations (dynobj, info, 1); + if (MIPS_ELF_READONLY_SECTION (sec)) + /* We tell the dynamic linker that there are + relocations against the text segment. */ + info->flags |= DF_TEXTREL; } } else if (r_type == R_MIPS_CALL_LO16 @@ -6640,12 +6732,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, References from a stub section do not count. */ if (h != NULL && r_type != R_MIPS16_26 - && strncmp (bfd_get_section_name (abfd, sec), FN_STUB, - sizeof FN_STUB - 1) != 0 - && strncmp (bfd_get_section_name (abfd, sec), CALL_STUB, - sizeof CALL_STUB - 1) != 0 - && strncmp (bfd_get_section_name (abfd, sec), CALL_FP_STUB, - sizeof CALL_FP_STUB - 1) != 0) + && !mips16_stub_section_p (abfd, sec)) { struct mips_elf_link_hash_entry *mh; @@ -6938,7 +7025,6 @@ _bfd_mips_vxworks_adjust_dynamic_symbol (struct bfd_link_info *info, bfd *dynobj; struct mips_elf_link_hash_entry *hmips; struct mips_elf_link_hash_table *htab; - unsigned int power_of_two; htab = mips_elf_hash_table (info); dynobj = elf_hash_table (info)->dynobj; @@ -7061,26 +7147,7 @@ _bfd_mips_vxworks_adjust_dynamic_symbol (struct bfd_link_info *info, h->needs_copy = 1; } - /* We need to figure out the alignment required for this symbol. */ - power_of_two = bfd_log2 (h->size); - if (power_of_two > 4) - power_of_two = 4; - - /* Apply the required alignment. */ - htab->sdynbss->size = BFD_ALIGN (htab->sdynbss->size, - (bfd_size_type) 1 << power_of_two); - if (power_of_two > bfd_get_section_alignment (dynobj, htab->sdynbss) - && !bfd_set_section_alignment (dynobj, htab->sdynbss, power_of_two)) - return FALSE; - - /* Define the symbol as being at this point in the section. */ - h->root.u.def.section = htab->sdynbss; - h->root.u.def.value = htab->sdynbss->size; - - /* Increment the section size to make room for the symbol. */ - htab->sdynbss->size += h->size; - - return TRUE; + return _bfd_elf_adjust_dynamic_copy (h, htab->sdynbss); } /* Return the number of dynamic section symbols required by OUTPUT_BFD. @@ -7094,7 +7161,7 @@ count_section_dynsyms (bfd *output_bfd, struct bfd_link_info *info) bfd_size_type count; count = 0; - if (info->shared) + if (info->shared || elf_hash_table (info)->is_relocatable_executable) { asection *p; const struct elf_backend_data *bed; @@ -7293,7 +7360,7 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, if ((s->flags & SEC_LINKER_CREATED) == 0) continue; - if (strncmp (name, ".rel", 4) == 0) + if (CONST_STRNEQ (name, ".rel")) { if (s->size != 0) { @@ -7345,7 +7412,7 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, mips_elf_allocate_dynamic_relocations (dynobj, info, count); } } - else if (!htab->is_vxworks && strncmp (name, ".got", 4) == 0) + else if (!htab->is_vxworks && CONST_STRNEQ (name, ".got")) { /* _bfd_mips_elf_always_size_sections() has already done most of the work, but some symbols may have been mapped @@ -7421,16 +7488,16 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, } else if (! info->shared && ! mips_elf_hash_table (info)->use_rld_obj_head - && strncmp (name, ".rld_map", 8) == 0) + && CONST_STRNEQ (name, ".rld_map")) { /* We add a room for __rld_map. It will be filled in by the rtld to contain a pointer to the _r_debug structure. */ s->size += 4; } else if (SGI_COMPAT (output_bfd) - && strncmp (name, ".compact_rel", 12) == 0) + && CONST_STRNEQ (name, ".compact_rel")) s->size += mips_elf_hash_table (info)->compact_rel_size; - else if (strncmp (name, ".init", 5) != 0 + else if (! CONST_STRNEQ (name, ".init") && s != htab->sgotplt && s != htab->splt) { @@ -7480,29 +7547,22 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, /* Add some entries to the .dynamic section. We fill in the values later, in _bfd_mips_elf_finish_dynamic_sections, but we must add the entries now so that we get the correct size for - the .dynamic section. The DT_DEBUG entry is filled in by the - dynamic linker and used by the debugger. */ - if (! info->shared) - { - /* SGI object has the equivalence of DT_DEBUG in the - DT_MIPS_RLD_MAP entry. */ - if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP, 0)) - return FALSE; - if (!SGI_COMPAT (output_bfd)) - { - if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0)) - return FALSE; - } - } - else - { - /* Shared libraries on traditional mips have DT_DEBUG. */ - if (!SGI_COMPAT (output_bfd)) - { - if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0)) - return FALSE; - } - } + the .dynamic section. */ + + /* SGI object has the equivalence of DT_DEBUG in the + DT_MIPS_RLD_MAP entry. This must come first because glibc + only fills in DT_MIPS_RLD_MAP (not DT_DEBUG) and GDB only + looks at the first one it sees. */ + if (!info->shared + && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP, 0)) + return FALSE; + + /* The DT_DEBUG entry may be filled in by the dynamic linker and + used by the debugger. */ + if (info->executable + && !SGI_COMPAT (output_bfd) + && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0)) + return FALSE; if (reltext && (SGI_COMPAT (output_bfd) || htab->is_vxworks)) info->flags |= DF_TEXTREL; @@ -7669,8 +7729,54 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, bfd_boolean rela_relocation_p = TRUE; unsigned int r_type = ELF_R_TYPE (output_bfd, rel->r_info); const char *msg; + unsigned long r_symndx; + asection *sec; + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry *h; /* Find the relocation howto for this relocation. */ + howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd, r_type, + NEWABI_P (input_bfd) + && (MIPS_RELOC_RELA_P + (input_bfd, input_section, + rel - relocs))); + + r_symndx = ELF_R_SYM (input_bfd, rel->r_info); + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + if (mips_elf_local_relocation_p (input_bfd, rel, local_sections, FALSE)) + { + sec = local_sections[r_symndx]; + h = NULL; + } + else + { + unsigned long extsymoff; + + extsymoff = 0; + if (!elf_bad_symtab (input_bfd)) + extsymoff = symtab_hdr->sh_info; + h = elf_sym_hashes (input_bfd) [r_symndx - extsymoff]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + sec = NULL; + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + sec = h->root.u.def.section; + } + + if (sec != NULL && elf_discarded_section (sec)) + { + /* For relocs against symbols from removed linkonce sections, + or sections discarded by a linker script, we just want the + section contents zeroed. Avoid any special processing. */ + _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset); + rel->r_info = 0; + rel->r_addend = 0; + continue; + } + if (r_type == R_MIPS_64 && ! NEWABI_P (input_bfd)) { /* Some 32-bit code uses R_MIPS_64. In particular, people use @@ -7686,13 +7792,6 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (bfd_big_endian (input_bfd)) rel->r_offset += 4; } - else - /* NewABI defaults to RELA relocations. */ - howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd, r_type, - NEWABI_P (input_bfd) - && (MIPS_RELOC_RELA_P - (input_bfd, input_section, - rel - relocs))); if (!use_saved_addend_p) { @@ -7733,10 +7832,8 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, && mips_elf_local_relocation_p (input_bfd, rel, local_sections, FALSE))) { - bfd_vma l; const Elf_Internal_Rela *lo16_relocation; reloc_howto_type *lo16_howto; - bfd_byte *lo16_location; int lo16_type; if (r_type == R_MIPS16_HI16) @@ -7759,32 +7856,56 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, several relocations for the same address. In that case, the R_MIPS_LO16 relocation may occur as one of these. We permit a similar extension - in general, as that is useful for GCC. */ + in general, as that is useful for GCC. + + In some cases GCC dead code elimination removes + the LO16 but keeps the corresponding HI16. This + is strictly speaking a violation of the ABI but + not immediately harmful. */ lo16_relocation = mips_elf_next_relocation (input_bfd, lo16_type, rel, relend); if (lo16_relocation == NULL) - return FALSE; - - lo16_location = contents + lo16_relocation->r_offset; - - /* Obtain the addend kept there. */ - lo16_howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd, - lo16_type, FALSE); - _bfd_mips16_elf_reloc_unshuffle (input_bfd, lo16_type, FALSE, - lo16_location); - l = mips_elf_obtain_contents (lo16_howto, lo16_relocation, - input_bfd, contents); - _bfd_mips16_elf_reloc_shuffle (input_bfd, lo16_type, FALSE, - lo16_location); - l &= lo16_howto->src_mask; - l <<= lo16_howto->rightshift; - l = _bfd_mips_elf_sign_extend (l, 16); - - addend <<= 16; - - /* Compute the combined addend. */ - addend += l; + { + const char *name; + + if (h) + name = h->root.root.string; + else + name = bfd_elf_sym_name (input_bfd, symtab_hdr, + local_syms + r_symndx, + sec); + (*_bfd_error_handler) + (_("%B: Can't find matching LO16 reloc against `%s' for %s at 0x%lx in section `%A'"), + input_bfd, input_section, name, howto->name, + rel->r_offset); + } + else + { + bfd_byte *lo16_location; + bfd_vma l; + + lo16_location = contents + lo16_relocation->r_offset; + + /* Obtain the addend kept there. */ + lo16_howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd, + lo16_type, FALSE); + _bfd_mips16_elf_reloc_unshuffle (input_bfd, lo16_type, + FALSE, lo16_location); + l = mips_elf_obtain_contents (lo16_howto, + lo16_relocation, + input_bfd, contents); + _bfd_mips16_elf_reloc_shuffle (input_bfd, lo16_type, + FALSE, lo16_location); + l &= lo16_howto->src_mask; + l <<= lo16_howto->rightshift; + l = _bfd_mips_elf_sign_extend (l, 16); + + addend <<= 16; + + /* Compute the combined addend. */ + addend += l; + } } else addend <<= howto->rightshift; @@ -8792,11 +8913,10 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0x80000000, sgot->contents + MIPS_ELF_GOT_SIZE (output_bfd)); } - } - if (sgot != NULL) - elf_section_data (sgot->output_section)->this_hdr.sh_entsize - = MIPS_ELF_GOT_SIZE (output_bfd); + elf_section_data (sgot->output_section)->this_hdr.sh_entsize + = MIPS_ELF_GOT_SIZE (output_bfd); + } /* Generate dynamic relocations for the non-primary gots. */ if (gg != NULL && gg->next) @@ -8870,6 +8990,10 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, * (ABI_64_P (output_bfd) ? sizeof (Elf64_Mips_External_Rel) : sizeof (Elf32_External_Rel))); + /* Adjust the section size too. Tools like the prelinker + can reasonably expect the values to the same. */ + elf_section_data (s->output_section)->this_hdr.sh_size + = dyn.d_un.d_val; break; default: @@ -9095,7 +9219,7 @@ _bfd_mips_elf_final_write_processing (bfd *abfd, BFD_ASSERT ((*hdrpp)->bfd_section != NULL); name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section); BFD_ASSERT (name != NULL - && strncmp (name, ".gptab.", sizeof ".gptab." - 1) == 0); + && CONST_STRNEQ (name, ".gptab.")); sec = bfd_get_section_by_name (abfd, name + sizeof ".gptab" - 1); BFD_ASSERT (sec != NULL); (*hdrpp)->sh_info = elf_section_data (sec)->this_idx; @@ -9105,8 +9229,7 @@ _bfd_mips_elf_final_write_processing (bfd *abfd, BFD_ASSERT ((*hdrpp)->bfd_section != NULL); name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section); BFD_ASSERT (name != NULL - && strncmp (name, ".MIPS.content", - sizeof ".MIPS.content" - 1) == 0); + && CONST_STRNEQ (name, ".MIPS.content")); sec = bfd_get_section_by_name (abfd, name + sizeof ".MIPS.content" - 1); BFD_ASSERT (sec != NULL); @@ -9126,13 +9249,12 @@ _bfd_mips_elf_final_write_processing (bfd *abfd, BFD_ASSERT ((*hdrpp)->bfd_section != NULL); name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section); BFD_ASSERT (name != NULL); - if (strncmp (name, ".MIPS.events", sizeof ".MIPS.events" - 1) == 0) + if (CONST_STRNEQ (name, ".MIPS.events")) sec = bfd_get_section_by_name (abfd, name + sizeof ".MIPS.events" - 1); else { - BFD_ASSERT (strncmp (name, ".MIPS.post_rel", - sizeof ".MIPS.post_rel" - 1) == 0); + BFD_ASSERT (CONST_STRNEQ (name, ".MIPS.post_rel")); sec = bfd_get_section_by_name (abfd, (name + sizeof ".MIPS.post_rel" - 1)); @@ -9149,7 +9271,8 @@ _bfd_mips_elf_final_write_processing (bfd *abfd, segments. */ int -_bfd_mips_elf_additional_program_headers (bfd *abfd) +_bfd_mips_elf_additional_program_headers (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { asection *s; int ret = 0; @@ -9171,6 +9294,12 @@ _bfd_mips_elf_additional_program_headers (bfd *abfd) && bfd_get_section_by_name (abfd, ".mdebug")) ++ret; + /* Allocate a PT_NULL header in dynamic objects. See + _bfd_mips_elf_modify_segment_map for details. */ + if (!SGI_COMPAT (abfd) + && bfd_get_section_by_name (abfd, ".dynamic")) + ++ret; + return ret; } @@ -9240,15 +9369,18 @@ _bfd_mips_elf_modify_segment_map (bfd *abfd, || (*pm)->p_type == PT_INTERP)) pm = &(*pm)->next; - amt = sizeof (struct elf_segment_map); - options_segment = bfd_zalloc (abfd, amt); - options_segment->next = *pm; - options_segment->p_type = PT_MIPS_OPTIONS; - options_segment->p_flags = PF_R; - options_segment->p_flags_valid = TRUE; - options_segment->count = 1; - options_segment->sections[0] = s; - *pm = options_segment; + if (*pm == NULL || (*pm)->p_type != PT_MIPS_OPTIONS) + { + amt = sizeof (struct elf_segment_map); + options_segment = bfd_zalloc (abfd, amt); + options_segment->next = *pm; + options_segment->p_type = PT_MIPS_OPTIONS; + options_segment->p_flags = PF_R; + options_segment->p_flags_valid = TRUE; + options_segment->count = 1; + options_segment->sections[0] = s; + *pm = options_segment; + } } } else @@ -9318,8 +9450,18 @@ _bfd_mips_elf_modify_segment_map (bfd *abfd, m->p_flags_valid = 1; } } - if (m != NULL - && m->count == 1 && strcmp (m->sections[0]->name, ".dynamic") == 0) + /* GNU/Linux binaries do not need the extended PT_DYNAMIC section. + glibc's dynamic linker has traditionally derived the number of + tags from the p_filesz field, and sometimes allocates stack + arrays of that size. An overly-big PT_DYNAMIC segment can + be actively harmful in such cases. Making PT_DYNAMIC contain + other sections can also make life hard for the prelinker, + which might move one of the other sections to a different + PT_LOAD segment. */ + if (SGI_COMPAT (abfd) + && m != NULL + && m->count == 1 + && strcmp (m->sections[0]->name, ".dynamic") == 0) { static const char *sec_names[] = { @@ -9376,6 +9518,38 @@ _bfd_mips_elf_modify_segment_map (bfd *abfd, } } + /* Allocate a spare program header in dynamic objects so that tools + like the prelinker can add an extra PT_LOAD entry. + + If the prelinker needs to make room for a new PT_LOAD entry, its + standard procedure is to move the first (read-only) sections into + the new (writable) segment. However, the MIPS ABI requires + .dynamic to be in a read-only segment, and the section will often + start within sizeof (ElfNN_Phdr) bytes of the last program header. + + Although the prelinker could in principle move .dynamic to a + writable segment, it seems better to allocate a spare program + header instead, and avoid the need to move any sections. + There is a long tradition of allocating spare dynamic tags, + so allocating a spare program header seems like a natural + extension. */ + if (!SGI_COMPAT (abfd) + && bfd_get_section_by_name (abfd, ".dynamic")) + { + for (pm = &elf_tdata (abfd)->segment_map; *pm != NULL; pm = &(*pm)->next) + if ((*pm)->p_type == PT_NULL) + break; + if (*pm == NULL) + { + m = bfd_zalloc (abfd, sizeof (*m)); + if (m == NULL) + return FALSE; + + m->p_type = PT_NULL; + *pm = m; + } + } + return TRUE; } @@ -9384,7 +9558,7 @@ _bfd_mips_elf_modify_segment_map (bfd *abfd, asection * _bfd_mips_elf_gc_mark_hook (asection *sec, - struct bfd_link_info *info ATTRIBUTE_UNUSED, + struct bfd_link_info *info, Elf_Internal_Rela *rel, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) @@ -9392,32 +9566,14 @@ _bfd_mips_elf_gc_mark_hook (asection *sec, /* ??? Do mips16 stub sections need to be handled special? */ if (h != NULL) - { - switch (ELF_R_TYPE (sec->owner, rel->r_info)) - { - case R_MIPS_GNU_VTINHERIT: - case R_MIPS_GNU_VTENTRY: - break; - - default: - switch (h->root.type) - { - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - return h->root.u.def.section; - - case bfd_link_hash_common: - return h->root.u.c.p->section; - - default: - break; - } - } - } - else - return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + switch (ELF_R_TYPE (sec->owner, rel->r_info)) + { + case R_MIPS_GNU_VTINHERIT: + case R_MIPS_GNU_VTENTRY: + return NULL; + } - return NULL; + return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym); } /* Update the got entry reference counts for the section being removed. */ @@ -9512,7 +9668,7 @@ _bfd_mips_elf_hide_symbol (struct bfd_link_info *info, dynobj = elf_hash_table (info)->dynobj; if (dynobj != NULL && force_local && h->root.type != STT_TLS - && (got = mips_elf_got_section (dynobj, FALSE)) != NULL + && (got = mips_elf_got_section (dynobj, TRUE)) != NULL && (g = mips_elf_section_data (got)->u.got_info) != NULL) { if (g->next) @@ -9637,8 +9793,9 @@ _bfd_mips_elf_ignore_discarded_relocs (asection *sec) } bfd_boolean -_bfd_mips_elf_write_section (bfd *output_bfd, asection *sec, - bfd_byte *contents) +_bfd_mips_elf_write_section (bfd *output_bfd, + struct bfd_link_info *link_info ATTRIBUTE_UNUSED, + asection *sec, bfd_byte *contents) { bfd_byte *to, *from, *end; int i; @@ -10437,7 +10594,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) mdebug_sec = o; } - if (strncmp (o->name, ".gptab.", sizeof ".gptab." - 1) == 0) + if (CONST_STRNEQ (o->name, ".gptab.")) { const char *subname; unsigned int c; @@ -10815,6 +10972,112 @@ mips_32bit_flags_p (flagword flags) } +/* Merge object attributes from IBFD into OBFD. Raise an error if + there are conflicting attributes. */ +static bfd_boolean +mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd) +{ + obj_attribute *in_attr; + obj_attribute *out_attr; + + if (!elf_known_obj_attributes_proc (obfd)[0].i) + { + /* This is the first object. Copy the attributes. */ + _bfd_elf_copy_obj_attributes (ibfd, obfd); + + /* Use the Tag_null value to indicate the attributes have been + initialized. */ + elf_known_obj_attributes_proc (obfd)[0].i = 1; + + return TRUE; + } + + /* Check for conflicting Tag_GNU_MIPS_ABI_FP attributes and merge + non-conflicting ones. */ + in_attr = elf_known_obj_attributes (ibfd)[OBJ_ATTR_GNU]; + out_attr = elf_known_obj_attributes (obfd)[OBJ_ATTR_GNU]; + if (in_attr[Tag_GNU_MIPS_ABI_FP].i != out_attr[Tag_GNU_MIPS_ABI_FP].i) + { + out_attr[Tag_GNU_MIPS_ABI_FP].type = 1; + if (out_attr[Tag_GNU_MIPS_ABI_FP].i == 0) + out_attr[Tag_GNU_MIPS_ABI_FP].i = in_attr[Tag_GNU_MIPS_ABI_FP].i; + else if (in_attr[Tag_GNU_MIPS_ABI_FP].i == 0) + ; + else if (in_attr[Tag_GNU_MIPS_ABI_FP].i > 3) + _bfd_error_handler + (_("Warning: %B uses unknown floating point ABI %d"), ibfd, + in_attr[Tag_GNU_MIPS_ABI_FP].i); + else if (out_attr[Tag_GNU_MIPS_ABI_FP].i > 3) + _bfd_error_handler + (_("Warning: %B uses unknown floating point ABI %d"), obfd, + out_attr[Tag_GNU_MIPS_ABI_FP].i); + else + switch (out_attr[Tag_GNU_MIPS_ABI_FP].i) + { + case 1: + switch (in_attr[Tag_GNU_MIPS_ABI_FP].i) + { + case 2: + _bfd_error_handler + (_("Warning: %B uses -msingle-float, %B uses -mdouble-float"), + obfd, ibfd); + + case 3: + _bfd_error_handler + (_("Warning: %B uses hard float, %B uses soft float"), + obfd, ibfd); + break; + + default: + abort (); + } + break; + + case 2: + switch (in_attr[Tag_GNU_MIPS_ABI_FP].i) + { + case 1: + _bfd_error_handler + (_("Warning: %B uses -msingle-float, %B uses -mdouble-float"), + ibfd, obfd); + + case 3: + _bfd_error_handler + (_("Warning: %B uses hard float, %B uses soft float"), + obfd, ibfd); + break; + + default: + abort (); + } + break; + + case 3: + switch (in_attr[Tag_GNU_MIPS_ABI_FP].i) + { + case 1: + case 2: + _bfd_error_handler + (_("Warning: %B uses hard float, %B uses soft float"), + ibfd, obfd); + break; + + default: + abort (); + } + break; + + default: + abort (); + } + } + + /* Merge Tag_compatibility attributes and any common GNU ones. */ + _bfd_elf_merge_object_attributes (ibfd, obfd); + + return TRUE; +} + /* Merge backend specific data from an object file to the output object file when linking. */ @@ -10848,6 +11111,9 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) return FALSE; } + if (!mips_elf_merge_obj_attributes (ibfd, obfd)) + return FALSE; + new_flags = elf_elfheader (ibfd)->e_flags; elf_elfheader (obfd)->e_flags |= new_flags & EF_MIPS_NOREORDER; old_flags = elf_elfheader (obfd)->e_flags; @@ -10860,7 +11126,9 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) = elf_elfheader (ibfd)->e_ident[EI_CLASS]; if (bfd_get_arch (obfd) == bfd_get_arch (ibfd) - && bfd_get_arch_info (obfd)->the_default) + && (bfd_get_arch_info (obfd)->the_default + || mips_mach_extends_p (bfd_get_mach (obfd), + bfd_get_mach (ibfd)))) { if (! bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), bfd_get_mach (ibfd))) @@ -11071,37 +11339,52 @@ _bfd_mips_elf_print_private_bfd_data (bfd *abfd, void *ptr) fprintf (file, _(" [no abi set]")); if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_1) - fprintf (file, _(" [mips1]")); + fprintf (file, " [mips1]"); else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_2) - fprintf (file, _(" [mips2]")); + fprintf (file, " [mips2]"); else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_3) - fprintf (file, _(" [mips3]")); + fprintf (file, " [mips3]"); else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_4) - fprintf (file, _(" [mips4]")); + fprintf (file, " [mips4]"); else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_5) - fprintf (file, _(" [mips5]")); + fprintf (file, " [mips5]"); else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_32) - fprintf (file, _(" [mips32]")); + fprintf (file, " [mips32]"); else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_64) - fprintf (file, _(" [mips64]")); + fprintf (file, " [mips64]"); else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_32R2) - fprintf (file, _(" [mips32r2]")); + fprintf (file, " [mips32r2]"); else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_64R2) - fprintf (file, _(" [mips64r2]")); + fprintf (file, " [mips64r2]"); else fprintf (file, _(" [unknown ISA]")); if (elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH_ASE_MDMX) - fprintf (file, _(" [mdmx]")); + fprintf (file, " [mdmx]"); if (elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH_ASE_M16) - fprintf (file, _(" [mips16]")); + fprintf (file, " [mips16]"); if (elf_elfheader (abfd)->e_flags & EF_MIPS_32BITMODE) - fprintf (file, _(" [32bitmode]")); + fprintf (file, " [32bitmode]"); else fprintf (file, _(" [not 32bitmode]")); + if (elf_elfheader (abfd)->e_flags & EF_MIPS_NOREORDER) + fprintf (file, " [noreorder]"); + + if (elf_elfheader (abfd)->e_flags & EF_MIPS_PIC) + fprintf (file, " [PIC]"); + + if (elf_elfheader (abfd)->e_flags & EF_MIPS_CPIC) + fprintf (file, " [CPIC]"); + + if (elf_elfheader (abfd)->e_flags & EF_MIPS_XGOT) + fprintf (file, " [XGOT]"); + + if (elf_elfheader (abfd)->e_flags & EF_MIPS_UCODE) + fprintf (file, " [UCODE]"); + fputc ('\n', file); return TRUE; @@ -11109,24 +11392,34 @@ _bfd_mips_elf_print_private_bfd_data (bfd *abfd, void *ptr) const struct bfd_elf_special_section _bfd_mips_elf_special_sections[] = { - { ".lit4", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, - { ".lit8", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, - { ".mdebug", 7, 0, SHT_MIPS_DEBUG, 0 }, - { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, - { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, - { ".ucode", 6, 0, SHT_MIPS_UCODE, 0 }, - { NULL, 0, 0, 0, 0 } + { STRING_COMMA_LEN (".lit4"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, + { STRING_COMMA_LEN (".lit8"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, + { STRING_COMMA_LEN (".mdebug"), 0, SHT_MIPS_DEBUG, 0 }, + { STRING_COMMA_LEN (".sbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, + { STRING_COMMA_LEN (".sdata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, + { STRING_COMMA_LEN (".ucode"), 0, SHT_MIPS_UCODE, 0 }, + { NULL, 0, 0, 0, 0 } }; -/* Ensure that the STO_OPTIONAL flag is copied into h->other, - even if this is not a defintion of the symbol. */ +/* Merge non visibility st_other attributes. Ensure that the + STO_OPTIONAL flag is copied into h->other, even if this is not a + definiton of the symbol. */ void _bfd_mips_elf_merge_symbol_attribute (struct elf_link_hash_entry *h, const Elf_Internal_Sym *isym, bfd_boolean definition, bfd_boolean dynamic ATTRIBUTE_UNUSED) { - if (! definition + if ((isym->st_other & ~ELF_ST_VISIBILITY (-1)) != 0) + { + unsigned char other; + + other = (definition ? isym->st_other : h->other); + other &= ~ELF_ST_VISIBILITY (-1); + h->other = other | ELF_ST_VISIBILITY (h->other); + } + + if (!definition && ELF_MIPS_IS_OPTIONAL (isym->st_other)) h->other |= STO_OPTIONAL; } @@ -11138,3 +11431,11 @@ _bfd_mips_elf_ignore_undef_symbol (struct elf_link_hash_entry *h) { return ELF_MIPS_IS_OPTIONAL (h->other) ? TRUE : FALSE; } + +bfd_boolean +_bfd_mips_elf_common_definition (Elf_Internal_Sym *sym) +{ + return (sym->st_shndx == SHN_COMMON + || sym->st_shndx == SHN_MIPS_ACOMMON + || sym->st_shndx == SHN_MIPS_SCOMMON); +} diff --git a/contrib/binutils/bfd/elfxx-mips.h b/contrib/binutils/bfd/elfxx-mips.h index 6c3c9a30f6e5..3e97cc04ab62 100644 --- a/contrib/binutils/bfd/elfxx-mips.h +++ b/contrib/binutils/bfd/elfxx-mips.h @@ -1,5 +1,6 @@ /* MIPS ELF specific backend routines. - Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -68,7 +69,7 @@ extern bfd_boolean _bfd_mips_elf_finish_dynamic_sections extern void _bfd_mips_elf_final_write_processing (bfd *, bfd_boolean); extern int _bfd_mips_elf_additional_program_headers - (bfd *); + (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_mips_elf_modify_segment_map (bfd *, struct bfd_link_info *); extern asection * _bfd_mips_elf_gc_mark_hook @@ -108,7 +109,7 @@ extern bfd_boolean _bfd_mips_elf_print_private_bfd_data extern bfd_boolean _bfd_mips_elf_discard_info (bfd *, struct elf_reloc_cookie *, struct bfd_link_info *); extern bfd_boolean _bfd_mips_elf_write_section - (bfd *, asection *, bfd_byte *); + (bfd *, struct bfd_link_info *, asection *, bfd_byte *); extern bfd_boolean _bfd_mips_elf_read_ecoff_info (bfd *, asection *, struct ecoff_debug_info *); @@ -141,6 +142,9 @@ extern bfd_boolean _bfd_mips_elf_ignore_undef_symbol extern const struct bfd_elf_special_section _bfd_mips_elf_special_sections []; +extern bfd_boolean _bfd_mips_elf_common_definition (Elf_Internal_Sym *); + +#define elf_backend_common_definition _bfd_mips_elf_common_definition #define elf_backend_name_local_section_symbols \ _bfd_mips_elf_name_local_section_symbols #define elf_backend_special_sections _bfd_mips_elf_special_sections diff --git a/contrib/binutils/bfd/elfxx-sparc.c b/contrib/binutils/bfd/elfxx-sparc.c index ef7ff482d2ed..708af290e3c4 100644 --- a/contrib/binutils/bfd/elfxx-sparc.c +++ b/contrib/binutils/bfd/elfxx-sparc.c @@ -1,5 +1,5 @@ /* SPARC-specific support for ELF - Copyright 2005, 2006 Free Software Foundation, Inc. + Copyright 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -19,8 +19,8 @@ /* This file handles functionality common to the different SPARC ABI's. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "bfdlink.h" #include "libbfd.h" #include "libiberty.h" @@ -385,6 +385,30 @@ _bfd_sparc_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, } reloc_howto_type * +_bfd_sparc_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (_bfd_sparc_elf_howto_table) + / sizeof (_bfd_sparc_elf_howto_table[0])); + i++) + if (_bfd_sparc_elf_howto_table[i].name != NULL + && strcasecmp (_bfd_sparc_elf_howto_table[i].name, r_name) == 0) + return &_bfd_sparc_elf_howto_table[i]; + + if (strcasecmp (sparc_vtinherit_howto.name, r_name) == 0) + return &sparc_vtinherit_howto; + if (strcasecmp (sparc_vtentry_howto.name, r_name) == 0) + return &sparc_vtentry_howto; + if (strcasecmp (sparc_rev32_howto.name, r_name) == 0) + return &sparc_rev32_howto; + + return NULL; +} + +reloc_howto_type * _bfd_sparc_elf_info_to_howto_ptr (unsigned int r_type) { switch (r_type) @@ -487,11 +511,14 @@ struct _bfd_sparc_elf_obj_tdata bfd_boolean _bfd_sparc_elf_mkobject (bfd *abfd) { - bfd_size_type amt = sizeof (struct _bfd_sparc_elf_obj_tdata); - abfd->tdata.any = bfd_zalloc (abfd, amt); if (abfd->tdata.any == NULL) - return FALSE; - return TRUE; + { + bfd_size_type amt = sizeof (struct _bfd_sparc_elf_obj_tdata); + abfd->tdata.any = bfd_zalloc (abfd, amt); + if (abfd->tdata.any == NULL) + return FALSE; + } + return bfd_elf_mkobject (abfd); } static void @@ -507,27 +534,14 @@ sparc_put_word_64 (bfd *bfd, bfd_vma val, void *ptr) } static void -sparc_elf_append_rela_64 (bfd *abfd ATTRIBUTE_UNUSED, - asection *s ATTRIBUTE_UNUSED, - Elf_Internal_Rela *rel ATTRIBUTE_UNUSED) +sparc_elf_append_rela (bfd *abfd, asection *s, Elf_Internal_Rela *rel) { -#ifdef BFD64 - Elf64_External_Rela *loc64; - - loc64 = (Elf64_External_Rela *) s->contents; - loc64 += s->reloc_count++; - bfd_elf64_swap_reloca_out (abfd, rel, (bfd_byte *) loc64); -#endif -} - -static void -sparc_elf_append_rela_32 (bfd *abfd, asection *s, Elf_Internal_Rela *rel) -{ - Elf32_External_Rela *loc32; + const struct elf_backend_data *bed; + bfd_byte *loc; - loc32 = (Elf32_External_Rela *) s->contents; - loc32 += s->reloc_count++; - bfd_elf32_swap_reloca_out (abfd, rel, (bfd_byte *) loc32); + bed = get_elf_backend_data (abfd); + loc = s->contents + (s->reloc_count++ * bed->s->sizeof_rela); + bed->s->swap_reloca_out (abfd, rel, loc); } static bfd_vma @@ -746,9 +760,6 @@ static const bfd_vma sparc_vxworks_shared_plt_entry[] = #define SPARC_ELF_PUT_WORD(htab, bfd, val, ptr) \ htab->put_word(bfd, val, ptr) -#define SPARC_ELF_APPEND_RELA(htab, bfd, sec, rela) \ - htab->append_rela(bfd, sec, rela) - #define SPARC_ELF_R_INFO(htab, in_rel, index, type) \ htab->r_info(in_rel, index, type) @@ -824,7 +835,6 @@ _bfd_sparc_elf_link_hash_table_create (bfd *abfd) if (ABI_64_P (abfd)) { ret->put_word = sparc_put_word_64; - ret->append_rela = sparc_elf_append_rela_64; ret->r_info = sparc_elf_r_info_64; ret->r_symndx = sparc_elf_r_symndx_64; ret->dtpoff_reloc = R_SPARC_TLS_DTPOFF64; @@ -840,7 +850,6 @@ _bfd_sparc_elf_link_hash_table_create (bfd *abfd) else { ret->put_word = sparc_put_word_32; - ret->append_rela = sparc_elf_append_rela_32; ret->r_info = sparc_elf_r_info_32; ret->r_symndx = sparc_elf_r_symndx_32; ret->dtpoff_reloc = R_SPARC_TLS_DTPOFF32; @@ -1427,7 +1436,7 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, if (name == NULL) return FALSE; - BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + BFD_ASSERT (CONST_STRNEQ (name, ".rela") && strcmp (bfd_get_section_name (abfd, sec), name + 5) == 0); @@ -1529,35 +1538,14 @@ _bfd_sparc_elf_gc_mark_hook (asection *sec, Elf_Internal_Sym *sym) { if (h != NULL) - { - struct _bfd_sparc_elf_link_hash_table *htab; - - htab = _bfd_sparc_elf_hash_table (info); - switch (SPARC_ELF_R_TYPE (rel->r_info)) + switch (SPARC_ELF_R_TYPE (rel->r_info)) { case R_SPARC_GNU_VTINHERIT: case R_SPARC_GNU_VTENTRY: - break; - - default: - switch (h->root.type) - { - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - return h->root.u.def.section; - - case bfd_link_hash_common: - return h->root.u.c.p->section; - - default: - break; - } + return NULL; } - } - else - return bfd_section_from_elf_index (sec->owner, sym->st_shndx); - return NULL; + return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym); } /* Update the got entry reference counts for the section being removed. */ @@ -1713,7 +1701,6 @@ _bfd_sparc_elf_adjust_dynamic_symbol (struct bfd_link_info *info, struct _bfd_sparc_elf_link_hash_entry * eh; struct _bfd_sparc_elf_dyn_relocs *p; asection *s; - unsigned int power_of_two; htab = _bfd_sparc_elf_hash_table (info); @@ -1830,29 +1817,9 @@ _bfd_sparc_elf_adjust_dynamic_symbol (struct bfd_link_info *info, h->needs_copy = 1; } - /* We need to figure out the alignment required for this symbol. I - have no idea how ELF linkers handle this. */ - power_of_two = bfd_log2 (h->size); - if (power_of_two > htab->align_power_max) - power_of_two = htab->align_power_max; - - /* Apply the required alignment. */ s = htab->sdynbss; - s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); - if (power_of_two > bfd_get_section_alignment (dynobj, s)) - { - if (! bfd_set_section_alignment (dynobj, s, power_of_two)) - return FALSE; - } - - /* Define the symbol as being at this point in the section. */ - h->root.u.def.section = s; - h->root.u.def.value = s->size; - - /* Increment the section size to make room for the symbol. */ - s->size += h->size; - return TRUE; + return _bfd_elf_adjust_dynamic_copy (h, s); } /* Allocate space in .plt, .got and associated reloc sections for @@ -2287,7 +2254,7 @@ _bfd_sparc_elf_size_dynamic_sections (bfd *output_bfd, /* Strip this section if we don't need it; see the comment below. */ } - else if (strncmp (s->name, ".rela", 5) == 0) + else if (CONST_STRNEQ (s->name, ".rela")) { if (s->size != 0) { @@ -2434,13 +2401,16 @@ _bfd_sparc_elf_size_dynamic_sections (bfd *output_bfd, bfd_boolean _bfd_sparc_elf_new_section_hook (bfd *abfd, asection *sec) { - struct _bfd_sparc_elf_section_data *sdata; - bfd_size_type amt = sizeof (*sdata); + if (!sec->used_by_bfd) + { + struct _bfd_sparc_elf_section_data *sdata; + bfd_size_type amt = sizeof (*sdata); - sdata = (struct _bfd_sparc_elf_section_data *) bfd_zalloc (abfd, amt); - if (sdata == NULL) - return FALSE; - sec->used_by_bfd = (PTR) sdata; + sdata = bfd_zalloc (abfd, amt); + if (sdata == NULL) + return FALSE; + sec->used_by_bfd = sdata; + } return _bfd_elf_new_section_hook (abfd, sec); } @@ -2486,10 +2456,14 @@ tpoff (struct bfd_link_info *info, bfd_vma address) /* Relocate a SPARC ELF section. */ bfd_boolean -_bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, - bfd *input_bfd, asection *input_section, - bfd_byte *contents, Elf_Internal_Rela *relocs, - Elf_Internal_Sym *local_syms, asection **local_sections) +_bfd_sparc_elf_relocate_section (bfd *output_bfd, + struct bfd_link_info *info, + bfd *input_bfd, + asection *input_section, + bfd_byte *contents, + Elf_Internal_Rela *relocs, + Elf_Internal_Sym *local_syms, + asection **local_sections) { struct _bfd_sparc_elf_link_hash_table *htab; Elf_Internal_Shdr *symtab_hdr; @@ -2501,9 +2475,6 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, Elf_Internal_Rela *relend; int num_relocs; - if (info->relocatable) - return TRUE; - htab = _bfd_sparc_elf_hash_table (info); symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); @@ -2547,7 +2518,6 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, } howto = _bfd_sparc_elf_howto_table + r_type; - /* This is a final link. */ r_symndx = SPARC_ELF_R_SYMNDX (htab, rel->r_info); h = NULL; sym = NULL; @@ -2579,6 +2549,21 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, } } + if (sec != NULL && elf_discarded_section (sec)) + { + /* For relocs against symbols from removed linkonce + sections, or sections discarded by a linker script, we + just want the section contents zeroed. Avoid any + special processing. */ + _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset); + rel->r_info = 0; + rel->r_addend = 0; + continue; + } + + if (info->relocatable) + continue; + switch (r_type) { case R_SPARC_GOT10: @@ -2660,7 +2645,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, 0, R_SPARC_RELATIVE); outrel.r_addend = relocation; relocation = 0; - SPARC_ELF_APPEND_RELA (htab, output_bfd, s, &outrel); + sparc_elf_append_rela (output_bfd, s, &outrel); } SPARC_ELF_PUT_WORD (htab, output_bfd, relocation, @@ -2767,11 +2752,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, case R_SPARC_L44: case R_SPARC_UA64: r_sparc_plt32: - /* r_symndx will be zero only for relocs against symbols - from removed linkonce sections, or sections discarded by - a linker script. */ - if (r_symndx == 0 - || (input_section->flags & SEC_ALLOC) == 0) + if ((input_section->flags & SEC_ALLOC) == 0) break; if ((info->shared @@ -2879,6 +2860,8 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, { long indx; + outrel.r_addend = relocation + rel->r_addend; + if (is_plt) sec = htab->splt; @@ -2893,9 +2876,20 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, { asection *osec; + /* We are turning this relocation into one + against a section symbol. It would be + proper to subtract the symbol's value, + osec->vma, from the emitted reloc addend, + but ld.so expects buggy relocs. */ osec = sec->output_section; indx = elf_section_data (osec)->dynindx; + if (indx == 0) + { + osec = htab->elf.text_index_section; + indx = elf_section_data (osec)->dynindx; + } + /* FIXME: we really should be able to link non-pic shared libraries. */ if (indx == 0) @@ -2909,12 +2903,12 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, } } - outrel.r_info = SPARC_ELF_R_INFO (htab, rel, indx, r_type); - outrel.r_addend = relocation + rel->r_addend; + outrel.r_info = SPARC_ELF_R_INFO (htab, rel, indx, + r_type); } } - SPARC_ELF_APPEND_RELA (htab, output_bfd, sreloc, &outrel); + sparc_elf_append_rela (output_bfd, sreloc, &outrel); /* This reloc will be computed at runtime, so there's no need to do anything now. */ @@ -3022,7 +3016,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, else outrel.r_addend = 0; outrel.r_info = SPARC_ELF_R_INFO (htab, NULL, indx, dr_type); - SPARC_ELF_APPEND_RELA (htab, output_bfd, htab->srelgot, &outrel); + sparc_elf_append_rela (output_bfd, htab->srelgot, &outrel); if (r_type == R_SPARC_TLS_GD_HI22 || r_type == R_SPARC_TLS_GD_LO10) @@ -3043,7 +3037,8 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, outrel.r_info = SPARC_ELF_R_INFO (htab, NULL, indx, SPARC_ELF_DTPOFF_RELOC (htab)); outrel.r_offset += SPARC_ELF_WORD_BYTES (htab); - SPARC_ELF_APPEND_RELA (htab, output_bfd, htab->srelgot, &outrel); + sparc_elf_append_rela (output_bfd, htab->srelgot, + &outrel); } } else if (dr_type == SPARC_ELF_DTPMOD_RELOC (htab)) @@ -3112,7 +3107,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + rel->r_addend; } - SPARC_ELF_APPEND_RELA (htab, output_bfd, sreloc, &outrel); + sparc_elf_append_rela (output_bfd, sreloc, &outrel); continue; } relocation = tpoff (info, relocation); @@ -3633,9 +3628,11 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd, { bfd *dynobj; struct _bfd_sparc_elf_link_hash_table *htab; + const struct elf_backend_data *bed; htab = _bfd_sparc_elf_hash_table (info); dynobj = htab->elf.dynobj; + bed = get_elf_backend_data (output_bfd); if (h->plt.offset != (bfd_vma) -1) { @@ -3705,18 +3702,8 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd, thus .plt[4] has corresponding .rela.plt[0] and so on. */ loc = srela->contents; -#ifdef BFD64 - if (ABI_64_P (output_bfd)) - { - loc += rela_index * sizeof (Elf64_External_Rela); - bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); - } - else -#endif - { - loc += rela_index * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); - } + loc += rela_index * bed->s->sizeof_rela; + bed->s->swap_reloca_out (output_bfd, &rela, loc); if (!h->def_regular) { @@ -3773,7 +3760,7 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd, SPARC_ELF_PUT_WORD (htab, output_bfd, 0, sgot->contents + (h->got.offset & ~(bfd_vma) 1)); - SPARC_ELF_APPEND_RELA (htab, output_bfd, srela, &rela); + sparc_elf_append_rela (output_bfd, srela, &rela); } if (h->needs_copy) @@ -3793,7 +3780,7 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd, + h->root.u.def.section->output_offset); rela.r_info = SPARC_ELF_R_INFO (htab, NULL, h->dynindx, R_SPARC_COPY); rela.r_addend = 0; - SPARC_ELF_APPEND_RELA (htab, output_bfd, s, &rela); + sparc_elf_append_rela (output_bfd, s, &rela); } /* Mark some specially defined symbols as absolute. On VxWorks, @@ -3809,83 +3796,30 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd, /* Finish up the dynamic sections. */ -#ifdef BFD64 static bfd_boolean -sparc64_finish_dyn (bfd *output_bfd, struct bfd_link_info *info, - bfd *dynobj, asection *sdyn, - asection *splt ATTRIBUTE_UNUSED) +sparc_finish_dyn (bfd *output_bfd, struct bfd_link_info *info, + bfd *dynobj, asection *sdyn, + asection *splt ATTRIBUTE_UNUSED) { - Elf64_External_Dyn *dyncon, *dynconend; - int stt_regidx = -1; - - dyncon = (Elf64_External_Dyn *) sdyn->contents; - dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->size); - for (; dyncon < dynconend; dyncon++) - { - Elf_Internal_Dyn dyn; - const char *name; - bfd_boolean size; - - bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn); - - switch (dyn.d_tag) - { - case DT_PLTGOT: name = ".plt"; size = FALSE; break; - case DT_PLTRELSZ: name = ".rela.plt"; size = TRUE; break; - case DT_JMPREL: name = ".rela.plt"; size = FALSE; break; - case DT_SPARC_REGISTER: - if (stt_regidx == -1) - { - stt_regidx = - _bfd_elf_link_lookup_local_dynindx (info, output_bfd, -1); - if (stt_regidx == -1) - return FALSE; - } - dyn.d_un.d_val = stt_regidx++; - bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); - /* fallthrough */ - default: name = NULL; size = FALSE; break; - } - - if (name != NULL) - { - asection *s; - - s = bfd_get_section_by_name (output_bfd, name); - if (s == NULL) - dyn.d_un.d_val = 0; - else - { - if (! size) - dyn.d_un.d_ptr = s->vma; - else - dyn.d_un.d_val = s->size; - } - bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); - } - } - return TRUE; -} -#endif - -static bfd_boolean -sparc32_finish_dyn (bfd *output_bfd, struct bfd_link_info *info, - bfd *dynobj, asection *sdyn, - asection *splt ATTRIBUTE_UNUSED) -{ - Elf32_External_Dyn *dyncon, *dynconend; struct _bfd_sparc_elf_link_hash_table *htab; + const struct elf_backend_data *bed; + bfd_byte *dyncon, *dynconend; + size_t dynsize; + int stt_regidx = -1; + bfd_boolean abi_64_p; htab = _bfd_sparc_elf_hash_table (info); - dyncon = (Elf32_External_Dyn *) sdyn->contents; - dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size); - for (; dyncon < dynconend; dyncon++) + bed = get_elf_backend_data (output_bfd); + dynsize = bed->s->sizeof_dyn; + dynconend = sdyn->contents + sdyn->size; + abi_64_p = ABI_64_P (output_bfd); + for (dyncon = sdyn->contents; dyncon < dynconend; dyncon += dynsize) { Elf_Internal_Dyn dyn; const char *name; bfd_boolean size; - bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn); + bed->s->swap_dyn_in (dynobj, dyncon, &dyn); if (htab->is_vxworks && dyn.d_tag == DT_RELASZ) { @@ -3894,7 +3828,7 @@ sparc32_finish_dyn (bfd *output_bfd, struct bfd_link_info *info, if (htab->srelplt) { dyn.d_un.d_val -= htab->srelplt->size; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bed->s->swap_dyn_out (output_bfd, &dyn, dyncon); } } else if (htab->is_vxworks && dyn.d_tag == DT_PLTGOT) @@ -3905,9 +3839,21 @@ sparc32_finish_dyn (bfd *output_bfd, struct bfd_link_info *info, { dyn.d_un.d_val = (htab->sgotplt->output_section->vma + htab->sgotplt->output_offset); - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bed->s->swap_dyn_out (output_bfd, &dyn, dyncon); } } + else if (abi_64_p && dyn.d_tag == DT_SPARC_REGISTER) + { + if (stt_regidx == -1) + { + stt_regidx = + _bfd_elf_link_lookup_local_dynindx (info, output_bfd, -1); + if (stt_regidx == -1) + return FALSE; + } + dyn.d_un.d_val = stt_regidx++; + bed->s->swap_dyn_out (output_bfd, &dyn, dyncon); + } else { switch (dyn.d_tag) @@ -3915,7 +3861,7 @@ sparc32_finish_dyn (bfd *output_bfd, struct bfd_link_info *info, case DT_PLTGOT: name = ".plt"; size = FALSE; break; case DT_PLTRELSZ: name = ".rela.plt"; size = TRUE; break; case DT_JMPREL: name = ".rela.plt"; size = FALSE; break; - default: name = NULL; size = FALSE; break; + default: name = NULL; size = FALSE; break; } if (name != NULL) @@ -3932,7 +3878,7 @@ sparc32_finish_dyn (bfd *output_bfd, struct bfd_link_info *info, else dyn.d_un.d_val = s->size; } - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + bed->s->swap_dyn_out (output_bfd, &dyn, dyncon); } } } @@ -4046,20 +3992,12 @@ _bfd_sparc_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i if (elf_hash_table (info)->dynamic_sections_created) { asection *splt; - bfd_boolean ret; splt = bfd_get_section_by_name (dynobj, ".plt"); BFD_ASSERT (splt != NULL && sdyn != NULL); -#ifdef BFD64 - if (ABI_64_P (output_bfd)) - ret = sparc64_finish_dyn (output_bfd, info, dynobj, sdyn, splt); - else -#endif - ret = sparc32_finish_dyn (output_bfd, info, dynobj, sdyn, splt); - - if (ret != TRUE) - return ret; + if (!sparc_finish_dyn (output_bfd, info, dynobj, sdyn, splt)) + return FALSE; /* Initialize the contents of the .plt section. */ if (splt->size > 0) @@ -4081,7 +4019,8 @@ _bfd_sparc_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i } elf_section_data (splt->output_section)->this_hdr.sh_entsize - = htab->plt_entry_size; + = (htab->is_vxworks || !ABI_64_P (output_bfd)) + ? 0 : htab->plt_entry_size; } /* Set the first entry in the global offset table to the address of diff --git a/contrib/binutils/bfd/elfxx-sparc.h b/contrib/binutils/bfd/elfxx-sparc.h index 0a5a88b6fe36..787fd33c6d7c 100644 --- a/contrib/binutils/bfd/elfxx-sparc.h +++ b/contrib/binutils/bfd/elfxx-sparc.h @@ -1,5 +1,5 @@ /* SPARC ELF specific backend routines. - Copyright 2005 Free Software Foundation, Inc. + Copyright 2005, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -71,7 +71,6 @@ struct _bfd_sparc_elf_link_hash_table asection *sgotplt; void (*put_word) (bfd *, bfd_vma, void *); - void (*append_rela) (bfd *, asection *, Elf_Internal_Rela *); bfd_vma (*r_info) (Elf_Internal_Rela *, bfd_vma, bfd_vma); bfd_vma (*r_symndx) (bfd_vma); int (*build_plt_entry) (bfd *, asection *, bfd_vma, bfd_vma, bfd_vma *); @@ -97,6 +96,8 @@ struct _bfd_sparc_elf_link_hash_table extern reloc_howto_type *_bfd_sparc_elf_reloc_type_lookup (bfd *, bfd_reloc_code_real_type); +extern reloc_howto_type *_bfd_sparc_elf_reloc_name_lookup + (bfd *, const char *); extern void _bfd_sparc_elf_info_to_howto (bfd *, arelent *, Elf_Internal_Rela *); extern reloc_howto_type *_bfd_sparc_elf_info_to_howto_ptr diff --git a/contrib/binutils/bfd/elfxx-target.h b/contrib/binutils/bfd/elfxx-target.h index 503726d2b866..be0cfecfde03 100644 --- a/contrib/binutils/bfd/elfxx-target.h +++ b/contrib/binutils/bfd/elfxx-target.h @@ -29,7 +29,9 @@ #ifndef bfd_elfNN_close_and_cleanup #define bfd_elfNN_close_and_cleanup _bfd_elf_close_and_cleanup #endif -#define bfd_elfNN_bfd_free_cached_info _bfd_generic_bfd_free_cached_info +#ifndef bfd_elfNN_bfd_free_cached_info +#define bfd_elfNN_bfd_free_cached_info _bfd_free_cached_info +#endif #ifndef bfd_elfNN_get_section_contents #define bfd_elfNN_get_section_contents _bfd_generic_get_section_contents #endif @@ -101,6 +103,9 @@ #ifndef elf_backend_want_p_paddr_set_to_zero #define elf_backend_want_p_paddr_set_to_zero 0 #endif +#ifndef elf_backend_default_execstack +#define elf_backend_default_execstack 1 +#endif #define bfd_elfNN_bfd_debug_info_start bfd_void #define bfd_elfNN_bfd_debug_info_end bfd_void @@ -129,7 +134,10 @@ #define elf_backend_gc_mark_dynamic_ref bfd_elf_gc_mark_dynamic_ref_symbol #endif #ifndef elf_backend_gc_mark_hook -#define elf_backend_gc_mark_hook NULL +#define elf_backend_gc_mark_hook _bfd_elf_gc_mark_hook +#endif +#ifndef elf_backend_gc_mark_extra_sections +#define elf_backend_gc_mark_extra_sections NULL #endif #ifndef elf_backend_gc_sweep_hook #define elf_backend_gc_sweep_hook NULL @@ -283,6 +291,10 @@ #define elf_info_to_howto_rel 0 #endif +#ifndef ELF_OSABI +#define ELF_OSABI ELFOSABI_NONE +#endif + #ifndef ELF_MAXPAGESIZE #error ELF_MAXPAGESIZE is not defined #define ELF_MAXPAGESIZE 1 @@ -292,6 +304,10 @@ #define ELF_MINPAGESIZE ELF_MAXPAGESIZE #endif +#ifndef ELF_COMMONPAGESIZE +#define ELF_COMMONPAGESIZE ELF_MAXPAGESIZE +#endif + #ifndef ELF_DYNAMIC_SEC_FLAGS /* Note that we set the SEC_IN_MEMORY flag for these sections. */ #define ELF_DYNAMIC_SEC_FLAGS \ @@ -366,6 +382,9 @@ #ifndef elf_backend_check_directives #define elf_backend_check_directives 0 #endif +#ifndef elf_backend_as_needed_cleanup +#define elf_backend_as_needed_cleanup 0 +#endif #ifndef elf_backend_adjust_dynamic_symbol #define elf_backend_adjust_dynamic_symbol 0 #endif @@ -375,6 +394,10 @@ #ifndef elf_backend_size_dynamic_sections #define elf_backend_size_dynamic_sections 0 #endif +#ifndef elf_backend_init_index_section +#define elf_backend_init_index_section \ + ((void (*) (bfd *, struct bfd_link_info *)) bfd_void) +#endif #ifndef elf_backend_relocate_section #define elf_backend_relocate_section 0 #endif @@ -396,6 +419,9 @@ #ifndef elf_backend_modify_segment_map #define elf_backend_modify_segment_map 0 #endif +#ifndef elf_backend_modify_program_headers +#define elf_backend_modify_program_headers 0 +#endif #ifndef elf_backend_ecoff_debug_swap #define elf_backend_ecoff_debug_swap 0 #endif @@ -405,12 +431,27 @@ #ifndef elf_backend_got_header_size #define elf_backend_got_header_size 0 #endif +#ifndef elf_backend_obj_attrs_vendor +#define elf_backend_obj_attrs_vendor NULL +#endif +#ifndef elf_backend_obj_attrs_section +#define elf_backend_obj_attrs_section NULL +#endif +#ifndef elf_backend_obj_attrs_arg_type +#define elf_backend_obj_attrs_arg_type NULL +#endif +#ifndef elf_backend_obj_attrs_section_type +#define elf_backend_obj_attrs_section_type SHT_GNU_ATTRIBUTES +#endif #ifndef elf_backend_post_process_headers #define elf_backend_post_process_headers NULL #endif #ifndef elf_backend_print_symbol_all #define elf_backend_print_symbol_all NULL #endif +#ifndef elf_backend_output_arch_local_syms +#define elf_backend_output_arch_local_syms NULL +#endif #ifndef elf_backend_output_arch_syms #define elf_backend_output_arch_syms NULL #endif @@ -441,6 +482,9 @@ #ifndef elf_backend_grok_psinfo #define elf_backend_grok_psinfo NULL #endif +#ifndef elf_backend_write_core_note +#define elf_backend_write_core_note NULL +#endif #ifndef elf_backend_sprintf_vma #define elf_backend_sprintf_vma _bfd_elf_sprintf_vma #endif @@ -551,15 +595,24 @@ #define elf_backend_merge_symbol NULL #endif +#ifndef elf_backend_hash_symbol +#define elf_backend_hash_symbol _bfd_elf_hash_symbol +#endif + +#ifndef elf_backend_is_function_type +#define elf_backend_is_function_type _bfd_elf_is_function_type +#endif + extern const struct elf_size_info _bfd_elfNN_size_info; -#ifndef INCLUDED_TARGET_FILE -static const struct elf_backend_data elfNN_bed = +static struct elf_backend_data elfNN_bed = { ELF_ARCH, /* arch */ ELF_MACHINE_CODE, /* elf_machine_code */ + ELF_OSABI, /* elf_osabi */ ELF_MAXPAGESIZE, /* maxpagesize */ ELF_MINPAGESIZE, /* minpagesize */ + ELF_COMMONPAGESIZE, /* commonpagesize */ ELF_DYNAMIC_SEC_FLAGS, /* dynamic_sec_flags */ elf_info_to_howto, elf_info_to_howto_rel, @@ -583,9 +636,11 @@ static const struct elf_backend_data elfNN_bed = elf_backend_omit_section_dynsym, elf_backend_check_relocs, elf_backend_check_directives, + elf_backend_as_needed_cleanup, elf_backend_adjust_dynamic_symbol, elf_backend_always_size_sections, elf_backend_size_dynamic_sections, + elf_backend_init_index_section, elf_backend_relocate_section, elf_backend_finish_dynamic_symbol, elf_backend_finish_dynamic_sections, @@ -593,11 +648,14 @@ static const struct elf_backend_data elfNN_bed = elf_backend_final_write_processing, elf_backend_additional_program_headers, elf_backend_modify_segment_map, + elf_backend_modify_program_headers, elf_backend_gc_mark_dynamic_ref, elf_backend_gc_mark_hook, + elf_backend_gc_mark_extra_sections, elf_backend_gc_sweep_hook, elf_backend_post_process_headers, elf_backend_print_symbol_all, + elf_backend_output_arch_local_syms, elf_backend_output_arch_syms, elf_backend_copy_indirect_symbol, elf_backend_hide_symbol, @@ -608,6 +666,7 @@ static const struct elf_backend_data elfNN_bed = elf_backend_count_relocs, elf_backend_grok_prstatus, elf_backend_grok_psinfo, + elf_backend_write_core_note, elf_backend_sprintf_vma, elf_backend_fprintf_vma, elf_backend_reloc_type_class, @@ -628,6 +687,8 @@ static const struct elf_backend_data elfNN_bed = elf_backend_common_section_index, elf_backend_common_section, elf_backend_merge_symbol, + elf_backend_hash_symbol, + elf_backend_is_function_type, elf_backend_link_order_error_handler, elf_backend_relplt_name, ELF_MACHINE_ALT1, @@ -635,6 +696,10 @@ static const struct elf_backend_data elfNN_bed = &elf_backend_size_info, elf_backend_special_sections, elf_backend_got_header_size, + elf_backend_obj_attrs_vendor, + elf_backend_obj_attrs_section, + elf_backend_obj_attrs_arg_type, + elf_backend_obj_attrs_section_type, elf_backend_collect, elf_backend_type_change_ok, elf_backend_may_use_rel_p, @@ -651,9 +716,9 @@ static const struct elf_backend_data elfNN_bed = elf_backend_can_refcount, elf_backend_want_got_sym, elf_backend_want_dynbss, - elf_backend_want_p_paddr_set_to_zero + elf_backend_want_p_paddr_set_to_zero, + elf_backend_default_execstack }; -#endif /* Forward declaration for use when initialising alternative_target field. */ #ifdef TARGET_LITTLE_SYM diff --git a/contrib/binutils/bfd/format.c b/contrib/binutils/bfd/format.c index 6a34dd2bea48..514389843530 100644 --- a/contrib/binutils/bfd/format.c +++ b/contrib/binutils/bfd/format.c @@ -1,6 +1,6 @@ /* Generic BFD support for file formats. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002, - 2003, 2005 Free Software Foundation, Inc. + 2003, 2005, 2007 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -42,8 +42,8 @@ SUBSECTION File format functions */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" /* IMPORT from targets.c. */ diff --git a/contrib/binutils/bfd/freebsd.h b/contrib/binutils/bfd/freebsd.h index 5bc5bbcaa90f..67e67fc69c90 100644 --- a/contrib/binutils/bfd/freebsd.h +++ b/contrib/binutils/bfd/freebsd.h @@ -1,5 +1,5 @@ /* BFD back-end definitions used by all FreeBSD targets. - Copyright 1990, 1991, 1992, 1996, 1997, 2000, 2001, 2002, 2005 + Copyright 1990, 1991, 1992, 1996, 1997, 2000, 2001, 2002, 2005, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -60,8 +60,8 @@ ((exec).a_info = \ ((exec).a_info & 0x03ffffff) | ((flags & 0x03f) << 26)) -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "libaout.h" diff --git a/contrib/binutils/bfd/gen-aout.c b/contrib/binutils/bfd/gen-aout.c index c81d3d0027b5..80e90c05eaea 100644 --- a/contrib/binutils/bfd/gen-aout.c +++ b/contrib/binutils/bfd/gen-aout.c @@ -1,5 +1,5 @@ /* Generate parameters for an a.out system. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2001, 2002 + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2001, 2002, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -99,8 +99,8 @@ main (argc, argv) printf("\n#define MY(OP) CONCAT2 (%s_,OP)\n\n", target); printf("#define TARGETNAME \"a.out-%s\"\n\n", target); - printf("#include \"bfd.h\"\n"); printf("#include \"sysdep.h\"\n"); + printf("#include \"bfd.h\"\n"); printf("#include \"libbfd.h\"\n"); printf("#include \"libaout.h\"\n"); printf("\n#include \"aout-target.h\"\n"); diff --git a/contrib/binutils/bfd/hash.c b/contrib/binutils/bfd/hash.c index ce9ba5c6297f..2b67dc5eb020 100644 --- a/contrib/binutils/bfd/hash.c +++ b/contrib/binutils/bfd/hash.c @@ -1,6 +1,6 @@ /* hash.c -- hash table routines for BFD Copyright 1993, 1994, 1995, 1997, 1999, 2001, 2002, 2003, 2004, 2005, - 2006 Free Software Foundation, Inc. + 2006, 2007 Free Software Foundation, Inc. Written by Steve Chamberlain <sac@cygnus.com> This file is part of BFD, the Binary File Descriptor library. @@ -19,8 +19,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "objalloc.h" #include "libiberty.h" @@ -299,6 +299,58 @@ SUBSUBSECTION /* The default number of entries to use when creating a hash table. */ #define DEFAULT_SIZE 4051 + +/* The following function returns a nearest prime number which is + greater than N, and near a power of two. Copied from libiberty. + Returns zero for ridiculously large N to signify an error. */ + +static unsigned long +higher_prime_number (unsigned long n) +{ + /* These are primes that are near, but slightly smaller than, a + power of two. */ + static const unsigned long primes[] = { + (unsigned long) 127, + (unsigned long) 2039, + (unsigned long) 32749, + (unsigned long) 65521, + (unsigned long) 131071, + (unsigned long) 262139, + (unsigned long) 524287, + (unsigned long) 1048573, + (unsigned long) 2097143, + (unsigned long) 4194301, + (unsigned long) 8388593, + (unsigned long) 16777213, + (unsigned long) 33554393, + (unsigned long) 67108859, + (unsigned long) 134217689, + (unsigned long) 268435399, + (unsigned long) 536870909, + (unsigned long) 1073741789, + (unsigned long) 2147483647, + /* 4294967291L */ + ((unsigned long) 2147483647) + ((unsigned long) 2147483644), + }; + + const unsigned long *low = &primes[0]; + const unsigned long *high = &primes[sizeof (primes) / sizeof (primes[0])]; + + while (low != high) + { + const unsigned long *mid = low + (high - low) / 2; + if (n >= *mid) + low = mid + 1; + else + high = mid; + } + + if (n >= *low) + return 0; + + return *low; +} + static size_t bfd_default_hash_table_size = DEFAULT_SIZE; /* Create a new hash table, given a number of entries. */ @@ -330,6 +382,8 @@ bfd_hash_table_init_n (struct bfd_hash_table *table, memset ((void *) table->table, 0, alloc); table->size = size; table->entsize = entsize; + table->count = 0; + table->frozen = 0; table->newfunc = newfunc; return TRUE; } @@ -416,6 +470,45 @@ bfd_hash_lookup (struct bfd_hash_table *table, hashp->hash = hash; hashp->next = table->table[index]; table->table[index] = hashp; + table->count++; + + if (!table->frozen && table->count > table->size * 3 / 4) + { + unsigned long newsize = higher_prime_number (table->size); + struct bfd_hash_entry **newtable; + unsigned int hi; + unsigned long alloc = newsize * sizeof (struct bfd_hash_entry *); + + /* If we can't find a higher prime, or we can't possibly alloc + that much memory, don't try to grow the table. */ + if (newsize == 0 || alloc / sizeof (struct bfd_hash_entry *) != newsize) + { + table->frozen = 1; + return hashp; + } + + newtable = ((struct bfd_hash_entry **) + objalloc_alloc ((struct objalloc *) table->memory, alloc)); + memset ((PTR) newtable, 0, alloc); + + for (hi = 0; hi < table->size; hi ++) + while (table->table[hi]) + { + struct bfd_hash_entry *chain = table->table[hi]; + struct bfd_hash_entry *chain_end = chain; + int index; + + while (chain_end->next && chain_end->next->hash == chain->hash) + chain_end = chain_end->next; + + table->table[hi] = chain_end->next; + index = chain->hash % newsize; + chain_end->next = newtable[index]; + newtable[index] = chain; + } + table->table = newtable; + table->size = newsize; + } return hashp; } @@ -480,14 +573,17 @@ bfd_hash_traverse (struct bfd_hash_table *table, { unsigned int i; + table->frozen = 1; for (i = 0; i < table->size; i++) { struct bfd_hash_entry *p; for (p = table->table[i]; p != NULL; p = p->next) if (! (*func) (p, info)) - return; + goto out; } + out: + table->frozen = 0; } void diff --git a/contrib/binutils/bfd/host-aout.c b/contrib/binutils/bfd/host-aout.c index 902a0206696c..12e59510d86c 100644 --- a/contrib/binutils/bfd/host-aout.c +++ b/contrib/binutils/bfd/host-aout.c @@ -1,5 +1,5 @@ /* BFD backend for local host's a.out binaries - Copyright 1990, 1991, 1992, 1994, 1995, 2001 + Copyright 1990, 1991, 1992, 1994, 1995, 2001, 2007 Free Software Foundation, Inc. Written by Cygnus Support. Probably John Gilmore's fault. @@ -19,8 +19,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #define ARCH_SIZE 32 diff --git a/contrib/binutils/bfd/i386aout.c b/contrib/binutils/bfd/i386aout.c index 128e9d20dc04..936ffb21de15 100644 --- a/contrib/binutils/bfd/i386aout.c +++ b/contrib/binutils/bfd/i386aout.c @@ -1,6 +1,6 @@ /* BFD back-end for i386 a.out binaries. - Copyright 1990, 1991, 1992, 1994, 1996, 1997, 2001, 2002, 2003, 2005 - Free Software Foundation, Inc. + Copyright 1990, 1991, 1992, 1994, 1996, 1997, 2001, 2002, 2003, 2005, + 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -39,8 +39,8 @@ #define TARGETNAME "a.out-i386" #define NO_WRITE_HEADER_KLUDGE 1 -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "aout/aout64.h" #include "libaout.h" diff --git a/contrib/binutils/bfd/i386bsd.c b/contrib/binutils/bfd/i386bsd.c index 3f98ee4025cb..f8b109edae7b 100644 --- a/contrib/binutils/bfd/i386bsd.c +++ b/contrib/binutils/bfd/i386bsd.c @@ -1,5 +1,5 @@ /* BFD back-end for i386 a.out binaries under BSD. - Copyright 1990, 1991, 1992, 1993, 1994, 2001 + Copyright 1990, 1991, 1992, 1993, 1994, 2001, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -42,8 +42,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. #define MY(OP) CONCAT2 (i386bsd_,OP) #define TARGETNAME "a.out-i386-bsd" -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "libaout.h" diff --git a/contrib/binutils/bfd/i386linux.c b/contrib/binutils/bfd/i386linux.c index 17c618006ff3..83f9965a3c36 100644 --- a/contrib/binutils/bfd/i386linux.c +++ b/contrib/binutils/bfd/i386linux.c @@ -1,6 +1,6 @@ /* BFD back-end for linux flavored i386 a.out binaries. Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2001, 2002, 2003, - 2004, 2006 Free Software Foundation, Inc. + 2004, 2006, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -26,8 +26,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. #define MACHTYPE_OK(mtype) ((mtype) == M_386 || (mtype) == M_UNKNOWN) -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "aout/aout64.h" #include "aout/stab_gnu.h" @@ -93,8 +93,7 @@ i386linux_write_object_contents (abfd) #define GOT_REF_PREFIX "__GOT_" #endif -#define IS_GOT_SYM(name) \ - (strncmp (name, GOT_REF_PREFIX, sizeof GOT_REF_PREFIX - 1) == 0) +#define IS_GOT_SYM(name) (CONST_STRNEQ (name, GOT_REF_PREFIX)) /* See if a symbol name is a reference to the procedure linkage table. */ @@ -102,8 +101,7 @@ i386linux_write_object_contents (abfd) #define PLT_REF_PREFIX "__PLT_" #endif -#define IS_PLT_SYM(name) \ - (strncmp (name, PLT_REF_PREFIX, sizeof PLT_REF_PREFIX - 1) == 0) +#define IS_PLT_SYM(name) (CONST_STRNEQ (name, PLT_REF_PREFIX)) /* This string is used to generate specialized error messages. */ @@ -312,9 +310,8 @@ linux_link_create_dynamic_sections (abfd, info) /* We choose to use the name ".linux-dynamic" for the fixup table. Why not? */ - s = bfd_make_section (abfd, ".linux-dynamic"); + s = bfd_make_section_with_flags (abfd, ".linux-dynamic", flags); if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags) || ! bfd_set_section_alignment (abfd, s, 2)) return FALSE; s->size = 0; @@ -442,8 +439,7 @@ linux_tally_symbols (h, data) h = (struct linux_link_hash_entry *) h->root.root.u.i.link; if (h->root.root.type == bfd_link_hash_undefined - && strncmp (h->root.root.root.string, NEEDS_SHRLIB, - sizeof NEEDS_SHRLIB - 1) == 0) + && CONST_STRNEQ (h->root.root.root.string, NEEDS_SHRLIB)) { const char *name; char *p; diff --git a/contrib/binutils/bfd/ieee.c b/contrib/binutils/bfd/ieee.c index be8455c617f8..727869e669cb 100644 --- a/contrib/binutils/bfd/ieee.c +++ b/contrib/binutils/bfd/ieee.c @@ -1,6 +1,6 @@ /* BFD back-end for ieee-695 objects. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support. @@ -27,8 +27,8 @@ token (which is one byte in this lexicon) lookahead recursive decent parser. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "ieee.h" #include "libieee.h" @@ -370,7 +370,7 @@ parse_int (common_header_type *ieee, bfd_vma *value_ptr) static int parse_i (common_header_type *ieee, bfd_boolean *ok) { - bfd_vma x; + bfd_vma x = 0; *ok = parse_int (ieee, &x); return x; } @@ -378,7 +378,7 @@ parse_i (common_header_type *ieee, bfd_boolean *ok) static bfd_vma must_parse_int (common_header_type *ieee) { - bfd_vma result; + bfd_vma result = 0; BFD_ASSERT (parse_int (ieee, &result)); return result; } @@ -767,7 +767,7 @@ ieee_slurp_external_symbols (bfd *abfd) unsigned int symbol_name_index; unsigned int symbol_type_index; unsigned int symbol_attribute_def; - bfd_vma value; + bfd_vma value = 0; switch (read_2bytes (&ieee->h)) { @@ -1080,7 +1080,6 @@ get_section_entry (bfd *abfd, ieee_data_type *ieee, unsigned int index) sprintf (tmp, " fsec%4d", index); section = bfd_make_section (abfd, tmp); ieee->section_table[index] = section; - section->flags = SEC_NO_FLAGS; section->target_index = index; ieee->section_table[index] = section; } @@ -1268,14 +1267,15 @@ ieee_slurp_debug (bfd *abfd) ieee_data_type *ieee = IEEE_DATA (abfd); asection *sec; file_ptr debug_end; + flagword flags; if (ieee->w.r.debug_information_part == 0) return TRUE; - sec = bfd_make_section (abfd, ".debug"); + flags = SEC_DEBUGGING | SEC_HAS_CONTENTS; + sec = bfd_make_section_with_flags (abfd, ".debug", flags); if (sec == NULL) return FALSE; - sec->flags |= SEC_DEBUGGING | SEC_HAS_CONTENTS; sec->filepos = ieee->w.r.debug_information_part; debug_end = ieee_part_after (ieee, ieee->w.r.debug_information_part); @@ -1875,8 +1875,8 @@ ieee_object_p (bfd *abfd) family[9] = '\0'; } } - else if ((strncmp (processor, "cpu32", 5) == 0) /* CPU32 and CPU32+ */ - || (strncmp (processor, "CPU32", 5) == 0)) + else if ((CONST_STRNEQ (processor, "cpu32")) /* CPU32 and CPU32+ */ + || (CONST_STRNEQ (processor, "CPU32"))) strcpy (family, "68332"); else { @@ -2014,12 +2014,15 @@ ieee_print_symbol (bfd *abfd, static bfd_boolean ieee_new_section_hook (bfd *abfd, asection *newsect) { - newsect->used_by_bfd = bfd_alloc (abfd, (bfd_size_type) sizeof (ieee_per_section_type)); if (!newsect->used_by_bfd) - return FALSE; + { + newsect->used_by_bfd = bfd_alloc (abfd, sizeof (ieee_per_section_type)); + if (!newsect->used_by_bfd) + return FALSE; + } ieee_per_section (newsect)->data = NULL; ieee_per_section (newsect)->section = newsect; - return TRUE; + return _bfd_generic_new_section_hook (abfd, newsect); } static long @@ -3712,7 +3715,7 @@ ieee_generic_stat_arch_elt (bfd *abfd, struct stat *buf) static int ieee_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, - bfd_boolean x ATTRIBUTE_UNUSED) + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return 0; } @@ -3744,6 +3747,7 @@ ieee_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, #define ieee_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol #define ieee_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup +#define ieee_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup #define ieee_set_arch_mach _bfd_generic_set_arch_mach diff --git a/contrib/binutils/bfd/ihex.c b/contrib/binutils/bfd/ihex.c index fb2ab96c99ed..9f765b33f770 100644 --- a/contrib/binutils/bfd/ihex.c +++ b/contrib/binutils/bfd/ihex.c @@ -1,6 +1,6 @@ /* BFD back-end for Intel Hex objects. - Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 - Free Software Foundation, Inc. + Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + 2006, 2007 Free Software Foundation, Inc. Written by Ian Lance Taylor of Cygnus Support <ian@cygnus.com>. This file is part of BFD, the Binary File Descriptor library. @@ -118,8 +118,8 @@ The MRI compiler uses this, which is a repeat of type 5: 18..19 Checksum in hex notation 20..21 Carriage return, line feed. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "libiberty.h" #include "safe-ctype.h" @@ -355,6 +355,7 @@ ihex_scan (bfd *abfd) char secbuf[20]; char *secname; bfd_size_type amt; + flagword flags; sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1); amt = strlen (secbuf) + 1; @@ -362,10 +363,10 @@ ihex_scan (bfd *abfd) if (secname == NULL) goto error_return; strcpy (secname, secbuf); - sec = bfd_make_section (abfd, secname); + flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC; + sec = bfd_make_section_with_flags (abfd, secname, flags); if (sec == NULL) goto error_return; - sec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC; sec->vma = extbase + segbase + addr; sec->lma = extbase + segbase + addr; sec->size = len; @@ -553,7 +554,6 @@ ihex_read_section (bfd *abfd, asection *section, bfd_byte *contents) { char hdr[8]; unsigned int len; - bfd_vma addr; unsigned int type; unsigned int i; @@ -568,7 +568,6 @@ ihex_read_section (bfd *abfd, asection *section, bfd_byte *contents) goto error_return; len = HEX2 (hdr); - addr = HEX4 (hdr + 2); type = HEX2 (hdr + 6); /* We should only see type 0 records here. */ @@ -900,7 +899,8 @@ ihex_set_arch_mach (bfd *abfd, /* Get the size of the headers, for the linker. */ static int -ihex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean exec ATTRIBUTE_UNUSED) +ihex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return 0; } @@ -924,9 +924,6 @@ ihex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean exec ATTRIBUTE_UNUS #define ihex_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define ihex_read_minisymbols _bfd_nosymbols_read_minisymbols #define ihex_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol -#define ihex_get_reloc_upper_bound ((long (*) (bfd *, asection *)) bfd_0l) -#define ihex_canonicalize_reloc ((long (*) (bfd *, asection *, arelent **, asymbol **)) bfd_0l) -#define ihex_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup #define ihex_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents #define ihex_bfd_relax_section bfd_generic_relax_section #define ihex_bfd_gc_sections bfd_generic_gc_sections @@ -985,7 +982,7 @@ const bfd_target ihex_vec = BFD_JUMP_TABLE_CORE (_bfd_nocore), BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), BFD_JUMP_TABLE_SYMBOLS (ihex), - BFD_JUMP_TABLE_RELOCS (ihex), + BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), BFD_JUMP_TABLE_WRITE (ihex), BFD_JUMP_TABLE_LINK (ihex), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), diff --git a/contrib/binutils/bfd/init.c b/contrib/binutils/bfd/init.c index a34acbf9faf5..49f5533f2e21 100644 --- a/contrib/binutils/bfd/init.c +++ b/contrib/binutils/bfd/init.c @@ -1,5 +1,5 @@ /* bfd initialization stuff - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2003 + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2003, 2007 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support. @@ -19,8 +19,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" /* diff --git a/contrib/binutils/bfd/libaout.h b/contrib/binutils/bfd/libaout.h index bb3ee8082674..879de1380bd6 100644 --- a/contrib/binutils/bfd/libaout.h +++ b/contrib/binutils/bfd/libaout.h @@ -1,6 +1,6 @@ /* BFD back-end data structures for a.out (and similar) files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -525,6 +525,9 @@ extern void NAME (aout, swap_std_reloc_in) extern reloc_howto_type * NAME (aout, reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); +extern reloc_howto_type * NAME (aout, reloc_name_lookup) + (bfd *, const char *); + extern bfd_boolean NAME (aout, slurp_reloc_table) (bfd *, sec_ptr, asymbol **); @@ -557,7 +560,7 @@ extern asymbol * NAME (aout, minisymbol_to_symbol) (bfd *, bfd_boolean, const void *, asymbol *); extern int NAME (aout, sizeof_headers) - (bfd *, bfd_boolean); + (bfd *, struct bfd_link_info *); extern bfd_boolean NAME (aout, adjust_sizes_and_vmas) (bfd *, bfd_size_type *, file_ptr *); diff --git a/contrib/binutils/bfd/libbfd-in.h b/contrib/binutils/bfd/libbfd-in.h index ee2484f25c12..3555e6a8eefd 100644 --- a/contrib/binutils/bfd/libbfd-in.h +++ b/contrib/binutils/bfd/libbfd-in.h @@ -2,7 +2,7 @@ (This include file is not for users of the library.) Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -155,6 +155,8 @@ bfd * _bfd_new_bfd (void); void _bfd_delete_bfd (bfd *); +bfd_boolean _bfd_free_cached_info + (bfd *); bfd_boolean bfd_false (bfd *ignore); @@ -215,8 +217,8 @@ int bfd_generic_stat_arch_elt #define _bfd_generic_close_and_cleanup bfd_true #define _bfd_generic_bfd_free_cached_info bfd_true -#define _bfd_generic_new_section_hook \ - ((bfd_boolean (*) (bfd *, asection *)) bfd_true) +extern bfd_boolean _bfd_generic_new_section_hook + (bfd *, asection *); extern bfd_boolean _bfd_generic_get_section_contents (bfd *, asection *, void *, file_ptr, bfd_size_type); extern bfd_boolean _bfd_generic_get_section_contents_in_window @@ -346,12 +348,13 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table /* Routines to use for BFD_JUMP_TABLE_RELOCS when there is no reloc support. Use BFD_JUMP_TABLE_RELOCS (_bfd_norelocs). */ -#define _bfd_norelocs_get_reloc_upper_bound \ - ((long (*) (bfd *, asection *)) _bfd_n1) -#define _bfd_norelocs_canonicalize_reloc \ - ((long (*) (bfd *, asection *, arelent **, asymbol **)) _bfd_n1) +extern long _bfd_norelocs_get_reloc_upper_bound (bfd *, asection *); +extern long _bfd_norelocs_canonicalize_reloc (bfd *, asection *, + arelent **, asymbol **); #define _bfd_norelocs_bfd_reloc_type_lookup \ ((reloc_howto_type *(*) (bfd *, bfd_reloc_code_real_type)) bfd_nullvoidptr) +#define _bfd_norelocs_bfd_reloc_name_lookup \ + ((reloc_howto_type *(*) (bfd *, const char *)) bfd_nullvoidptr) /* Routines to use for BFD_JUMP_TABLE_WRITE for targets which may not be written. Use BFD_JUMP_TABLE_WRITE (_bfd_nowrite). */ @@ -373,7 +376,8 @@ extern bfd_boolean _bfd_generic_set_section_contents /* Routines to use for BFD_JUMP_TABLE_LINK for targets which do not support linking. Use BFD_JUMP_TABLE_LINK (_bfd_nolink). */ -#define _bfd_nolink_sizeof_headers ((int (*) (bfd *, bfd_boolean)) bfd_0) +#define _bfd_nolink_sizeof_headers \ + ((int (*) (bfd *, struct bfd_link_info *)) bfd_0) #define _bfd_nolink_bfd_get_relocated_section_contents \ ((bfd_byte *(*) (bfd *, struct bfd_link_info *, struct bfd_link_order *, \ bfd_byte *, bfd_boolean, asymbol **)) \ @@ -407,7 +411,7 @@ extern bfd_boolean _bfd_generic_set_section_contents #define _bfd_nolink_bfd_link_split_section \ ((bfd_boolean (*) (bfd *, struct bfd_section *)) bfd_false) #define _bfd_nolink_section_already_linked \ - ((void (*) (bfd *, struct bfd_section *)) bfd_void) + ((void (*) (bfd *, struct bfd_section *, struct bfd_link_info *)) bfd_void) /* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC @@ -521,7 +525,7 @@ extern bfd_boolean _bfd_generic_link_split_section (bfd *, struct bfd_section *); extern void _bfd_generic_section_already_linked - (bfd *, struct bfd_section *); + (bfd *, struct bfd_section *, struct bfd_link_info *); /* Generic reloc_link_order processing routine. */ extern bfd_boolean _bfd_generic_reloc_link_order @@ -544,6 +548,10 @@ extern bfd_reloc_status_type _bfd_final_link_relocate extern bfd_reloc_status_type _bfd_relocate_contents (reloc_howto_type *, bfd *, bfd_vma, bfd_byte *); +/* Clear a given location using a given howto. */ +extern void _bfd_clear_contents (reloc_howto_type *howto, bfd *input_bfd, + bfd_byte *location); + /* Link stabs in sections in the first pass. */ extern bfd_boolean _bfd_link_section_stabs diff --git a/contrib/binutils/bfd/libbfd.c b/contrib/binutils/bfd/libbfd.c index 57cfabcd460e..7dada1cbf531 100644 --- a/contrib/binutils/bfd/libbfd.c +++ b/contrib/binutils/bfd/libbfd.c @@ -1,6 +1,6 @@ /* Assorted BFD support routines, only used internally. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005 + 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -20,8 +20,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #ifndef HAVE_GETPAGESIZE @@ -103,6 +103,23 @@ bfd_void (bfd *ignore ATTRIBUTE_UNUSED) { } +long +_bfd_norelocs_get_reloc_upper_bound (bfd *abfd ATTRIBUTE_UNUSED, + asection *sec ATTRIBUTE_UNUSED) +{ + return sizeof (arelent *); +} + +long +_bfd_norelocs_canonicalize_reloc (bfd *abfd ATTRIBUTE_UNUSED, + asection *sec ATTRIBUTE_UNUSED, + arelent **relptr, + asymbol **symbols ATTRIBUTE_UNUSED) +{ + *relptr = NULL; + return 0; +} + bfd_boolean _bfd_nocore_core_file_matches_executable_p (bfd *ignore_core_bfd ATTRIBUTE_UNUSED, diff --git a/contrib/binutils/bfd/libbfd.h b/contrib/binutils/bfd/libbfd.h index 2a590a395a51..4c1414f826fa 100644 --- a/contrib/binutils/bfd/libbfd.h +++ b/contrib/binutils/bfd/libbfd.h @@ -7,7 +7,7 @@ (This include file is not for users of the library.) Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -160,6 +160,8 @@ bfd * _bfd_new_bfd (void); void _bfd_delete_bfd (bfd *); +bfd_boolean _bfd_free_cached_info + (bfd *); bfd_boolean bfd_false (bfd *ignore); @@ -220,8 +222,8 @@ int bfd_generic_stat_arch_elt #define _bfd_generic_close_and_cleanup bfd_true #define _bfd_generic_bfd_free_cached_info bfd_true -#define _bfd_generic_new_section_hook \ - ((bfd_boolean (*) (bfd *, asection *)) bfd_true) +extern bfd_boolean _bfd_generic_new_section_hook + (bfd *, asection *); extern bfd_boolean _bfd_generic_get_section_contents (bfd *, asection *, void *, file_ptr, bfd_size_type); extern bfd_boolean _bfd_generic_get_section_contents_in_window @@ -351,12 +353,13 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table /* Routines to use for BFD_JUMP_TABLE_RELOCS when there is no reloc support. Use BFD_JUMP_TABLE_RELOCS (_bfd_norelocs). */ -#define _bfd_norelocs_get_reloc_upper_bound \ - ((long (*) (bfd *, asection *)) _bfd_n1) -#define _bfd_norelocs_canonicalize_reloc \ - ((long (*) (bfd *, asection *, arelent **, asymbol **)) _bfd_n1) +extern long _bfd_norelocs_get_reloc_upper_bound (bfd *, asection *); +extern long _bfd_norelocs_canonicalize_reloc (bfd *, asection *, + arelent **, asymbol **); #define _bfd_norelocs_bfd_reloc_type_lookup \ ((reloc_howto_type *(*) (bfd *, bfd_reloc_code_real_type)) bfd_nullvoidptr) +#define _bfd_norelocs_bfd_reloc_name_lookup \ + ((reloc_howto_type *(*) (bfd *, const char *)) bfd_nullvoidptr) /* Routines to use for BFD_JUMP_TABLE_WRITE for targets which may not be written. Use BFD_JUMP_TABLE_WRITE (_bfd_nowrite). */ @@ -378,7 +381,8 @@ extern bfd_boolean _bfd_generic_set_section_contents /* Routines to use for BFD_JUMP_TABLE_LINK for targets which do not support linking. Use BFD_JUMP_TABLE_LINK (_bfd_nolink). */ -#define _bfd_nolink_sizeof_headers ((int (*) (bfd *, bfd_boolean)) bfd_0) +#define _bfd_nolink_sizeof_headers \ + ((int (*) (bfd *, struct bfd_link_info *)) bfd_0) #define _bfd_nolink_bfd_get_relocated_section_contents \ ((bfd_byte *(*) (bfd *, struct bfd_link_info *, struct bfd_link_order *, \ bfd_byte *, bfd_boolean, asymbol **)) \ @@ -412,7 +416,7 @@ extern bfd_boolean _bfd_generic_set_section_contents #define _bfd_nolink_bfd_link_split_section \ ((bfd_boolean (*) (bfd *, struct bfd_section *)) bfd_false) #define _bfd_nolink_section_already_linked \ - ((void (*) (bfd *, struct bfd_section *)) bfd_void) + ((void (*) (bfd *, struct bfd_section *, struct bfd_link_info *)) bfd_void) /* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC @@ -526,7 +530,7 @@ extern bfd_boolean _bfd_generic_link_split_section (bfd *, struct bfd_section *); extern void _bfd_generic_section_already_linked - (bfd *, struct bfd_section *); + (bfd *, struct bfd_section *, struct bfd_link_info *); /* Generic reloc_link_order processing routine. */ extern bfd_boolean _bfd_generic_reloc_link_order @@ -549,6 +553,10 @@ extern bfd_reloc_status_type _bfd_final_link_relocate extern bfd_reloc_status_type _bfd_relocate_contents (reloc_howto_type *, bfd *, bfd_vma, bfd_byte *); +/* Clear a given location using a given howto. */ +extern void _bfd_clear_contents (reloc_howto_type *howto, bfd *input_bfd, + bfd_byte *location); + /* Link stabs in sections in the first pass. */ extern bfd_boolean _bfd_link_section_stabs @@ -899,6 +907,20 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_SPARC_TLS_DTPOFF64", "BFD_RELOC_SPARC_TLS_TPOFF32", "BFD_RELOC_SPARC_TLS_TPOFF64", + "BFD_RELOC_SPU_IMM7", + "BFD_RELOC_SPU_IMM8", + "BFD_RELOC_SPU_IMM10", + "BFD_RELOC_SPU_IMM10W", + "BFD_RELOC_SPU_IMM16", + "BFD_RELOC_SPU_IMM16W", + "BFD_RELOC_SPU_IMM18", + "BFD_RELOC_SPU_PCREL9a", + "BFD_RELOC_SPU_PCREL9b", + "BFD_RELOC_SPU_PCREL16", + "BFD_RELOC_SPU_LO16", + "BFD_RELOC_SPU_HI16", + "BFD_RELOC_SPU_PPU32", + "BFD_RELOC_SPU_PPU64", "BFD_RELOC_ALPHA_GPDISP_HI16", "BFD_RELOC_ALPHA_GPDISP_LO16", "BFD_RELOC_ALPHA_GPDISP", @@ -1206,6 +1228,14 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_ARM_SBREL32", "BFD_RELOC_ARM_TARGET2", "BFD_RELOC_ARM_PREL31", + "BFD_RELOC_ARM_MOVW", + "BFD_RELOC_ARM_MOVT", + "BFD_RELOC_ARM_MOVW_PCREL", + "BFD_RELOC_ARM_MOVT_PCREL", + "BFD_RELOC_ARM_THUMB_MOVW", + "BFD_RELOC_ARM_THUMB_MOVT", + "BFD_RELOC_ARM_THUMB_MOVW_PCREL", + "BFD_RELOC_ARM_THUMB_MOVT_PCREL", "BFD_RELOC_ARM_JUMP_SLOT", "BFD_RELOC_ARM_GLOB_DAT", "BFD_RELOC_ARM_GOT32", @@ -1221,9 +1251,38 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_ARM_TLS_TPOFF32", "BFD_RELOC_ARM_TLS_IE32", "BFD_RELOC_ARM_TLS_LE32", + "BFD_RELOC_ARM_ALU_PC_G0_NC", + "BFD_RELOC_ARM_ALU_PC_G0", + "BFD_RELOC_ARM_ALU_PC_G1_NC", + "BFD_RELOC_ARM_ALU_PC_G1", + "BFD_RELOC_ARM_ALU_PC_G2", + "BFD_RELOC_ARM_LDR_PC_G0", + "BFD_RELOC_ARM_LDR_PC_G1", + "BFD_RELOC_ARM_LDR_PC_G2", + "BFD_RELOC_ARM_LDRS_PC_G0", + "BFD_RELOC_ARM_LDRS_PC_G1", + "BFD_RELOC_ARM_LDRS_PC_G2", + "BFD_RELOC_ARM_LDC_PC_G0", + "BFD_RELOC_ARM_LDC_PC_G1", + "BFD_RELOC_ARM_LDC_PC_G2", + "BFD_RELOC_ARM_ALU_SB_G0_NC", + "BFD_RELOC_ARM_ALU_SB_G0", + "BFD_RELOC_ARM_ALU_SB_G1_NC", + "BFD_RELOC_ARM_ALU_SB_G1", + "BFD_RELOC_ARM_ALU_SB_G2", + "BFD_RELOC_ARM_LDR_SB_G0", + "BFD_RELOC_ARM_LDR_SB_G1", + "BFD_RELOC_ARM_LDR_SB_G2", + "BFD_RELOC_ARM_LDRS_SB_G0", + "BFD_RELOC_ARM_LDRS_SB_G1", + "BFD_RELOC_ARM_LDRS_SB_G2", + "BFD_RELOC_ARM_LDC_SB_G0", + "BFD_RELOC_ARM_LDC_SB_G1", + "BFD_RELOC_ARM_LDC_SB_G2", "BFD_RELOC_ARM_IMMEDIATE", "BFD_RELOC_ARM_ADRL_IMMEDIATE", "BFD_RELOC_ARM_T32_IMMEDIATE", + "BFD_RELOC_ARM_T32_ADD_IMM", "BFD_RELOC_ARM_T32_IMM12", "BFD_RELOC_ARM_T32_ADD_PC12", "BFD_RELOC_ARM_SHIFT_IMM", @@ -1473,6 +1532,27 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_MCORE_PCREL_32", "BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2", "BFD_RELOC_MCORE_RVA", + "BFD_RELOC_MEP_8", + "BFD_RELOC_MEP_16", + "BFD_RELOC_MEP_32", + "BFD_RELOC_MEP_PCREL8A2", + "BFD_RELOC_MEP_PCREL12A2", + "BFD_RELOC_MEP_PCREL17A2", + "BFD_RELOC_MEP_PCREL24A2", + "BFD_RELOC_MEP_PCABS24A2", + "BFD_RELOC_MEP_LOW16", + "BFD_RELOC_MEP_HI16U", + "BFD_RELOC_MEP_HI16S", + "BFD_RELOC_MEP_GPREL", + "BFD_RELOC_MEP_TPREL", + "BFD_RELOC_MEP_TPREL7", + "BFD_RELOC_MEP_TPREL7A2", + "BFD_RELOC_MEP_TPREL7A4", + "BFD_RELOC_MEP_UIMM24", + "BFD_RELOC_MEP_ADDR24A4", + "BFD_RELOC_MEP_GNU_VTINHERIT", + "BFD_RELOC_MEP_GNU_VTENTRY", + "BFD_RELOC_MMIX_GETA", "BFD_RELOC_MMIX_GETA_1", "BFD_RELOC_MMIX_GETA_2", @@ -1509,7 +1589,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_AVR_HH8_LDI_NEG", "BFD_RELOC_AVR_MS8_LDI_NEG", "BFD_RELOC_AVR_LO8_LDI_PM", + "BFD_RELOC_AVR_LO8_LDI_GS", "BFD_RELOC_AVR_HI8_LDI_PM", + "BFD_RELOC_AVR_HI8_LDI_GS", "BFD_RELOC_AVR_HH8_LDI_PM", "BFD_RELOC_AVR_LO8_LDI_PM_NEG", "BFD_RELOC_AVR_HI8_LDI_PM_NEG", @@ -1568,6 +1650,17 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_390_GOT20", "BFD_RELOC_390_GOTPLT20", "BFD_RELOC_390_TLS_GOTIE20", + "BFD_RELOC_SCORE_DUMMY1", + "BFD_RELOC_SCORE_GPREL15", + "BFD_RELOC_SCORE_DUMMY2", + "BFD_RELOC_SCORE_JMP", + "BFD_RELOC_SCORE_BRANCH", + "BFD_RELOC_SCORE16_JMP", + "BFD_RELOC_SCORE16_BRANCH", + "BFD_RELOC_SCORE_GOT15", + "BFD_RELOC_SCORE_GOT_LO16", + "BFD_RELOC_SCORE_CALL15", + "BFD_RELOC_SCORE_DUMMY_HI16", "BFD_RELOC_IP2K_FR9", "BFD_RELOC_IP2K_BANK", "BFD_RELOC_IP2K_ADDR16CJP", @@ -1712,6 +1805,33 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_16C_IMM24_C", "BFD_RELOC_16C_IMM32", "BFD_RELOC_16C_IMM32_C", + "BFD_RELOC_CR16_NUM8", + "BFD_RELOC_CR16_NUM16", + "BFD_RELOC_CR16_NUM32", + "BFD_RELOC_CR16_NUM32a", + "BFD_RELOC_CR16_REGREL0", + "BFD_RELOC_CR16_REGREL4", + "BFD_RELOC_CR16_REGREL4a", + "BFD_RELOC_CR16_REGREL14", + "BFD_RELOC_CR16_REGREL14a", + "BFD_RELOC_CR16_REGREL16", + "BFD_RELOC_CR16_REGREL20", + "BFD_RELOC_CR16_REGREL20a", + "BFD_RELOC_CR16_ABS20", + "BFD_RELOC_CR16_ABS24", + "BFD_RELOC_CR16_IMM4", + "BFD_RELOC_CR16_IMM8", + "BFD_RELOC_CR16_IMM16", + "BFD_RELOC_CR16_IMM20", + "BFD_RELOC_CR16_IMM24", + "BFD_RELOC_CR16_IMM32", + "BFD_RELOC_CR16_IMM32a", + "BFD_RELOC_CR16_DISP4", + "BFD_RELOC_CR16_DISP8", + "BFD_RELOC_CR16_DISP16", + "BFD_RELOC_CR16_DISP20", + "BFD_RELOC_CR16_DISP24", + "BFD_RELOC_CR16_DISP24a", "BFD_RELOC_CRX_REL4", "BFD_RELOC_CRX_REL8", "BFD_RELOC_CRX_REL8_CMP", @@ -1796,6 +1916,8 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_XSTORMY16_12", "BFD_RELOC_XSTORMY16_24", "BFD_RELOC_XSTORMY16_FPTR16", + "BFD_RELOC_RELC", + "BFD_RELOC_XC16X_PAG", "BFD_RELOC_XC16X_POF", "BFD_RELOC_XC16X_SEG", diff --git a/contrib/binutils/bfd/libcoff-in.h b/contrib/binutils/bfd/libcoff-in.h index f2bc264b3b9f..fdb1a59b8141 100644 --- a/contrib/binutils/bfd/libcoff-in.h +++ b/contrib/binutils/bfd/libcoff-in.h @@ -348,7 +348,7 @@ extern bfd_boolean coff_find_nearest_line extern bfd_boolean coff_find_inliner_info (bfd *, const char **, const char **, unsigned int *); extern int coff_sizeof_headers - (bfd *, bfd_boolean); + (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_coff_reloc16_relax_section (bfd *, asection *, struct bfd_link_info *, bfd_boolean *); extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents diff --git a/contrib/binutils/bfd/libcoff.h b/contrib/binutils/bfd/libcoff.h index f756f30b1bf6..e26fce06415e 100644 --- a/contrib/binutils/bfd/libcoff.h +++ b/contrib/binutils/bfd/libcoff.h @@ -352,7 +352,7 @@ extern bfd_boolean coff_find_nearest_line extern bfd_boolean coff_find_inliner_info (bfd *, const char **, const char **, unsigned int *); extern int coff_sizeof_headers - (bfd *, bfd_boolean); + (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_coff_reloc16_relax_section (bfd *, asection *, struct bfd_link_info *, bfd_boolean *); extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents diff --git a/contrib/binutils/bfd/libecoff.h b/contrib/binutils/bfd/libecoff.h index 8c5e218ee58d..165e75585a30 100644 --- a/contrib/binutils/bfd/libecoff.h +++ b/contrib/binutils/bfd/libecoff.h @@ -1,6 +1,6 @@ /* BFD ECOFF object file private structure. Copyright 1993, 1994, 1995, 1996, 1999, 2001, 2002, 2003, 2004, - 2005 Free Software Foundation, Inc. + 2005, 2006 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -301,7 +301,7 @@ extern bfd_boolean _bfd_ecoff_set_arch_mach extern bfd_boolean _bfd_ecoff_set_section_contents (bfd *, asection *, const void * location, file_ptr, bfd_size_type); -extern int _bfd_ecoff_sizeof_headers (bfd *, bfd_boolean); +extern int _bfd_ecoff_sizeof_headers (bfd *, struct bfd_link_info *); /* ecoff_bfd_get_relocated_section_contents defined by backend. */ /* ecoff_bfd_relax_section defined by backend. */ extern struct bfd_link_hash_table *_bfd_ecoff_bfd_link_hash_table_create diff --git a/contrib/binutils/bfd/libpei.h b/contrib/binutils/bfd/libpei.h index f0f6580fe4ba..0e08e039bc04 100644 --- a/contrib/binutils/bfd/libpei.h +++ b/contrib/binutils/bfd/libpei.h @@ -1,5 +1,5 @@ /* Support for the generic parts of PE/PEI; common header information. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005 + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc. Written by Cygnus Solutions. @@ -204,7 +204,38 @@ #define PUT_SCNHDR_LNNOPTR H_PUT_32 #endif -#ifdef COFF_WITH_pep +#ifdef COFF_WITH_pex64 + +#define GET_OPTHDR_IMAGE_BASE H_GET_64 +#define PUT_OPTHDR_IMAGE_BASE H_PUT_64 +#define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_64 +#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_64 +#define GET_OPTHDR_SIZE_OF_STACK_COMMIT H_GET_64 +#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT H_PUT_64 +#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE H_GET_64 +#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE H_PUT_64 +#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT H_GET_64 +#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT H_PUT_64 +#define GET_PDATA_ENTRY bfd_get_32 + +#define _bfd_XX_bfd_copy_private_bfd_data_common _bfd_pex64_bfd_copy_private_bfd_data_common +#define _bfd_XX_bfd_copy_private_section_data _bfd_pex64_bfd_copy_private_section_data +#define _bfd_XX_get_symbol_info _bfd_pex64_get_symbol_info +#define _bfd_XX_only_swap_filehdr_out _bfd_pex64_only_swap_filehdr_out +#define _bfd_XX_print_private_bfd_data_common _bfd_pex64_print_private_bfd_data_common +#define _bfd_XXi_final_link_postscript _bfd_pex64i_final_link_postscript +#define _bfd_XXi_only_swap_filehdr_out _bfd_pex64i_only_swap_filehdr_out +#define _bfd_XXi_swap_aouthdr_in _bfd_pex64i_swap_aouthdr_in +#define _bfd_XXi_swap_aouthdr_out _bfd_pex64i_swap_aouthdr_out +#define _bfd_XXi_swap_aux_in _bfd_pex64i_swap_aux_in +#define _bfd_XXi_swap_aux_out _bfd_pex64i_swap_aux_out +#define _bfd_XXi_swap_lineno_in _bfd_pex64i_swap_lineno_in +#define _bfd_XXi_swap_lineno_out _bfd_pex64i_swap_lineno_out +#define _bfd_XXi_swap_scnhdr_out _bfd_pex64i_swap_scnhdr_out +#define _bfd_XXi_swap_sym_in _bfd_pex64i_swap_sym_in +#define _bfd_XXi_swap_sym_out _bfd_pex64i_swap_sym_out + +#elif defined COFF_WITH_pep #define GET_OPTHDR_IMAGE_BASE H_GET_64 #define PUT_OPTHDR_IMAGE_BASE H_PUT_64 @@ -224,7 +255,6 @@ #define _bfd_XX_only_swap_filehdr_out _bfd_pep_only_swap_filehdr_out #define _bfd_XX_print_private_bfd_data_common _bfd_pep_print_private_bfd_data_common #define _bfd_XXi_final_link_postscript _bfd_pepi_final_link_postscript -#define _bfd_XXi_final_link_postscript _bfd_pepi_final_link_postscript #define _bfd_XXi_only_swap_filehdr_out _bfd_pepi_only_swap_filehdr_out #define _bfd_XXi_swap_aouthdr_in _bfd_pepi_swap_aouthdr_in #define _bfd_XXi_swap_aouthdr_out _bfd_pepi_swap_aouthdr_out @@ -256,7 +286,6 @@ #define _bfd_XX_only_swap_filehdr_out _bfd_pe_only_swap_filehdr_out #define _bfd_XX_print_private_bfd_data_common _bfd_pe_print_private_bfd_data_common #define _bfd_XXi_final_link_postscript _bfd_pei_final_link_postscript -#define _bfd_XXi_final_link_postscript _bfd_pei_final_link_postscript #define _bfd_XXi_only_swap_filehdr_out _bfd_pei_only_swap_filehdr_out #define _bfd_XXi_swap_aouthdr_in _bfd_pei_swap_aouthdr_in #define _bfd_XXi_swap_aouthdr_out _bfd_pei_swap_aouthdr_out @@ -270,10 +299,27 @@ #endif /* !COFF_WITH_pep */ -/* Macro: Returns true if the bfd is a PE executable as opposed to a PE object file. */ -#define bfd_pe_executable_p(abfd) \ - (strncmp ((abfd)->xvec->name, "pei-", 4) == 0 \ - || strncmp ((abfd)->xvec->name, "efi-app-", 8) == 0) +/* Returns true if the target is a PE executable target. */ +#define bfd_target_pei_p(xvec) \ + (CONST_STRNEQ ((xvec)->name, "pei-")) + +/* Return the arch string of a PE executable target. */ +#define bfd_target_pei_arch(xvec) \ + ((xvec)->name + sizeof ("pei-") - 1) + +/* Returns true if the target is an EFI target. */ +#define bfd_target_efi_p(xvec) \ + (CONST_STRNEQ ((xvec)->name, "efi-app-")) + +/* Return the arch string of an EFI target. */ +#define bfd_target_efi_arch(xvec) \ + ((xvec)->name + sizeof ("efi-app-") - 1) + +/* Macro: Returns true if the bfd is a PE executable as opposed to a + PE object file. */ +#define bfd_pe_executable_p(abfd) \ + (bfd_target_pei_p ((abfd)->xvec) \ + || bfd_target_efi_p ((abfd)->xvec)) /* These functions are architecture dependent, and are in peicode.h: coff_swap_reloc_in diff --git a/contrib/binutils/bfd/linker.c b/contrib/binutils/bfd/linker.c index 14eeae4df0c8..497b5c235565 100644 --- a/contrib/binutils/bfd/linker.c +++ b/contrib/binutils/bfd/linker.c @@ -1,6 +1,7 @@ /* linker.c -- BFD linker routines Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + 2003, 2004, 2005, 2006, 2007 + Free Software Foundation, Inc. Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support This file is part of BFD, the Binary File Descriptor library. @@ -19,8 +20,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "bfdlink.h" #include "genlink.h" @@ -562,11 +563,11 @@ bfd_wrapped_link_hash_lookup (bfd *abfd, #undef WRAP -#undef REAL +#undef REAL #define REAL "__real_" if (*l == '_' - && strncmp (l, REAL, sizeof REAL - 1) == 0 + && CONST_STRNEQ (l, REAL) && bfd_hash_lookup (info->wrap_hash, l + sizeof REAL - 1, FALSE, FALSE) != NULL) { @@ -1659,8 +1660,7 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info, s = name + 1; while (*s == '_') ++s; - if (s[0] == 'G' - && strncmp (s, CONS_PREFIX, CONS_PREFIX_LEN - 1) == 0) + if (s[0] == 'G' && CONST_STRNEQ (s, CONS_PREFIX)) { char c; @@ -2877,14 +2877,15 @@ FUNCTION bfd_section_already_linked SYNOPSIS - void bfd_section_already_linked (bfd *abfd, asection *sec); + void bfd_section_already_linked (bfd *abfd, asection *sec, + struct bfd_link_info *info); DESCRIPTION Check if @var{sec} has been already linked during a reloceatable or final link. -.#define bfd_section_already_linked(abfd, sec) \ -. BFD_SEND (abfd, _section_already_linked, (abfd, sec)) +.#define bfd_section_already_linked(abfd, sec, info) \ +. BFD_SEND (abfd, _section_already_linked, (abfd, sec, info)) . */ @@ -2970,7 +2971,8 @@ bfd_section_already_linked_table_free (void) /* This is used on non-ELF inputs. */ void -_bfd_generic_section_already_linked (bfd *abfd, asection *sec) +_bfd_generic_section_already_linked (bfd *abfd, asection *sec, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { flagword flags; const char *name; @@ -3074,7 +3076,7 @@ _bfd_generic_section_already_linked (bfd *abfd, asection *sec) bfd_section_already_linked_table_insert (already_linked_list, sec); } -/* Convert symbols in excluded output sections to absolute. */ +/* Convert symbols in excluded output sections to use a kept section. */ static bfd_boolean fix_syms (struct bfd_link_hash_entry *h, void *data) @@ -3093,8 +3095,64 @@ fix_syms (struct bfd_link_hash_entry *h, void *data) && (s->output_section->flags & SEC_EXCLUDE) != 0 && bfd_section_removed_from_list (obfd, s->output_section)) { + asection *op, *op1; + h->u.def.value += s->output_offset + s->output_section->vma; - h->u.def.section = bfd_abs_section_ptr; + + /* Find preceding kept section. */ + for (op1 = s->output_section->prev; op1 != NULL; op1 = op1->prev) + if ((op1->flags & SEC_EXCLUDE) == 0 + && !bfd_section_removed_from_list (obfd, op1)) + break; + + /* Find following kept section. Start at prev->next because + other sections may have been added after S was removed. */ + if (s->output_section->prev != NULL) + op = s->output_section->prev->next; + else + op = s->output_section->owner->sections; + for (; op != NULL; op = op->next) + if ((op->flags & SEC_EXCLUDE) == 0 + && !bfd_section_removed_from_list (obfd, op)) + break; + + /* Choose better of two sections, based on flags. The idea + is to choose a section that will be in the same segment + as S would have been if it was kept. */ + if (op1 == NULL) + { + if (op == NULL) + op = bfd_abs_section_ptr; + } + else if (op == NULL) + op = op1; + else if (((op1->flags ^ op->flags) + & (SEC_ALLOC | SEC_THREAD_LOCAL)) != 0) + { + if (((op->flags ^ s->flags) + & (SEC_ALLOC | SEC_THREAD_LOCAL)) != 0) + op = op1; + } + else if (((op1->flags ^ op->flags) & SEC_READONLY) != 0) + { + if (((op->flags ^ s->flags) & SEC_READONLY) != 0) + op = op1; + } + else if (((op1->flags ^ op->flags) & SEC_CODE) != 0) + { + if (((op->flags ^ s->flags) & SEC_CODE) != 0) + op = op1; + } + else + { + /* Flags we care about are the same. Prefer the following + section if that will result in a positive valued sym. */ + if (h->u.def.value < op->vma) + op = op1; + } + + h->u.def.value -= op->vma; + h->u.def.section = op; } } diff --git a/contrib/binutils/bfd/mep-relocs.pl b/contrib/binutils/bfd/mep-relocs.pl new file mode 100755 index 000000000000..d227b8252c0c --- /dev/null +++ b/contrib/binutils/bfd/mep-relocs.pl @@ -0,0 +1,274 @@ +#!/usr/bin/perl +# -*- perl -*- +# +# Toshiba MeP Media Engine Relocation Generator +# Copyright (C) 2001, 2007 Free Software Foundation, Inc. +# This file is part of BFD. +# Originally written by DJ Delorie <dj@redhat.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + + +# Usage: Run this anywhere inside your source tree. It will read +# include/elf/mep.h and scan the comments therein. It will renumber +# the relocs to be sequential (this is needed so that bfd/elf32-mep.h +# works) if needed. It will then update the reloc list in bfd/reloc.c +# and the howto, mapping, and apply routines in bfd/elf32-mep.c. You +# can then regenerate bfd-in2.h and check everything in. + +# FIXME: After the relocation list is finalized, change this to +# *verify* the reloc list, rather than resequence it. + +while (! -f "include/elf/mep.h" && ! -f "bfd/reloc.c") { + chdir ".."; + $pwd = `pwd`; + if ($pwd !~ m@/.*/@) { + print STDERR "Cannot find include/elf/mep.h or bfd/reloc.h\n"; + exit 1; + } +} +$pwd = `pwd`; +print "srctop is $pwd"; + +printf "Reading include/elf/mep.h ...\n"; +open(MEPH, "include/elf/mep.h"); +open(MEPHO, "> include/elf/mep.h.new") || die("mep.h.new create: $!"); +$val = 0; +while (<MEPH>) { + if (($pre,$rel,$rest) = /(.*RELOC_NUMBER \()([^,]+), *\d+(.*)/) { + $rest =~ s/[\r\n]+$//; + print (MEPHO "$pre$rel, $val$rest\n") || die("mep.h.new write: $!"); + $val ++; + $rel =~ s/R_MEP_//; + push(@relocs, $rel); + + $rest =~ s@.*/\* @@; + ($pattern, $sign, $attrs) = $rest =~ m@(.*) ([US]) (.*)\*/@; + $pattern =~ s/ //g; + push(@pattern, $pattern); + push(@sign, $sign); + push(@attrs, $attrs); + + printf "%4d $rel p=`$pattern' s=`$sign' a=`$attrs'\n", $#pattern; + + } else { + print(MEPHO) || die("mep.h.new write: $!"); + } +} +close(MEPH); +close(MEPHO) || die("mep.h.new close: $!"); + +&swapfile("include/elf/mep.h"); + +redo_file ("bfd/reloc.c", + "", + "ENUMDOC\n Toshiba Media Processor Relocations.\n\nCOMMENT\n", + "ENUM\n BFD_RELOC_MEP_%s\n", + ""); + +$autogen = " /* This section generated from bfd/mep-relocs.pl from include/elf/mep.h. */\n"; + +redo_file ("bfd/elf32-mep.c", + "MEPRELOC:HOWTO", + $autogen, + "MEPRELOC:END", + "", + "&emit_howto();", + "MEPRELOC:MAP", + $autogen, + "MEPRELOC:END", + "", + " MAP(%s);\n", + "MEPRELOC:APPLY", + $autogen, + "MEPRELOC:END", + "", + "&emit_apply();", + ); + +sub mask2shifts { + my ($mask) = @_; + my ($bits, $left, $right, $ci, $c, $cv); + $bits = 0; + $left = 0; + $right = 32; + for ($ci=0; $ci<length($mask); $ci++) { + $c = substr($mask, $ci, 1); + $left++; + next if $c eq '-'; + $left = 0; + $cv = ord($c) - ord('0'); + $cv -= ord('a') - ord('9') - 1 if $cv > 9; + $right = $cv unless $right < $cv; + $bits = $cv+1 unless $bits > $cv+1; + } + $mask =~ tr/-/1/c; + $mask =~ tr/-/0/; + ($rmask = $mask) =~ tr/01/10/; + $mask = unpack("H*", pack("B*", $mask)); + $rmask = unpack("H*", pack("B*", $rmask)); + return ($bits, $left, $right, $mask, $rmask); +} + +sub emit_howto { + for ($i=2; $i<=$#relocs; $i++) { + $mask = $pattern[$i]; + + if (length($mask) == 8) { $bytesize = 0; } + elsif (length($mask) == 16) { $bytesize = 1; } + elsif (length($mask) == 32) { $bytesize = 2; } + + ($bits, $left, $right, $mask) = mask2shifts ($mask); + $bits[$i] = $bits; + $pcrel = 0; + $pcrel = 1 if $attrs[$i] =~ /pc-rel/i; + $overflow = $sign[$i]; + $overflow = 'N' if $attrs[$i] =~ /no-overflow/; + + $c = "$relocs[$i],"; + printf(NEW " MEPREL (R_MEP_%-10s%d,%3d,%2d,%2d,%2d,%2s, 0x%s),\n", + $c, $bytesize, $bits, $left, $right, $pcrel, $overflow, $mask); + } +} + +sub emit_apply { + for ($i=2; $i<=$#relocs; $i++) { + $v = "u"; + $v = "s" if $sign[$i] =~ /S/; + if (length($pattern[$i]) == 8) { + $e = ''; # no endian swap for bytes + } elsif ($pattern[$i] =~ /-/ || length($pattern[$i]) == 16) { + $e = '^e2'; # endian swap - 2byte words only + } else { + $e = '^e4' # endian swap for data + } + print NEW " case R_MEP_$relocs[$i]: /* $pattern[$i] */\n"; + if ($attrs[$i] =~ /tp-rel/i) { + print NEW " $v -= mep_tpoff_base(rel->r_offset);\n"; + } + if ($attrs[$i] =~ /gp-rel/i) { + print NEW " $v -= mep_sdaoff_base(rel->r_offset);\n"; + } + if ($attrs[$i] !~ /no-overflow/ && $bits[$i] < 32) { + if ($v eq "u") { + $max = (1 << $bits[$i]) - 1; + print NEW " if (u > $max) r = bfd_reloc_overflow;\n"; + } else { + $min = -(1 << ($bits[$i]-1)); + $max = (1 << ($bits[$i]-1)) - 1; + print NEW " if ($min > s || s > $max) r = bfd_reloc_overflow;\n"; + } + } + for ($b=0; $b<length($pattern[$i]); $b += 8) { + $mask = substr($pattern[$i], $b, 8); + ($bits, $left, $right, $mask, $rmask) = mask2shifts ($mask); + if ($left > $right) { $left -= $right; $right = 0; } + else { $right -= $left; $left = 0; } + + if ($mask ne "00") { + $bb = $b / 8; + print NEW " byte[$bb$e] = "; + print NEW "(byte[$bb$e] & 0x$rmask) | " if $rmask ne "00"; + if ($left) { + print NEW "(($v << $left) & 0x$mask)"; + } elsif ($right) { + print NEW "(($v >> $right) & 0x$mask)"; + } else { + print NEW "($v & 0x$mask)"; + } + print NEW ";\n"; + } + } + print NEW " break;\n"; + } +} + + +#----------------------------------------------------------------------------- + +sub redo_file { + my ($file, @control) = @_; + open(OLD, $file); + open(NEW, "> $file.new") || die("$file.new create: $!"); + + print "Scanning file $file ...\n"; + + while (1) { + $start = shift @control; + $prefix = shift @control; + $end = shift @control; + $suffix = shift @control; + $pattern = shift @control; + + if (!$start) { + print NEW while <OLD>; + last; + } + + print " looking for $start\n"; + while (<OLD>) { + print NEW; + last if /\Q$start\E/; + } + print "can't find $start\n" unless $_; + last unless $_; + + print NEW $prefix; + if ($pattern =~ /^\&/) { + eval $pattern; + die("$pattern: $@") if $@; + } else { + for $i (2..$#relocs) { + printf (NEW "$pattern", $relocs[$i]) || die("$file.new write: $!"); + $pattern =~ s/^ENUM\n/ENUMX\n/; + } + } + print NEW $suffix; + while (<OLD>) { + last if /\Q$end\E/; + } + print NEW; + } + + close(OLD); + close(NEW) || die("$file.new close: $!"); + &swapfile($file); +} + +#----------------------------------------------------------------------------- + +sub swapfile { + my ($f) = @_; + if ( ! -f "$f.save") { + system "cp $f $f.save"; + } + open(ORIG, $f); + open(NEW, "$f.new"); + while (<ORIG>) { + $n = <NEW>; + if ($n ne $_) { + close(ORIG); + close(NEW); + print " Updating $f\n"; + rename "$f", "$f.old"; + rename "$f.new", "$f"; + return; + } + } + close(ORIG); + close(NEW); + print " No change to $f\n"; + unlink "$f.new"; +} diff --git a/contrib/binutils/bfd/merge.c b/contrib/binutils/bfd/merge.c index c1795d29112f..71b31d378b50 100644 --- a/contrib/binutils/bfd/merge.c +++ b/contrib/binutils/bfd/merge.c @@ -1,5 +1,5 @@ /* SEC_MERGE support. - Copyright 2001, 2002, 2003, 2004, 2005, 2006 + Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Jakub Jelinek <jakub@redhat.com>. @@ -22,8 +22,8 @@ /* This file contains support for merging duplicate entities within sections, as used in ELF SHF_MERGE. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "hashtab.h" #include "libiberty.h" @@ -766,7 +766,7 @@ _bfd_merge_sections (bfd *abfd ATTRIBUTE_UNUSED, the hash table at all. */ for (secinfo = sinfo->chain; secinfo; secinfo = secinfo->next) if (secinfo->first_str == NULL) - secinfo->sec->flags |= SEC_EXCLUDE; + secinfo->sec->flags |= SEC_EXCLUDE | SEC_KEEP; } return TRUE; diff --git a/contrib/binutils/bfd/mipsbsd.c b/contrib/binutils/bfd/mipsbsd.c index b8621e486ae1..6edb9728361c 100644 --- a/contrib/binutils/bfd/mipsbsd.c +++ b/contrib/binutils/bfd/mipsbsd.c @@ -1,6 +1,6 @@ /* BFD backend for MIPS BSD (a.out) binaries. - Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, + 2007 Free Software Foundation, Inc. Written by Ralph Campbell. This file is part of BFD, the Binary File Descriptor library. @@ -40,8 +40,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. the tokens. */ #define MY(OP) CONCAT2 (mipsbsd_,OP) -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "libaout.h" @@ -56,7 +56,8 @@ static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd)); /* We can't use MY(x) here because it leads to a recursive call to CONCAT2 when expanded inside JUMP_TABLE. */ -#define MY_bfd_reloc_type_lookup mipsbsd_reloc_howto_type_lookup +#define MY_bfd_reloc_type_lookup mipsbsd_reloc_type_lookup +#define MY_bfd_reloc_name_lookup mipsbsd_reloc_name_lookup #define MY_canonicalize_reloc mipsbsd_canonicalize_reloc #define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create @@ -72,8 +73,6 @@ static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd)); static bfd_reloc_status_type mips_fix_jmp_addr PARAMS ((bfd *, arelent *, struct bfd_symbol *, PTR, asection *, bfd *, char **)); -static reloc_howto_type *MY(reloc_howto_type_lookup) - PARAMS ((bfd *, bfd_reloc_code_real_type)); long MY(canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); @@ -302,9 +301,7 @@ static reloc_howto_type mips_howto_table_ext[] = { }; static reloc_howto_type * -MY(reloc_howto_type_lookup) (abfd, code) - bfd *abfd; - bfd_reloc_code_real_type code; +MY(reloc_type_lookup) (bfd *abfd, bfd_reloc_code_real_type code) { if (bfd_get_arch (abfd) != bfd_arch_mips) @@ -330,6 +327,22 @@ MY(reloc_howto_type_lookup) (abfd, code) } } +static reloc_howto_type * +MY(reloc_name_lookup) (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (mips_howto_table_ext) / sizeof (mips_howto_table_ext[0]); + i++) + if (mips_howto_table_ext[i].name != NULL + && strcasecmp (mips_howto_table_ext[i].name, r_name) == 0) + return &mips_howto_table_ext[i]; + + return NULL; +} + /* This is just like the standard aoutx.h version but we need to do our own mapping of external reloc type values to howto entries. */ long diff --git a/contrib/binutils/bfd/netbsd-core.c b/contrib/binutils/bfd/netbsd-core.c index e9111a985010..913e862f9a4b 100644 --- a/contrib/binutils/bfd/netbsd-core.c +++ b/contrib/binutils/bfd/netbsd-core.c @@ -1,6 +1,6 @@ /* BFD back end for NetBSD style core files Copyright 1988, 1989, 1991, 1992, 1993, 1996, 1998, 1999, 2000, 2001, - 2002, 2003, 2004, 2005 + 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Paul Kranenburg, EUR @@ -20,8 +20,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "libaout.h" /* BFD a.out internal data structures. */ @@ -126,11 +126,10 @@ netbsd_core_file_p (bfd *abfd) flags = SEC_ALLOC + SEC_HAS_CONTENTS; break; } - asect = bfd_make_section_anyway (abfd, sname); + asect = bfd_make_section_anyway_with_flags (abfd, sname, flags); if (asect == NULL) goto punt; - asect->flags = flags; asect->size = coreseg.c_size; asect->vma = coreseg.c_addr; asect->filepos = offset; @@ -159,11 +158,12 @@ netbsd_core_file_p (bfd *abfd) asect->size = wcookie_offset; /* And create the .wcookie section. */ - asect = bfd_make_section_anyway (abfd, ".wcookie"); + flags = SEC_ALLOC + SEC_HAS_CONTENTS; + asect = bfd_make_section_anyway_with_flags (abfd, ".wcookie", + flags); if (asect == NULL) goto punt; - asect->flags = SEC_ALLOC + SEC_HAS_CONTENTS; asect->size = coreseg.c_size - wcookie_offset; asect->vma = 0; asect->filepos = offset + wcookie_offset; diff --git a/contrib/binutils/bfd/netbsd.h b/contrib/binutils/bfd/netbsd.h index 92f6a7d2fd19..7182eda90475 100644 --- a/contrib/binutils/bfd/netbsd.h +++ b/contrib/binutils/bfd/netbsd.h @@ -1,6 +1,6 @@ /* BFD back-end definitions used by all NetBSD targets. - Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2002, 2005 - Free Software Foundation, Inc. + Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2002, + 2005, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -50,8 +50,8 @@ ((exec).a_info = \ ((exec).a_info & 0x03ffffff) | ((flags & 0x03f) << 26)) -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "libaout.h" diff --git a/contrib/binutils/bfd/opncls.c b/contrib/binutils/bfd/opncls.c index b02b137889a1..4457a797cf4e 100644 --- a/contrib/binutils/bfd/opncls.c +++ b/contrib/binutils/bfd/opncls.c @@ -1,6 +1,6 @@ /* opncls.c -- open and close a BFD. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, - 2001, 2002, 2003, 2004, 2005, 2006 + 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -21,8 +21,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "objalloc.h" #include "libbfd.h" #include "libiberty.h" @@ -115,11 +115,35 @@ _bfd_new_bfd_contained_in (bfd *obfd) void _bfd_delete_bfd (bfd *abfd) { - bfd_hash_table_free (&abfd->section_htab); - objalloc_free ((struct objalloc *) abfd->memory); + if (abfd->memory) + { + bfd_hash_table_free (&abfd->section_htab); + objalloc_free ((struct objalloc *) abfd->memory); + } free (abfd); } +/* Free objalloc memory. */ + +bfd_boolean +_bfd_free_cached_info (bfd *abfd) +{ + if (abfd->memory) + { + bfd_hash_table_free (&abfd->section_htab); + objalloc_free ((struct objalloc *) abfd->memory); + + abfd->sections = NULL; + abfd->section_last = NULL; + abfd->outsymbols = NULL; + abfd->tdata.any = NULL; + abfd->usrdata = NULL; + abfd->memory = NULL; + } + + return TRUE; +} + /* SECTION Opening and closing BFDs @@ -360,7 +384,10 @@ SYNOPSIS file_ptr nbytes, file_ptr offset), int (*close) (struct bfd *nbfd, - void *stream)); + void *stream), + int (*stat) (struct bfd *abfd, + void *stream, + struct stat *sb)); DESCRIPTION @@ -387,6 +414,10 @@ DESCRIPTION <<bfd_close>>. @var{close} either succeeds returning 0, or fails returning -1 (setting <<bfd_error>>). + Calls @var{stat} to fill in a stat structure for bfd_stat, + bfd_get_size, and bfd_get_mtime calls. @var{stat} returns 0 + on success, or returns -1 on failure (setting <<bfd_error>>). + If <<bfd_openr_iovec>> returns <<NULL>> then an error has occurred. Possible errors are <<bfd_error_no_memory>>, <<bfd_error_invalid_target>> and <<bfd_error_system_call>>. @@ -399,6 +430,7 @@ struct opncls file_ptr (*pread) (struct bfd *abfd, void *stream, void *buf, file_ptr nbytes, file_ptr offset); int (*close) (struct bfd *abfd, void *stream); + int (*stat) (struct bfd *abfd, void *stream, struct stat *sb); file_ptr where; }; @@ -461,10 +493,15 @@ opncls_bflush (struct bfd *abfd ATTRIBUTE_UNUSED) } static int -opncls_bstat (struct bfd *abfd ATTRIBUTE_UNUSED, struct stat *sb) +opncls_bstat (struct bfd *abfd, struct stat *sb) { + struct opncls *vec = abfd->iostream; + memset (sb, 0, sizeof (*sb)); - return 0; + if (vec->stat == NULL) + return 0; + + return (vec->stat) (abfd, vec->stream, sb); } static const struct bfd_iovec opncls_iovec = { @@ -483,7 +520,10 @@ bfd_openr_iovec (const char *filename, const char *target, file_ptr nbytes, file_ptr offset), int (*close) (struct bfd *nbfd, - void *stream)) + void *stream), + int (*stat) (struct bfd *abfd, + void *stream, + struct stat *sb)) { bfd *nbfd; const bfd_target *target_vec; @@ -515,6 +555,7 @@ bfd_openr_iovec (const char *filename, const char *target, vec->stream = stream; vec->pread = pread; vec->close = close; + vec->stat = stat; nbfd->iovec = &opncls_iovec; nbfd->iostream = vec; @@ -1321,6 +1362,7 @@ bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename) { asection *sect; bfd_size_type debuglink_size; + flagword flags; if (abfd == NULL || filename == NULL) { @@ -1339,16 +1381,11 @@ bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename) return NULL; } - sect = bfd_make_section (abfd, GNU_DEBUGLINK); + flags = SEC_HAS_CONTENTS | SEC_READONLY | SEC_DEBUGGING; + sect = bfd_make_section_with_flags (abfd, GNU_DEBUGLINK, flags); if (sect == NULL) return NULL; - if (! bfd_set_section_flags (abfd, sect, - SEC_HAS_CONTENTS | SEC_READONLY | SEC_DEBUGGING)) - /* XXX Should we delete the section from the bfd ? */ - return NULL; - - debuglink_size = strlen (filename) + 1; debuglink_size += 3; debuglink_size &= ~3; diff --git a/contrib/binutils/bfd/osf-core.c b/contrib/binutils/bfd/osf-core.c index cc6c4dccd002..b9472abe3904 100644 --- a/contrib/binutils/bfd/osf-core.c +++ b/contrib/binutils/bfd/osf-core.c @@ -1,6 +1,6 @@ /* BFD back-end for OSF/1 core files. - Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002, 2003, 2004 - Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002, 2003, 2004, 2006, + 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -21,8 +21,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. /* This file can only be compiled on systems which use OSF/1 style core files. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include <sys/user.h> @@ -67,11 +67,10 @@ make_bfd_asection (abfd, name, flags, size, vma, filepos) { asection *asect; - asect = bfd_make_section_anyway (abfd, name); + asect = bfd_make_section_anyway_with_flags (abfd, name, flags); if (!asect) return NULL; - asect->flags = flags; asect->size = size; asect->vma = vma; asect->filepos = filepos; @@ -95,7 +94,7 @@ osf_core_core_file_p (abfd) if (val != sizeof core_header) return NULL; - if (strncmp (core_header.magic, "Core", 4) != 0) + if (! CONST_STRNEQ (core_header.magic, "Core")) return NULL; core_hdr (abfd) = (struct osf_core_struct *) diff --git a/contrib/binutils/bfd/pe-arm-wince.c b/contrib/binutils/bfd/pe-arm-wince.c new file mode 100644 index 000000000000..a13594fd8949 --- /dev/null +++ b/contrib/binutils/bfd/pe-arm-wince.c @@ -0,0 +1,37 @@ +/* BFD back-end for ARM WINCE PE files. + Copyright 2006 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#define TARGET_UNDERSCORE 0 +#define USER_LABEL_PREFIX "" + +#define TARGET_LITTLE_SYM arm_wince_pe_little_vec +#define TARGET_LITTLE_NAME "pe-arm-wince-little" +#define TARGET_BIG_SYM arm_wince_pe_big_vec +#define TARGET_BIG_NAME "pe-arm-wince-big" + +#define bfd_arm_allocate_interworking_sections \ + bfd_arm_wince_pe_allocate_interworking_sections +#define bfd_arm_get_bfd_for_interworking \ + bfd_arm_wince_pe_get_bfd_for_interworking +#define bfd_arm_process_before_allocation \ + bfd_arm_wince_pe_process_before_allocation + +#define LOCAL_LABEL_PREFIX "." + +#include "pe-arm.c" diff --git a/contrib/binutils/bfd/pe-arm.c b/contrib/binutils/bfd/pe-arm.c index dba9c1b40e48..5700e2382a80 100644 --- a/contrib/binutils/bfd/pe-arm.c +++ b/contrib/binutils/bfd/pe-arm.c @@ -1,5 +1,6 @@ /* BFD back-end for ARM PECOFF files. - Copyright 1995, 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1995, 1996, 1999, 2000, 2001, 2002, 2007 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -17,8 +18,19 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" +/* Do this before including bfd.h, so we prototype the right functions. */ + +#ifndef bfd_arm_allocate_interworking_sections +#define bfd_arm_allocate_interworking_sections \ + bfd_armpe_allocate_interworking_sections +#define bfd_arm_get_bfd_for_interworking \ + bfd_armpe_get_bfd_for_interworking +#define bfd_arm_process_before_allocation \ + bfd_armpe_process_before_allocation +#endif + #include "sysdep.h" +#include "bfd.h" #ifndef TARGET_LITTLE_SYM #define TARGET_LITTLE_SYM armpe_little_vec @@ -31,17 +43,22 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. #define PCRELOFFSET TRUE #define COFF_LONG_SECTION_NAMES -#ifndef bfd_arm_allocate_interworking_sections -#define bfd_arm_allocate_interworking_sections \ - bfd_arm_pe_allocate_interworking_sections -#define bfd_arm_get_bfd_for_interworking \ - bfd_arm_pe_get_bfd_for_interworking -#define bfd_arm_process_before_allocation \ - bfd_arm_pe_process_before_allocation -#endif - -#ifdef ARM_WINCE -#define TARGET_UNDERSCORE 0 -#endif +#define COFF_SECTION_ALIGNMENT_ENTRIES \ +{ COFF_SECTION_NAME_EXACT_MATCH (".bss"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".rdata"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".debug"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 } #include "coff-arm.c" diff --git a/contrib/binutils/bfd/pe-i386.c b/contrib/binutils/bfd/pe-i386.c index 7c102b42de84..72aacf0a8936 100644 --- a/contrib/binutils/bfd/pe-i386.c +++ b/contrib/binutils/bfd/pe-i386.c @@ -1,5 +1,6 @@ /* BFD back-end for Intel 386 PECOFF files. - Copyright 1995, 1996, 1999, 2001, 2002, 2004 Free Software Foundation, Inc. + Copyright 1995, 1996, 1999, 2001, 2002, 2004, 2007 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -17,8 +18,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #define TARGET_SYM i386pe_vec #define TARGET_NAME "pe-i386" @@ -34,10 +35,16 @@ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ { COFF_SECTION_NAME_EXACT_MATCH (".data"), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".data$"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ { COFF_SECTION_NAME_EXACT_MATCH (".rdata"), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".rdata$"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ { COFF_SECTION_NAME_EXACT_MATCH (".text"), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".text$"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ { COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ { COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \ diff --git a/contrib/binutils/bfd/pe-mips.c b/contrib/binutils/bfd/pe-mips.c index 03d6beca981c..628cecf9a71b 100644 --- a/contrib/binutils/bfd/pe-mips.c +++ b/contrib/binutils/bfd/pe-mips.c @@ -1,6 +1,6 @@ /* BFD back-end for MIPS PE COFF files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Modified from coff-i386.c by DJ Delorie, dj@cygnus.com This file is part of BFD, the Binary File Descriptor library. @@ -23,8 +23,8 @@ #define COFF_LONG_SECTION_NAMES #define PCRELOFFSET TRUE -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "coff/mipspe.h" #include "coff/internal.h" @@ -453,6 +453,7 @@ coff_mips_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, #define coff_rtype_to_howto coff_mips_rtype_to_howto #define coff_bfd_reloc_type_lookup coff_mips_reloc_type_lookup +#define coff_bfd_reloc_name_lookup coff_mips_reloc_name_lookup /* Get the howto structure for a generic reloc type. */ @@ -496,6 +497,22 @@ coff_mips_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return & howto_table [mips_type]; } +static reloc_howto_type * +coff_mips_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (howto_table) / sizeof (howto_table[0]); + i++) + if (howto_table[i].name != NULL + && strcasecmp (howto_table[i].name, r_name) == 0) + return &howto_table[i]; + + return NULL; +} + static void mips_swap_reloc_in (bfd * abfd, void * src, void * dst) { diff --git a/contrib/binutils/bfd/pe-ppc.c b/contrib/binutils/bfd/pe-ppc.c index 93cf6367c6e7..fa6404e4a34c 100644 --- a/contrib/binutils/bfd/pe-ppc.c +++ b/contrib/binutils/bfd/pe-ppc.c @@ -1,5 +1,5 @@ /* BFD back-end for PowerPC PECOFF files. - Copyright 1995, 1996, 1999, 2001 Free Software Foundation, Inc. + Copyright 1995, 1996, 1999, 2001, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,8 +18,8 @@ along with this program; if not, write to the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #define E_FILENMLEN 18 diff --git a/contrib/binutils/bfd/pe-x86_64.c b/contrib/binutils/bfd/pe-x86_64.c new file mode 100644 index 000000000000..0c6badf1a36b --- /dev/null +++ b/contrib/binutils/bfd/pe-x86_64.c @@ -0,0 +1,53 @@ +/* BFD back-end for Intel/AMD x86_64 PECOFF files. + Copyright 2006, 2007 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + + Written by Kai Tietz, OneVision Software GmbH&CoKg. */ + +#include "sysdep.h" +#include "bfd.h" + +#define TARGET_SYM x86_64pe_vec +#define TARGET_NAME "pe-x86-64" +#define COFF_WITH_PE +#define COFF_WITH_pex64 +#define PCRELOFFSET TRUE +#define TARGET_UNDERSCORE '_' +#define COFF_LONG_SECTION_NAMES +#define COFF_SUPPORT_GNU_LINKONCE +#define COFF_LONG_FILENAMES + +#define COFF_SECTION_ALIGNMENT_ENTRIES \ +{ COFF_SECTION_NAME_EXACT_MATCH (".bss"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".rdata"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".debug"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 } + +#include "coff-x86_64.c" diff --git a/contrib/binutils/bfd/peXXigen.c b/contrib/binutils/bfd/peXXigen.c index 71300219d303..f96825f687e8 100644 --- a/contrib/binutils/bfd/peXXigen.c +++ b/contrib/binutils/bfd/peXXigen.c @@ -1,6 +1,6 @@ /* Support for the generic parts of PE/PEI; the common executable parts. Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006 Free Software Foundation, Inc. + 2005, 2006, 2007 Free Software Foundation, Inc. Written by Cygnus Solutions. This file is part of BFD, the Binary File Descriptor library. @@ -52,12 +52,12 @@ on this code has a chance of getting something accomplished without wasting too much time. */ -/* This expands into COFF_WITH_pe or COFF_WITH_pep depending on whether - we're compiling for straight PE or PE+. */ +/* This expands into COFF_WITH_pe, COFF_WITH_pep, or COFF_WITH_pex64 + depending on whether we're compiling for straight PE or PE+. */ #define COFF_WITH_XX -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "coff/internal.h" @@ -67,7 +67,9 @@ within PE/PEI, so we get them from there. FIXME: The lack of variance is an assumption which may prove to be incorrect if new PE/PEI targets are created. */ -#ifdef COFF_WITH_pep +#if defined COFF_WITH_pex64 +# include "coff/x86_64.h" +#elif defined COFF_WITH_pep # include "coff/ia64.h" #else # include "coff/i386.h" @@ -77,7 +79,7 @@ #include "libcoff.h" #include "libpei.h" -#ifdef COFF_WITH_pep +#if defined COFF_WITH_pep || defined COFF_WITH_pex64 # undef AOUTSZ # define AOUTSZ PEPAOUTSZ # define PEAOUTHDR PEPAOUTHDR @@ -147,6 +149,7 @@ _bfd_XXi_swap_sym_in (bfd * abfd, void * ext1, void * in1) int unused_section_number = 0; asection *sec; char *name; + flagword flags; for (sec = abfd->sections; sec; sec = sec->next) if (unused_section_number <= sec->target_index) @@ -156,7 +159,8 @@ _bfd_XXi_swap_sym_in (bfd * abfd, void * ext1, void * in1) if (name == NULL) return; strcpy (name, in->n_name); - sec = bfd_make_section_anyway (abfd, name); + flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_DATA | SEC_LOAD; + sec = bfd_make_section_anyway_with_flags (abfd, name, flags); sec->vma = 0; sec->lma = 0; @@ -169,7 +173,6 @@ _bfd_XXi_swap_sym_in (bfd * abfd, void * ext1, void * in1) sec->userdata = NULL; sec->next = NULL; sec->alignment_power = 2; - sec->flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_DATA | SEC_LOAD; sec->target_index = unused_section_number; @@ -385,10 +388,11 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd, void * aouthdr_ext1, void * aouthdr_int1) { - struct internal_extra_pe_aouthdr *a; - PEAOUTHDR * src = (PEAOUTHDR *) (aouthdr_ext1); + PEAOUTHDR * src = (PEAOUTHDR *) aouthdr_ext1; AOUTHDR * aouthdr_ext = (AOUTHDR *) aouthdr_ext1; - struct internal_aouthdr *aouthdr_int = (struct internal_aouthdr *)aouthdr_int1; + struct internal_aouthdr *aouthdr_int + = (struct internal_aouthdr *) aouthdr_int1; + struct internal_extra_pe_aouthdr *a = &aouthdr_int->pe; aouthdr_int->magic = H_GET_16 (abfd, aouthdr_ext->magic); aouthdr_int->vstamp = H_GET_16 (abfd, aouthdr_ext->vstamp); @@ -398,13 +402,21 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd, aouthdr_int->entry = GET_AOUTHDR_ENTRY (abfd, aouthdr_ext->entry); aouthdr_int->text_start = GET_AOUTHDR_TEXT_START (abfd, aouthdr_ext->text_start); -#ifndef COFF_WITH_pep +#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) /* PE32+ does not have data_start member! */ aouthdr_int->data_start = GET_AOUTHDR_DATA_START (abfd, aouthdr_ext->data_start); + a->BaseOfData = aouthdr_int->data_start; #endif - a = &aouthdr_int->pe; + a->Magic = aouthdr_int->magic; + a->MajorLinkerVersion = H_GET_8 (abfd, aouthdr_ext->vstamp); + a->MinorLinkerVersion = H_GET_8 (abfd, aouthdr_ext->vstamp + 1); + a->SizeOfCode = aouthdr_int->tsize ; + a->SizeOfInitializedData = aouthdr_int->dsize ; + a->SizeOfUninitializedData = aouthdr_int->bsize ; + a->AddressOfEntryPoint = aouthdr_int->entry; + a->BaseOfCode = aouthdr_int->text_start; a->ImageBase = GET_OPTHDR_IMAGE_BASE (abfd, src->ImageBase); a->SectionAlignment = H_GET_32 (abfd, src->SectionAlignment); a->FileAlignment = H_GET_32 (abfd, src->FileAlignment); @@ -441,6 +453,7 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd, /* If data directory is empty, rva also should be 0. */ int size = H_GET_32 (abfd, src->DataDirectory[idx][1]); + a->DataDirectory[idx].Size = size; if (size) @@ -454,7 +467,7 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd, if (aouthdr_int->entry) { aouthdr_int->entry += a->ImageBase; -#ifndef COFF_WITH_pep +#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) aouthdr_int->entry &= 0xffffffff; #endif } @@ -462,12 +475,12 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd, if (aouthdr_int->tsize) { aouthdr_int->text_start += a->ImageBase; -#ifndef COFF_WITH_pep +#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) aouthdr_int->text_start &= 0xffffffff; #endif } -#ifndef COFF_WITH_pep +#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) /* PE32+ does not have data_start member! */ if (aouthdr_int->dsize) { @@ -480,9 +493,9 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd, /* These three fields are normally set up by ppc_relocate_section. In the case of reading a file in, we can pick them up from the DataDirectory. */ - first_thunk_address = a->DataDirectory[12].VirtualAddress; - thunk_size = a->DataDirectory[12].Size; - import_table_size = a->DataDirectory[1].Size; + first_thunk_address = a->DataDirectory[PE_IMPORT_ADDRESS_TABLE].VirtualAddress; + thunk_size = a->DataDirectory[PE_IMPORT_ADDRESS_TABLE].Size; + import_table_size = a->DataDirectory[PE_IMPORT_TABLE].Size; #endif } @@ -540,14 +553,14 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, void * in, void * out) fa = extra->FileAlignment; ib = extra->ImageBase; - idata2 = pe->pe_opthdr.DataDirectory[1]; - idata5 = pe->pe_opthdr.DataDirectory[12]; - tls = pe->pe_opthdr.DataDirectory[9]; + idata2 = pe->pe_opthdr.DataDirectory[PE_IMPORT_TABLE]; + idata5 = pe->pe_opthdr.DataDirectory[PE_IMPORT_ADDRESS_TABLE]; + tls = pe->pe_opthdr.DataDirectory[PE_TLS_TABLE]; if (aouthdr_in->tsize) { aouthdr_in->text_start -= ib; -#ifndef COFF_WITH_pep +#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) aouthdr_in->text_start &= 0xffffffff; #endif } @@ -555,7 +568,7 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, void * in, void * out) if (aouthdr_in->dsize) { aouthdr_in->data_start -= ib; -#ifndef COFF_WITH_pep +#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) aouthdr_in->data_start &= 0xffffffff; #endif } @@ -563,7 +576,7 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, void * in, void * out) if (aouthdr_in->entry) { aouthdr_in->entry -= ib; -#ifndef COFF_WITH_pep +#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) aouthdr_in->entry &= 0xffffffff; #endif } @@ -592,11 +605,11 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, void * in, void * out) So - we copy the input values into the output values, and then, if a final link is going to be performed, it can overwrite them. */ - extra->DataDirectory[1] = idata2; - extra->DataDirectory[12] = idata5; - extra->DataDirectory[9] = tls; + extra->DataDirectory[PE_IMPORT_TABLE] = idata2; + extra->DataDirectory[PE_IMPORT_ADDRESS_TABLE] = idata5; + extra->DataDirectory[PE_TLS_TABLE] = tls; - if (extra->DataDirectory[1].VirtualAddress == 0) + if (extra->DataDirectory[PE_IMPORT_TABLE].VirtualAddress == 0) /* Until other .idata fixes are made (pending patch), the entry for .idata is needed for backwards compatibility. FIXME. */ add_data_entry (abfd, extra, 1, ".idata", ib); @@ -632,16 +645,22 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, void * in, void * out) in the virt_size field). Files have been seen (from MSVC 5.0 link.exe) where the file size of the .data segment is quite small compared to the virtual size. Without this - fix, strip munges the file. */ + fix, strip munges the file. + + FIXME: We need to handle holes between sections, which may + happpen when we covert from another format. We just use + the virtual address and virtual size of the last section + for the image size. */ if (coff_section_data (abfd, sec) != NULL && pei_section_data (abfd, sec) != NULL) - isize += SA (FA (pei_section_data (abfd, sec)->virt_size)); + isize = (sec->vma - extra->ImageBase + + SA (FA (pei_section_data (abfd, sec)->virt_size))); } aouthdr_in->dsize = dsize; aouthdr_in->tsize = tsize; extra->SizeOfHeaders = hsize; - extra->SizeOfImage = SA (hsize) + isize; + extra->SizeOfImage = isize; } H_PUT_16 (abfd, aouthdr_in->magic, aouthdr_out->standard.magic); @@ -660,7 +679,7 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, void * in, void * out) PUT_AOUTHDR_TEXT_START (abfd, aouthdr_in->text_start, aouthdr_out->standard.text_start); -#ifndef COFF_WITH_pep +#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) /* PE32+ does not have data_start member! */ PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start, aouthdr_out->standard.data_start); @@ -1017,7 +1036,7 @@ static char * dir_names[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] = N_("Bound Import Directory"), N_("Import Address Table Directory"), N_("Delay Import Directory"), - N_("Reserved"), + N_("CLR Runtime Header"), N_("Reserved") }; @@ -1051,9 +1070,9 @@ pe_print_idata (bfd * abfd, void * vfile) bfd_vma addr; - addr = extra->DataDirectory[1].VirtualAddress; + addr = extra->DataDirectory[PE_IMPORT_TABLE].VirtualAddress; - if (addr == 0 && extra->DataDirectory[1].Size == 0) + if (addr == 0 && extra->DataDirectory[PE_IMPORT_TABLE].Size == 0) { /* Maybe the extra header isn't there. Look for the section. */ section = bfd_get_section_by_name (abfd, ".idata"); @@ -1171,7 +1190,7 @@ pe_print_idata (bfd * abfd, void * vfile) bfd_size_type j; char *dll; - /* Print (i + extra->DataDirectory[1].VirtualAddress). */ + /* Print (i + extra->DataDirectory[PE_IMPORT_TABLE].VirtualAddress). */ fprintf (file, " %08lx\t", (unsigned long) (i + adj + dataoff)); hint_addr = bfd_get_32 (abfd, data + i + dataoff); time_stamp = bfd_get_32 (abfd, data + i + 4 + dataoff); @@ -1212,8 +1231,8 @@ pe_print_idata (bfd * abfd, void * vfile) ft_data = data; ft_idx = first_thunk - adj; ft_allocated = 0; - - if (first_thunk != hint_addr) + + if (first_thunk != hint_addr) { /* Find the section which contains the first thunk. */ for (ft_section = abfd->sections; @@ -1261,6 +1280,38 @@ pe_print_idata (bfd * abfd, void * vfile) } /* Print HintName vector entries. */ +#ifdef COFF_WITH_pex64 + for (j = 0; j < datasize; j += 8) + { + unsigned long member = bfd_get_32 (abfd, data + idx + j); + unsigned long member_high = bfd_get_32 (abfd, data + idx + j + 4); + + if (!member && !member_high) + break; + + if (member_high & 0x80000000) + fprintf (file, "\t%lx%08lx\t %4lx%08lx <none>", + member_high,member, member_high & 0x7fffffff, member); + else + { + int ordinal; + char *member_name; + + ordinal = bfd_get_16 (abfd, data + member - adj); + member_name = (char *) data + member - adj + 2; + fprintf (file, "\t%04lx\t %4d %s",member, ordinal, member_name); + } + + /* If the time stamp is not zero, the import address + table holds actual addresses. */ + if (time_stamp != 0 + && first_thunk != 0 + && first_thunk != hint_addr) + fprintf (file, "\t%04lx", + (long) bfd_get_32 (abfd, ft_data + ft_idx + j)); + fprintf (file, "\n"); + } +#else for (j = 0; j < datasize; j += 4) { unsigned long member = bfd_get_32 (abfd, data + idx + j); @@ -1293,7 +1344,7 @@ pe_print_idata (bfd * abfd, void * vfile) fprintf (file, "\n"); } - +#endif if (ft_allocated) free (ft_data); } @@ -1336,9 +1387,9 @@ pe_print_edata (bfd * abfd, void * vfile) bfd_vma addr; - addr = extra->DataDirectory[0].VirtualAddress; + addr = extra->DataDirectory[PE_EXPORT_TABLE].VirtualAddress; - if (addr == 0 && extra->DataDirectory[0].Size == 0) + if (addr == 0 && extra->DataDirectory[PE_EXPORT_TABLE].Size == 0) { /* Maybe the extra header isn't there. Look for the section. */ section = bfd_get_section_by_name (abfd, ".edata"); @@ -1367,7 +1418,7 @@ pe_print_edata (bfd * abfd, void * vfile) } dataoff = addr - section->vma; - datasize = extra->DataDirectory[0].Size; + datasize = extra->DataDirectory[PE_EXPORT_TABLE].Size; if (datasize > section->size - dataoff) { fprintf (file, @@ -1533,10 +1584,10 @@ pe_print_edata (bfd * abfd, void * vfile) static bfd_boolean pe_print_pdata (bfd * abfd, void * vfile) { -#ifdef COFF_WITH_pep -# define PDATA_ROW_SIZE (3*8) +#if defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) +# define PDATA_ROW_SIZE (3 * 8) #else -# define PDATA_ROW_SIZE (5*4) +# define PDATA_ROW_SIZE (5 * 4) #endif FILE *file = (FILE *) vfile; bfd_byte *data = 0; @@ -1559,7 +1610,7 @@ pe_print_pdata (bfd * abfd, void * vfile) fprintf (file, _("\nThe Function Table (interpreted .pdata section contents)\n")); -#ifdef COFF_WITH_pep +#if defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) fprintf (file, _(" vma:\t\t\tBegin Address End Address Unwind Info\n")); #else @@ -1613,7 +1664,7 @@ pe_print_pdata (bfd * abfd, void * vfile) fprintf_vma (file, begin_addr); fputc (' ', file); fprintf_vma (file, end_addr); fputc (' ', file); fprintf_vma (file, eh_handler); -#ifndef COFF_WITH_pep +#if !defined(COFF_WITH_pep) || defined(COFF_WITH_pex64) fputc (' ', file); fprintf_vma (file, eh_data); fputc (' ', file); fprintf_vma (file, prolog_end_addr); @@ -1766,6 +1817,7 @@ _bfd_XX_print_private_bfd_data_common (bfd * abfd, void * vfile) pe_data_type *pe = pe_data (abfd); struct internal_extra_pe_aouthdr *i = &pe->pe_opthdr; const char *subsystem_name = NULL; + const char *name; /* The MS dumpbin program reportedly ands with 0xff0f before printing the characteristics field. Not sure why. No reason to @@ -1791,6 +1843,52 @@ _bfd_XX_print_private_bfd_data_common (bfd * abfd, void * vfile) time_t t = pe->coff.timestamp; fprintf (file, "\nTime/Date\t\t%s", ctime (&t)); } + +#ifndef IMAGE_NT_OPTIONAL_HDR_MAGIC +# define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b +#endif +#ifndef IMAGE_NT_OPTIONAL_HDR64_MAGIC +# define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b +#endif +#ifndef IMAGE_NT_OPTIONAL_HDRROM_MAGIC +# define IMAGE_NT_OPTIONAL_HDRROM_MAGIC 0x107 +#endif + + switch (i->Magic) + { + case IMAGE_NT_OPTIONAL_HDR_MAGIC: + name = "PE32"; + break; + case IMAGE_NT_OPTIONAL_HDR64_MAGIC: + name = "PE32+"; + break; + case IMAGE_NT_OPTIONAL_HDRROM_MAGIC: + name = "ROM"; + break; + default: + name = NULL; + break; + } + fprintf (file, "Magic\t\t\t%04x", i->Magic); + if (name) + fprintf (file, "\t(%s)",name); + fprintf (file, "\nMajorLinkerVersion\t%d\n", i->MajorLinkerVersion); + fprintf (file, "MinorLinkerVersion\t%d\n", i->MinorLinkerVersion); + fprintf (file, "SizeOfCode\t\t%08lx\n", i->SizeOfCode); + fprintf (file, "SizeOfInitializedData\t%08lx\n", + i->SizeOfInitializedData); + fprintf (file, "SizeOfUninitializedData\t%08lx\n", + i->SizeOfUninitializedData); + fprintf (file, "AddressOfEntryPoint\t"); + fprintf_vma (file, i->AddressOfEntryPoint); + fprintf (file, "\nBaseOfCode\t\t"); + fprintf_vma (file, i->BaseOfCode); +#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) + /* PE32+ does not have BaseOfData member! */ + fprintf (file, "\nBaseOfData\t\t"); + fprintf_vma (file, i->BaseOfData); +#endif + fprintf (file, "\nImageBase\t\t"); fprintf_vma (file, i->ImageBase); fprintf (file, "\nSectionAlignment\t"); @@ -1837,6 +1935,16 @@ _bfd_XX_print_private_bfd_data_common (bfd * abfd, void * vfile) case IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER: subsystem_name = "EFI runtime driver"; break; + // These are from revision 8.0 of the MS PE/COFF spec + case IMAGE_SUBSYSTEM_EFI_ROM: + subsystem_name = "EFI ROM"; + break; + case IMAGE_SUBSYSTEM_XBOX: + subsystem_name = "XBOX"; + break; + // Added default case for clarity - subsystem_name is NULL anyway. + default: + subsystem_name = NULL; } fprintf (file, "Subsystem\t\t%08x", i->Subsystem); @@ -1889,8 +1997,8 @@ _bfd_XX_bfd_copy_private_bfd_data_common (bfd * ibfd, bfd * obfd) if we don't remove this entry as well. */ if (! pe_data (obfd)->has_reloc_section) { - pe_data (obfd)->pe_opthdr.DataDirectory[5].VirtualAddress = 0; - pe_data (obfd)->pe_opthdr.DataDirectory[5].Size = 0; + pe_data (obfd)->pe_opthdr.DataDirectory[PE_BASE_RELOCATION_TABLE].VirtualAddress = 0; + pe_data (obfd)->pe_opthdr.DataDirectory[PE_BASE_RELOCATION_TABLE].Size = 0; } return TRUE; } @@ -1949,6 +2057,7 @@ _bfd_XXi_final_link_postscript (bfd * abfd, struct coff_final_link_info *pfinfo) { struct coff_link_hash_entry *h1; struct bfd_link_info *info = pfinfo->info; + bfd_boolean result = TRUE; /* There are a few fields that need to be filled in now while we have symbol table access. @@ -1962,49 +2071,103 @@ _bfd_XXi_final_link_postscript (bfd * abfd, struct coff_final_link_info *pfinfo) ".idata$2", FALSE, FALSE, TRUE); if (h1 != NULL) { - pe_data (abfd)->pe_opthdr.DataDirectory[1].VirtualAddress = - (h1->root.u.def.value - + h1->root.u.def.section->output_section->vma - + h1->root.u.def.section->output_offset); + /* PR ld/2729: We cannot rely upon all the output sections having been + created properly, so check before referencing them. Issue a warning + message for any sections tht could not be found. */ + if (h1->root.u.def.section != NULL + && h1->root.u.def.section->output_section != NULL) + pe_data (abfd)->pe_opthdr.DataDirectory[PE_IMPORT_TABLE].VirtualAddress = + (h1->root.u.def.value + + h1->root.u.def.section->output_section->vma + + h1->root.u.def.section->output_offset); + else + { + _bfd_error_handler + (_("%B: unable to fill in DataDictionary[1] because .idata$2 is missing"), + abfd); + result = FALSE; + } + h1 = coff_link_hash_lookup (coff_hash_table (info), ".idata$4", FALSE, FALSE, TRUE); - pe_data (abfd)->pe_opthdr.DataDirectory[1].Size = - ((h1->root.u.def.value - + h1->root.u.def.section->output_section->vma - + h1->root.u.def.section->output_offset) - - pe_data (abfd)->pe_opthdr.DataDirectory[1].VirtualAddress); + if (h1 != NULL + && h1->root.u.def.section != NULL + && h1->root.u.def.section->output_section != NULL) + pe_data (abfd)->pe_opthdr.DataDirectory[PE_IMPORT_TABLE].Size = + ((h1->root.u.def.value + + h1->root.u.def.section->output_section->vma + + h1->root.u.def.section->output_offset) + - pe_data (abfd)->pe_opthdr.DataDirectory[PE_IMPORT_TABLE].VirtualAddress); + else + { + _bfd_error_handler + (_("%B: unable to fill in DataDictionary[1] because .idata$4 is missing"), + abfd); + result = FALSE; + } /* The import address table. This is the size/address of .idata$5. */ h1 = coff_link_hash_lookup (coff_hash_table (info), ".idata$5", FALSE, FALSE, TRUE); - pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress = - (h1->root.u.def.value - + h1->root.u.def.section->output_section->vma - + h1->root.u.def.section->output_offset); + if (h1 != NULL + && h1->root.u.def.section != NULL + && h1->root.u.def.section->output_section != NULL) + pe_data (abfd)->pe_opthdr.DataDirectory[PE_IMPORT_ADDRESS_TABLE].VirtualAddress = + (h1->root.u.def.value + + h1->root.u.def.section->output_section->vma + + h1->root.u.def.section->output_offset); + else + { + _bfd_error_handler + (_("%B: unable to fill in DataDictionary[12] because .idata$5 is missing"), + abfd); + result = FALSE; + } + h1 = coff_link_hash_lookup (coff_hash_table (info), ".idata$6", FALSE, FALSE, TRUE); - pe_data (abfd)->pe_opthdr.DataDirectory[12].Size = - ((h1->root.u.def.value - + h1->root.u.def.section->output_section->vma - + h1->root.u.def.section->output_offset) - - pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress); + if (h1 != NULL + && h1->root.u.def.section != NULL + && h1->root.u.def.section->output_section != NULL) + pe_data (abfd)->pe_opthdr.DataDirectory[PE_IMPORT_ADDRESS_TABLE].Size = + ((h1->root.u.def.value + + h1->root.u.def.section->output_section->vma + + h1->root.u.def.section->output_offset) + - pe_data (abfd)->pe_opthdr.DataDirectory[PE_IMPORT_ADDRESS_TABLE].VirtualAddress); + else + { + _bfd_error_handler + (_("%B: unable to fill in DataDictionary[PE_IMPORT_ADDRESS_TABLE (12)] because .idata$6 is missing"), + abfd); + result = FALSE; + } } h1 = coff_link_hash_lookup (coff_hash_table (info), "__tls_used", FALSE, FALSE, TRUE); if (h1 != NULL) { - pe_data (abfd)->pe_opthdr.DataDirectory[9].VirtualAddress = - (h1->root.u.def.value - + h1->root.u.def.section->output_section->vma - + h1->root.u.def.section->output_offset - - pe_data (abfd)->pe_opthdr.ImageBase); - pe_data (abfd)->pe_opthdr.DataDirectory[9].Size = 0x18; + if (h1->root.u.def.section != NULL + && h1->root.u.def.section->output_section != NULL) + pe_data (abfd)->pe_opthdr.DataDirectory[PE_TLS_TABLE].VirtualAddress = + (h1->root.u.def.value + + h1->root.u.def.section->output_section->vma + + h1->root.u.def.section->output_offset + - pe_data (abfd)->pe_opthdr.ImageBase); + else + { + _bfd_error_handler + (_("%B: unable to fill in DataDictionary[9] because __tls_used is missing"), + abfd); + result = FALSE; + } + + pe_data (abfd)->pe_opthdr.DataDirectory[PE_TLS_TABLE].Size = 0x18; } /* If we couldn't find idata$2, we either have an excessively trivial program or are in DEEP trouble; we have to assume trivial program.... */ - return TRUE; + return result; } diff --git a/contrib/binutils/bfd/pei-arm-wince.c b/contrib/binutils/bfd/pei-arm-wince.c new file mode 100644 index 000000000000..7d5a3be3515b --- /dev/null +++ b/contrib/binutils/bfd/pei-arm-wince.c @@ -0,0 +1,30 @@ +/* BFD back-end for ARM WINCE PE IMAGE COFF files. + Copyright 2006 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#define TARGET_UNDERSCORE 0 +#define USER_LABEL_PREFIX "" + +#define TARGET_LITTLE_SYM arm_wince_pei_little_vec +#define TARGET_LITTLE_NAME "pei-arm-wince-little" +#define TARGET_BIG_SYM arm_wince_pei_big_vec +#define TARGET_BIG_NAME "pei-arm-wince-big" + +#define LOCAL_LABEL_PREFIX "." + +#include "pei-arm.c" diff --git a/contrib/binutils/bfd/pei-mips.c b/contrib/binutils/bfd/pei-mips.c index 0c9b962f2b6d..4405c0af217a 100644 --- a/contrib/binutils/bfd/pei-mips.c +++ b/contrib/binutils/bfd/pei-mips.c @@ -1,5 +1,5 @@ /* BFD back-end for MIPS PE IMAGE COFF files. - Copyright 1995, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1995, 2000, 2001, 2002, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #define TARGET_SYM mipslpei_vec #define TARGET_NAME "pei-mips" diff --git a/contrib/binutils/bfd/pei-x86_64.c b/contrib/binutils/bfd/pei-x86_64.c new file mode 100644 index 000000000000..37d9c7f2e54e --- /dev/null +++ b/contrib/binutils/bfd/pei-x86_64.c @@ -0,0 +1,54 @@ +/* BFD back-end for Intel 386 PE IMAGE COFF files. + Copyright 2006, 2007 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + + Written by Kai Tietz, OneVision Software GmbH&CoKg. */ + +#include "sysdep.h" +#include "bfd.h" + +#define TARGET_SYM x86_64pei_vec +#define TARGET_NAME "pei-x86-64" +#define COFF_IMAGE_WITH_PE +#define COFF_WITH_PE +#define COFF_WITH_pex64 +#define PCRELOFFSET TRUE +#define TARGET_UNDERSCORE '_' +#define COFF_LONG_SECTION_NAMES +#define COFF_SUPPORT_GNU_LINKONCE +#define COFF_LONG_FILENAMES + +#define COFF_SECTION_ALIGNMENT_ENTRIES \ +{ COFF_SECTION_NAME_EXACT_MATCH (".bss"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".rdata"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".debug"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 } + +#include "coff-x86_64.c" diff --git a/contrib/binutils/bfd/peicode.h b/contrib/binutils/bfd/peicode.h index 2061f415af61..0f4858f4bfbc 100644 --- a/contrib/binutils/bfd/peicode.h +++ b/contrib/binutils/bfd/peicode.h @@ -1,6 +1,6 @@ /* Support for the generic parts of PE/PEI, for BFD. Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005 Free Software Foundation, Inc. + 2005, 2006 Free Software Foundation, Inc. Written by Cygnus Solutions. This file is part of BFD, the Binary File Descriptor library. @@ -182,6 +182,10 @@ coff_swap_filehdr_in (bfd * abfd, void * src, void * dst) #ifdef COFF_IMAGE_WITH_PE # define coff_swap_filehdr_out _bfd_XXi_only_swap_filehdr_out +#elif defined COFF_WITH_pex64 +# define coff_swap_filehdr_out _bfd_pex64_only_swap_filehdr_out +#elif defined COFF_WITH_pep +# define coff_swap_filehdr_out _bfd_pep_only_swap_filehdr_out #else # define coff_swap_filehdr_out _bfd_pe_only_swap_filehdr_out #endif @@ -217,7 +221,10 @@ coff_swap_scnhdr_in (bfd * abfd, void * ext, void * in) if (scnhdr_int->s_vaddr != 0) { scnhdr_int->s_vaddr += pe_data (abfd)->pe_opthdr.ImageBase; + /* Do not cut upper 32-bits for 64-bit vma. */ +#ifndef COFF_WITH_pex64 scnhdr_int->s_vaddr &= 0xffffffff; +#endif } #ifndef COFF_NO_HACK_SCNHDR_SIZE @@ -405,8 +412,16 @@ pe_bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd) + NUM_ILF_SECTIONS * 9 \ + STRING_SIZE_SIZE) #define SIZEOF_IDATA2 (5 * 4) + +/* For PEx64 idata4 & 5 have thumb size of 8 bytes. */ +#ifdef COFF_WITH_pex64 +#define SIZEOF_IDATA4 (2 * 4) +#define SIZEOF_IDATA5 (2 * 4) +#else #define SIZEOF_IDATA4 (1 * 4) #define SIZEOF_IDATA5 (1 * 4) +#endif + #define SIZEOF_IDATA6 (2 + strlen (symbol_name) + 1 + 1) #define SIZEOF_IDATA7 (strlen (source_dll) + 1 + 1) #define SIZEOF_ILF_SECTIONS (NUM_ILF_SECTIONS * sizeof (struct coff_section_tdata)) @@ -656,9 +671,20 @@ static jump_table jtab[] = }, #endif +#ifdef AMD64MAGIC + { AMD64MAGIC, + { 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, 0x90, 0x90 }, + 8, 2 + }, +#endif + #ifdef MC68MAGIC - { MC68MAGIC, { /* XXX fill me in */ }, 0, 0 }, + { MC68MAGIC, + { /* XXX fill me in */ }, + 0, 0 + }, #endif + #ifdef MIPS_ARCH_MAGIC_WINCE { MIPS_ARCH_MAGIC_WINCE, { 0x00, 0x00, 0x08, 0x3c, 0x00, 0x00, 0x08, 0x8d, @@ -830,8 +856,15 @@ pe_ILF_build_a_bfd (bfd * abfd, /* XXX - treat as IMPORT_NAME ??? */ abort (); +#ifdef COFF_WITH_pex64 + ((unsigned int *) id4->contents)[0] = ordinal; + ((unsigned int *) id4->contents)[1] = 0x80000000; + ((unsigned int *) id5->contents)[0] = ordinal; + ((unsigned int *) id5->contents)[1] = 0x80000000; +#else * (unsigned int *) id4->contents = ordinal | 0x80000000; * (unsigned int *) id5->contents = ordinal | 0x80000000; +#endif } else { @@ -1071,6 +1104,12 @@ pe_ILF_object_p (bfd * abfd) #endif break; + case IMAGE_FILE_MACHINE_AMD64: +#ifdef AMD64MAGIC + magic = AMD64MAGIC; +#endif + break; + case IMAGE_FILE_MACHINE_M68K: #ifdef MC68AGIC magic = MC68MAGIC; @@ -1195,6 +1234,25 @@ pe_ILF_object_p (bfd * abfd) return abfd->xvec; } +enum arch_type +{ + arch_type_unknown, + arch_type_i386, + arch_type_x86_64 +}; + +static enum arch_type +pe_arch (const char *arch) +{ + if (strcmp (arch, "i386") == 0 || strcmp (arch, "ia32") == 0) + return arch_type_i386; + + if (strcmp (arch, "x86_64") == 0 || strcmp (arch, "x86-64") == 0) + return arch_type_x86_64; + + return arch_type_unknown; +} + static const bfd_target * pe_bfd_object_p (bfd * abfd) { @@ -1202,6 +1260,7 @@ pe_bfd_object_p (bfd * abfd) struct external_PEI_DOS_hdr dos_hdr; struct external_PEI_IMAGE_hdr image_hdr; file_ptr offset; + const bfd_target *target; /* Detect if this a Microsoft Import Library Format element. */ if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 @@ -1266,7 +1325,60 @@ pe_bfd_object_p (bfd * abfd) return NULL; } - return coff_object_p (abfd); + target = coff_object_p (abfd); + if (target) + { + pe_data_type *pe = pe_data (abfd); + struct internal_extra_pe_aouthdr *i = &pe->pe_opthdr; + bfd_boolean efi = i->Subsystem == IMAGE_SUBSYSTEM_EFI_APPLICATION; + enum arch_type arch; + const bfd_target * const *target_ptr; + + /* Get the machine. */ + if (bfd_target_efi_p (abfd->xvec)) + arch = pe_arch (bfd_target_efi_arch (abfd->xvec)); + else + arch = pe_arch (bfd_target_pei_arch (abfd->xvec)); + + for (target_ptr = bfd_target_vector; *target_ptr != NULL; + target_ptr++) + { + if (*target_ptr == target + || (*target_ptr)->flavour != bfd_target_coff_flavour) + continue; + + if (bfd_target_efi_p (*target_ptr)) + { + /* Skip incompatible arch. */ + if (pe_arch (bfd_target_efi_arch (*target_ptr)) != arch) + continue; + + if (efi) + { + /* TARGET_PTR is an EFI backend. Don't match + TARGET with a EFI file. */ + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + } + else if (bfd_target_pei_p (*target_ptr)) + { + /* Skip incompatible arch. */ + if (pe_arch (bfd_target_pei_arch (*target_ptr)) != arch) + continue; + + if (!efi) + { + /* TARGET_PTR is a PE backend. Don't match + TARGET with a PE file. */ + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + } + } + } + + return target; } #define coff_object_p pe_bfd_object_p diff --git a/contrib/binutils/bfd/po/BLD-POTFILES.in b/contrib/binutils/bfd/po/BLD-POTFILES.in index 2dbe723a50ef..07ad4b3602f9 100644 --- a/contrib/binutils/bfd/po/BLD-POTFILES.in +++ b/contrib/binutils/bfd/po/BLD-POTFILES.in @@ -5,4 +5,5 @@ elf64-ia64.c elf64-target.h peigen.c pepigen.c +pex64igen.c targmatch.h diff --git a/contrib/binutils/bfd/po/Make-in b/contrib/binutils/bfd/po/Make-in index f11ccb41cef0..1a619929557a 100644 --- a/contrib/binutils/bfd/po/Make-in +++ b/contrib/binutils/bfd/po/Make-in @@ -16,6 +16,7 @@ SHELL = /bin/sh srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ +top_builddir = @top_builddir@ prefix = @prefix@ exec_prefix = @exec_prefix@ @@ -78,7 +79,7 @@ INSTOBJEXT = @INSTOBJEXT@ $(MSGFMT) -o $@ $< .po.gmo: - file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \ + file=`echo $* | sed 's,.*/,,'`.gmo \ && rm -f $$file && $(GMSGFMT) -o $$file $< .po.cat: diff --git a/contrib/binutils/bfd/po/SRC-POTFILES.in b/contrib/binutils/bfd/po/SRC-POTFILES.in index 8bcf979a5bfb..5a3d361747ce 100644 --- a/contrib/binutils/bfd/po/SRC-POTFILES.in +++ b/contrib/binutils/bfd/po/SRC-POTFILES.in @@ -57,6 +57,7 @@ coff-tic80.c coff-u68k.c coff-w65.c coff-we32k.c +coff-x86_64.c coff-z80.c coff-z8k.c corefile.c @@ -65,6 +66,7 @@ cpu-arc.c cpu-arm.c cpu-avr.c cpu-bfin.c +cpu-cr16.c cpu-cr16c.c cpu-cris.c cpu-crx.c @@ -93,6 +95,7 @@ cpu-m68k.c cpu-m88k.c cpu-maxq.c cpu-mcore.c +cpu-mep.c cpu-mips.c cpu-mmix.c cpu-msp430.c @@ -105,8 +108,10 @@ cpu-pj.c cpu-powerpc.c cpu-rs6000.c cpu-s390.c +cpu-score.c cpu-sh.c cpu-sparc.c +cpu-spu.c cpu-tic30.c cpu-tic4x.c cpu-tic54x.c @@ -128,12 +133,14 @@ ecofflink.c ecoffswap.h efi-app-ia32.c efi-app-ia64.c +efi-app-x86_64.c elf32-am33lin.c elf32-arc.c elf32-arm.c elf32-avr.c elf32-bfin.c elf32.c +elf32-cr16.c elf32-cr16c.c elf32-cris.c elf32-crx.c @@ -160,6 +167,7 @@ elf32-m68hc1x.c elf32-m68k.c elf32-m88k.c elf32-mcore.c +elf32-mep.c elf32-mips.c elf32-msp430.c elf32-mt.c @@ -168,11 +176,13 @@ elf32-or32.c elf32-pj.c elf32-ppc.c elf32-s390.c +elf32-score.c elf32-sh64.c elf32-sh64-com.c elf32-sh.c elf32-sh-symbian.c elf32-sparc.c +elf32-spu.c elf32-v850.c elf32-vax.c elf32-xc16x.c @@ -190,6 +200,7 @@ elf64-s390.c elf64-sh64.c elf64-sparc.c elf64-x86-64.c +elf-attrs.c elf-bfd.h elf.c elfcode.h @@ -271,21 +282,25 @@ osf-core.c pc532-mach.c pdp11.c pe-arm.c +pe-arm-wince.c pef.c pef.h pef-traceback.h pe-i386.c pei-arm.c +pei-arm-wince.c peicode.h pei-i386.c pei-mcore.c pei-mips.c pei-ppc.c pei-sh.c +pei-x86_64.c pe-mcore.c pe-mips.c pe-ppc.c pe-sh.c +pe-x86_64.c ppcboot.c reloc16.c reloc.c diff --git a/contrib/binutils/bfd/po/bfd.pot b/contrib/binutils/bfd/po/bfd.pot index 37c57290aeeb..a01ee37160a8 100644 --- a/contrib/binutils/bfd/po/bfd.pot +++ b/contrib/binutils/bfd/po/bfd.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-10-25 22:24+0930\n" +"POT-Creation-Date: 2007-07-02 16:16+0930\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -33,153 +33,162 @@ msgstr "" msgid "%B: Bad relocation record imported: %d" msgstr "" -#: aoutx.h:1244 aoutx.h:1578 +#: aoutx.h:1267 aoutx.h:1601 #, c-format msgid "%s: can not represent section `%s' in a.out object file format" msgstr "" -#: aoutx.h:1544 +#: aoutx.h:1567 #, c-format msgid "" "%s: can not represent section for symbol `%s' in a.out object file format" msgstr "" -#: aoutx.h:1546 +#: aoutx.h:1569 msgid "*unknown*" msgstr "" -#: aoutx.h:5281 +#: aoutx.h:5311 #, c-format msgid "%s: relocatable link from %s to %s not supported" msgstr "" -#: archive.c:1760 +#: archive.c:1764 msgid "Warning: writing archive was slow: rewriting timestamp\n" msgstr "" -#: archive.c:2019 +#: archive.c:2027 msgid "Reading archive file mod timestamp" msgstr "" -#: archive.c:2043 +#: archive.c:2051 msgid "Writing updated armap timestamp" msgstr "" -#: bfd.c:279 +#: bfd.c:288 msgid "No error" msgstr "" -#: bfd.c:280 +#: bfd.c:289 msgid "System call error" msgstr "" -#: bfd.c:281 +#: bfd.c:290 msgid "Invalid bfd target" msgstr "" -#: bfd.c:282 +#: bfd.c:291 msgid "File in wrong format" msgstr "" -#: bfd.c:283 +#: bfd.c:292 msgid "Archive object file in wrong format" msgstr "" -#: bfd.c:284 +#: bfd.c:293 msgid "Invalid operation" msgstr "" -#: bfd.c:285 +#: bfd.c:294 msgid "Memory exhausted" msgstr "" -#: bfd.c:286 +#: bfd.c:295 msgid "No symbols" msgstr "" -#: bfd.c:287 +#: bfd.c:296 msgid "Archive has no index; run ranlib to add one" msgstr "" -#: bfd.c:288 +#: bfd.c:297 msgid "No more archived files" msgstr "" -#: bfd.c:289 +#: bfd.c:298 msgid "Malformed archive" msgstr "" -#: bfd.c:290 +#: bfd.c:299 msgid "File format not recognized" msgstr "" -#: bfd.c:291 +#: bfd.c:300 msgid "File format is ambiguous" msgstr "" -#: bfd.c:292 +#: bfd.c:301 msgid "Section has no contents" msgstr "" -#: bfd.c:293 +#: bfd.c:302 msgid "Nonrepresentable section on output" msgstr "" -#: bfd.c:294 +#: bfd.c:303 msgid "Symbol needs debug section which does not exist" msgstr "" -#: bfd.c:295 +#: bfd.c:304 msgid "Bad value" msgstr "" -#: bfd.c:296 +#: bfd.c:305 msgid "File truncated" msgstr "" -#: bfd.c:297 +#: bfd.c:306 msgid "File too big" msgstr "" -#: bfd.c:298 +#: bfd.c:307 +#, c-format +msgid "Error reading %s: %s" +msgstr "" + +#: bfd.c:308 msgid "#<Invalid error code>" msgstr "" -#: bfd.c:771 +#: bfd.c:829 #, c-format msgid "BFD %s assertion fail %s:%d" msgstr "" -#: bfd.c:787 +#: bfd.c:841 #, c-format msgid "BFD %s internal error, aborting at %s line %d in %s\n" msgstr "" -#: bfd.c:791 +#: bfd.c:845 #, c-format msgid "BFD %s internal error, aborting at %s line %d\n" msgstr "" -#: bfd.c:793 +#: bfd.c:847 msgid "Please report this bug.\n" msgstr "" -#: bfdwin.c:202 +#: bfdwin.c:207 #, c-format msgid "not mapping: data=%lx mapped=%d\n" msgstr "" -#: bfdwin.c:205 +#: bfdwin.c:210 #, c-format msgid "not mapping: env var not set\n" msgstr "" -#: binary.c:285 +#: binary.c:283 #, c-format msgid "Warning: Writing section `%s' to huge (ie negative) file offset 0x%lx." msgstr "" -#: coff64-rs6000.c:2109 coff-rs6000.c:3610 +#: cache.c:237 +msgid "reopening %B: %s\n" +msgstr "" + +#: coff64-rs6000.c:2125 coff-rs6000.c:3623 msgid "%B: symbol `%s' has unrecognized smclas %d" msgstr "" @@ -193,45 +202,45 @@ msgstr "" msgid "%B: unknown/unsupported relocation type %d" msgstr "" -#: coff-alpha.c:898 coff-alpha.c:935 coff-alpha.c:2007 coff-mips.c:985 +#: coff-alpha.c:898 coff-alpha.c:935 coff-alpha.c:2023 coff-mips.c:1001 msgid "GP relative relocation used when GP not defined" msgstr "" -#: coff-alpha.c:1484 +#: coff-alpha.c:1500 msgid "using multiple gp values" msgstr "" -#: coff-alpha.c:1543 +#: coff-alpha.c:1559 msgid "%B: unsupported relocation: ALPHA_R_GPRELHIGH" msgstr "" -#: coff-alpha.c:1550 +#: coff-alpha.c:1566 msgid "%B: unsupported relocation: ALPHA_R_GPRELLOW" msgstr "" -#: coff-alpha.c:1557 elf32-m32r.c:2471 elf64-alpha.c:3912 elf64-alpha.c:4038 -#: elf32-ia64.c:4108 elf64-ia64.c:4108 +#: coff-alpha.c:1573 elf32-m32r.c:2486 elf64-alpha.c:3951 elf64-alpha.c:4104 +#: elf32-ia64.c:4674 elf64-ia64.c:4674 msgid "%B: unknown relocation type %d" msgstr "" -#: coff-arm.c:990 elf32-arm.c:1926 +#: coff-arm.c:1035 #, c-format msgid "%B: unable to find THUMB glue '%s' for `%s'" msgstr "" -#: coff-arm.c:1019 elf32-arm.c:1960 +#: coff-arm.c:1064 #, c-format msgid "%B: unable to find ARM glue '%s' for `%s'" msgstr "" -#: coff-arm.c:1319 elf32-arm.c:2683 +#: coff-arm.c:1366 elf32-arm.c:4156 #, c-format msgid "" "%B(%s): warning: interworking not enabled.\n" " first occurrence: %B: arm call to thumb" msgstr "" -#: coff-arm.c:1409 +#: coff-arm.c:1456 #, c-format msgid "" "%B(%s): warning: interworking not enabled.\n" @@ -239,105 +248,105 @@ msgid "" " consider relinking with --support-old-code enabled" msgstr "" -#: coff-arm.c:1702 cofflink.c:3015 coff-tic80.c:695 +#: coff-arm.c:1749 cofflink.c:3014 coff-tic80.c:695 msgid "%B: bad reloc address 0x%lx in section `%A'" msgstr "" -#: coff-arm.c:2028 +#: coff-arm.c:2074 msgid "%B: illegal symbol index in reloc: %d" msgstr "" -#: coff-arm.c:2158 +#: coff-arm.c:2205 #, c-format msgid "ERROR: %B is compiled for APCS-%d, whereas %B is compiled for APCS-%d" msgstr "" -#: coff-arm.c:2174 elf32-arm.c:5093 +#: coff-arm.c:2221 elf32-arm.c:7103 #, c-format msgid "" "ERROR: %B passes floats in float registers, whereas %B passes them in " "integer registers" msgstr "" -#: coff-arm.c:2177 elf32-arm.c:5097 +#: coff-arm.c:2224 elf32-arm.c:7107 #, c-format msgid "" "ERROR: %B passes floats in integer registers, whereas %B passes them in " "float registers" msgstr "" -#: coff-arm.c:2191 +#: coff-arm.c:2238 #, c-format msgid "" "ERROR: %B is compiled as position independent code, whereas target %B is " "absolute position" msgstr "" -#: coff-arm.c:2194 +#: coff-arm.c:2241 #, c-format msgid "" "ERROR: %B is compiled as absolute position code, whereas target %B is " "position independent" msgstr "" -#: coff-arm.c:2222 elf32-arm.c:5162 +#: coff-arm.c:2269 elf32-arm.c:7172 #, c-format msgid "Warning: %B supports interworking, whereas %B does not" msgstr "" -#: coff-arm.c:2225 elf32-arm.c:5168 +#: coff-arm.c:2272 elf32-arm.c:7178 #, c-format msgid "Warning: %B does not support interworking, whereas %B does" msgstr "" -#: coff-arm.c:2249 +#: coff-arm.c:2296 #, c-format msgid "private flags = %x:" msgstr "" -#: coff-arm.c:2257 elf32-arm.c:5219 +#: coff-arm.c:2304 elf32-arm.c:7229 #, c-format msgid " [floats passed in float registers]" msgstr "" -#: coff-arm.c:2259 +#: coff-arm.c:2306 #, c-format msgid " [floats passed in integer registers]" msgstr "" -#: coff-arm.c:2262 elf32-arm.c:5222 +#: coff-arm.c:2309 elf32-arm.c:7232 #, c-format msgid " [position independent]" msgstr "" -#: coff-arm.c:2264 +#: coff-arm.c:2311 #, c-format msgid " [absolute position]" msgstr "" -#: coff-arm.c:2268 +#: coff-arm.c:2315 #, c-format msgid " [interworking flag not initialised]" msgstr "" -#: coff-arm.c:2270 +#: coff-arm.c:2317 #, c-format msgid " [interworking supported]" msgstr "" -#: coff-arm.c:2272 +#: coff-arm.c:2319 #, c-format msgid " [interworking not supported]" msgstr "" -#: coff-arm.c:2318 elf32-arm.c:4571 +#: coff-arm.c:2365 elf32-arm.c:6626 #, c-format msgid "" "Warning: Not setting interworking flag of %B since it has already been " "specified as non-interworking" msgstr "" -#: coff-arm.c:2322 elf32-arm.c:4575 +#: coff-arm.c:2369 elf32-arm.c:6630 #, c-format msgid "Warning: Clearing the interworking flag of %B due to outside request" msgstr "" @@ -358,36 +367,40 @@ msgstr "" msgid "%B (%s): Section flag %s (0x%x) ignored" msgstr "" -#: coffcode.h:2204 +#: coffcode.h:2231 #, c-format msgid "Unrecognized TI COFF target id '0x%x'" msgstr "" -#: coffcode.h:4211 +#: coffcode.h:2546 +msgid "%B: reloc against a non-existant symbol index: %ld" +msgstr "" + +#: coffcode.h:4269 msgid "%B: warning: line number table read failed" msgstr "" -#: coffcode.h:4243 +#: coffcode.h:4301 msgid "%B: warning: illegal symbol index %ld in line numbers" msgstr "" -#: coffcode.h:4257 +#: coffcode.h:4315 msgid "%B: warning: duplicate line number information for `%s'" msgstr "" -#: coffcode.h:4597 +#: coffcode.h:4655 msgid "%B: Unrecognized storage class %d for %s symbol `%s'" msgstr "" -#: coffcode.h:4723 +#: coffcode.h:4781 msgid "warning: %B: local symbol `%s' has no section" msgstr "" -#: coffcode.h:4827 coff-i860.c:586 coff-tic54x.c:376 +#: coffcode.h:4886 coff-i860.c:600 coff-tic54x.c:393 msgid "%B: warning: illegal symbol index %ld in relocs" msgstr "" -#: coffcode.h:4865 +#: coffcode.h:4924 msgid "%B: illegal relocation type %d at address 0x%lx" msgstr "" @@ -395,7 +408,7 @@ msgstr "" msgid "%B: bad string table size %lu" msgstr "" -#: coff-h8300.c:1126 +#: coff-h8300.c:1121 #, c-format msgid "cannot handle R_MEM_INDIRECT reloc when using %s output" msgstr "" @@ -405,53 +418,54 @@ msgstr "" msgid "Relocation `%s' not yet implemented\n" msgstr "" -#: coff-i960.c:137 coff-i960.c:486 +#: coff-i960.c:137 coff-i960.c:500 msgid "uncertain calling convention for non-COFF symbol" msgstr "" -#: cofflink.c:507 elflink.c:3948 +#: cofflink.c:509 elflink.c:4158 msgid "Warning: type of symbol `%s' changed from %d to %d in %B" msgstr "" -#: cofflink.c:2293 +#: cofflink.c:2292 msgid "%B: relocs in section `%A', but it has no contents" msgstr "" -#: cofflink.c:2624 coffswap.h:823 +#: cofflink.c:2623 coffswap.h:823 #, c-format msgid "%s: %s: reloc overflow: 0x%lx > 0xffff" msgstr "" -#: cofflink.c:2633 coffswap.h:809 +#: cofflink.c:2632 coffswap.h:809 #, c-format msgid "%s: warning: %s: line number overflow: 0x%lx > 0xffff" msgstr "" -#: coff-m68k.c:482 elf32-bfin.c:2722 elf32-m68k.c:2193 +#: coff-m68k.c:505 elf32-bfin.c:5434 elf32-m68k.c:2392 msgid "unsupported reloc type" msgstr "" -#: coff-maxq.c:128 +#: coff-maxq.c:126 msgid "Can't Make it a Short Jump" msgstr "" -#: coff-maxq.c:193 +#: coff-maxq.c:191 msgid "Exceeds Long Jump Range" msgstr "" -#: coff-maxq.c:204 coff-maxq.c:278 +#: coff-maxq.c:202 coff-maxq.c:276 msgid "Absolute address Exceeds 16 bit Range" msgstr "" -#: coff-maxq.c:242 +#: coff-maxq.c:240 msgid "Absolute address Exceeds 8 bit Range" msgstr "" -#: coff-maxq.c:335 +#: coff-maxq.c:333 msgid "Unrecognized Reloc Type" msgstr "" -#: coff-mips.c:686 elf32-mips.c:940 elf64-mips.c:1864 elfn32-mips.c:1718 +#: coff-mips.c:686 elf32-mips.c:956 elf32-score.c:344 elf64-mips.c:1896 +#: elfn32-mips.c:1750 msgid "GP relative relocation when _gp not defined" msgstr "" @@ -459,22 +473,22 @@ msgstr "" msgid "Unrecognized reloc" msgstr "" -#: coff-rs6000.c:2785 +#: coff-rs6000.c:2798 #, c-format msgid "%s: unsupported relocation type 0x%02x" msgstr "" -#: coff-rs6000.c:2878 +#: coff-rs6000.c:2891 #, c-format msgid "%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry" msgstr "" -#: coff-tic4x.c:174 coff-tic54x.c:282 coff-tic80.c:458 +#: coff-tic4x.c:191 coff-tic54x.c:299 coff-tic80.c:458 #, c-format msgid "Unrecognized reloc type 0x%x" msgstr "" -#: coff-tic4x.c:219 +#: coff-tic4x.c:236 #, c-format msgid "%s: warning: illegal symbol index %ld in relocs" msgstr "" @@ -484,543 +498,644 @@ msgstr "" msgid "ignoring reloc %s\n" msgstr "" -#: cpu-arm.c:184 cpu-arm.c:193 +#: cpu-arm.c:188 cpu-arm.c:199 msgid "ERROR: %B is compiled for the EP9312, whereas %B is compiled for XScale" msgstr "" -#: cpu-arm.c:324 +#: cpu-arm.c:331 #, c-format msgid "warning: unable to update contents of %s section in %s" msgstr "" -#: dwarf2.c:315 +#: dwarf2.c:329 msgid "Dwarf Error: Can't find .debug_str section." msgstr "" -#: dwarf2.c:333 +#: dwarf2.c:347 #, c-format msgid "" "Dwarf Error: DW_FORM_strp offset (%lu) greater than or equal to .debug_str " "size (%lu)." msgstr "" -#: dwarf2.c:426 +#: dwarf2.c:440 msgid "Dwarf Error: Can't find .debug_abbrev section." msgstr "" -#: dwarf2.c:441 +#: dwarf2.c:455 #, c-format msgid "" "Dwarf Error: Abbrev offset (%lu) greater than or equal to .debug_abbrev size " "(%lu)." msgstr "" -#: dwarf2.c:656 +#: dwarf2.c:670 #, c-format msgid "Dwarf Error: Invalid or unhandled FORM value: %u." msgstr "" -#: dwarf2.c:856 +#: dwarf2.c:873 msgid "Dwarf Error: mangled line number section (bad file number)." msgstr "" -#: dwarf2.c:947 +#: dwarf2.c:985 msgid "Dwarf Error: Can't find .debug_line section." msgstr "" -#: dwarf2.c:964 +#: dwarf2.c:1002 #, c-format msgid "" "Dwarf Error: Line offset (%lu) greater than or equal to .debug_line size (%" "lu)." msgstr "" -#: dwarf2.c:1192 +#: dwarf2.c:1228 msgid "Dwarf Error: mangled line number section." msgstr "" -#: dwarf2.c:1382 +#: dwarf2.c:1416 msgid "Dwarf Error: Can't find .debug_ranges section." msgstr "" -#: dwarf2.c:1544 dwarf2.c:1660 dwarf2.c:1930 +#: dwarf2.c:1579 dwarf2.c:1695 dwarf2.c:1965 #, c-format msgid "Dwarf Error: Could not find abbrev number %u." msgstr "" -#: dwarf2.c:1891 +#: dwarf2.c:1926 #, c-format msgid "" "Dwarf Error: found dwarf version '%u', this reader only handles version 2 " "information." msgstr "" -#: dwarf2.c:1898 +#: dwarf2.c:1933 #, c-format msgid "" "Dwarf Error: found address size '%u', this reader can not handle sizes " "greater than '%u'." msgstr "" -#: dwarf2.c:1921 +#: dwarf2.c:1956 #, c-format msgid "Dwarf Error: Bad abbrev number: %u." msgstr "" -#: ecoff.c:1227 +#: ecoff.c:1226 #, c-format msgid "Unknown basic type %d" msgstr "" -#: ecoff.c:1484 +#: ecoff.c:1483 #, c-format msgid "" "\n" " End+1 symbol: %ld" msgstr "" -#: ecoff.c:1491 ecoff.c:1494 +#: ecoff.c:1490 ecoff.c:1493 #, c-format msgid "" "\n" " First symbol: %ld" msgstr "" -#: ecoff.c:1506 +#: ecoff.c:1505 #, c-format msgid "" "\n" " End+1 symbol: %-7ld Type: %s" msgstr "" -#: ecoff.c:1513 +#: ecoff.c:1512 #, c-format msgid "" "\n" " Local symbol: %ld" msgstr "" -#: ecoff.c:1521 +#: ecoff.c:1520 #, c-format msgid "" "\n" " struct; End+1 symbol: %ld" msgstr "" -#: ecoff.c:1526 +#: ecoff.c:1525 #, c-format msgid "" "\n" " union; End+1 symbol: %ld" msgstr "" -#: ecoff.c:1531 +#: ecoff.c:1530 #, c-format msgid "" "\n" " enum; End+1 symbol: %ld" msgstr "" -#: ecoff.c:1537 +#: ecoff.c:1536 #, c-format msgid "" "\n" " Type: %s" msgstr "" -#: elf32-arm.c:2315 +#: elf32-arm.c:2516 +#, c-format +msgid "unable to find THUMB glue '%s' for '%s'" +msgstr "" + +#: elf32-arm.c:2549 +#, c-format +msgid "unable to find ARM glue '%s' for '%s'" +msgstr "" + +#: elf32-arm.c:3119 msgid "%B: BE8 images only valid in big-endian mode." msgstr "" -#: elf32-arm.c:2471 +#. Give a warning, but do as the user requests anyway. +#: elf32-arm.c:3320 +msgid "" +"%B: warning: selected VFP11 erratum workaround is not necessary for target " +"architecture" +msgstr "" + +#: elf32-arm.c:3854 elf32-arm.c:3874 +msgid "%B: unable to find VFP11 veneer `%s'" +msgstr "" + +#: elf32-arm.c:3919 #, c-format msgid "Invalid TARGET2 relocation type '%s'." msgstr "" -#: elf32-arm.c:2578 +#: elf32-arm.c:4060 msgid "" "%B(%s): warning: interworking not enabled.\n" " first occurrence: %B: thumb call to arm" msgstr "" -#: elf32-arm.c:3044 +#: elf32-arm.c:4748 msgid "\\%B: Warning: Arm BLX instruction targets Arm function '%s'." msgstr "" -#: elf32-arm.c:3227 +#: elf32-arm.c:5047 msgid "%B: Warning: Thumb BLX instruction targets thumb function '%s'." msgstr "" -#: elf32-arm.c:3889 +#: elf32-arm.c:5738 msgid "%B(%A+0x%lx): R_ARM_TLS_LE32 relocation not permitted in shared object" msgstr "" -#: elf32-arm.c:4290 elf32-sh.c:4618 elf64-sh64.c:1537 +#: elf32-arm.c:5939 +msgid "" +"%B(%A+0x%lx): Only ADD or SUB instructions are allowed for ALU group " +"relocations" +msgstr "" + +#: elf32-arm.c:5979 elf32-arm.c:6066 elf32-arm.c:6149 elf32-arm.c:6234 +msgid "%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s" +msgstr "" + +#: elf32-arm.c:6417 elf32-sh.c:3303 elf64-sh64.c:1555 msgid "%B(%A+0x%lx): %s relocation against SEC_MERGE section" msgstr "" -#: elf32-arm.c:4351 elf64-ppc.c:9672 +#: elf32-arm.c:6506 elf64-ppc.c:9972 msgid "%B(%A+0x%lx): %s used with TLS symbol %s" msgstr "" -#: elf32-arm.c:4352 elf64-ppc.c:9673 +#: elf32-arm.c:6507 elf64-ppc.c:9973 msgid "%B(%A+0x%lx): %s used with non-TLS symbol %s" msgstr "" -#: elf32-arm.c:4375 elf32-i386.c:3038 elf32-m32r.c:2653 elf32-m68k.c:1737 -#: elf32-ppc.c:6561 elf32-s390.c:3012 elf32-sh.c:4717 elf32-xtensa.c:2311 -#: elf64-ppc.c:10825 elf64-s390.c:3010 elf64-sh64.c:1626 elf64-x86-64.c:2522 -#: elf-hppa.h:1413 elf-m10300.c:1460 elfxx-sparc.c:3137 +#: elf32-arm.c:6530 elf32-i386.c:3305 elf32-m32r.c:2597 elf32-m68k.c:1981 +#: elf32-ppc.c:6791 elf32-s390.c:3048 elf32-sh.c:3407 elf32-xtensa.c:2290 +#: elf64-ppc.c:11137 elf64-s390.c:3009 elf64-sh64.c:1647 elf64-x86-64.c:3001 +#: elf-hppa.h:2193 elf-m10300.c:1459 elfxx-sparc.c:3254 msgid "%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'" msgstr "" -#: elf32-arm.c:4411 elf32-avr.c:880 elf32-cr16c.c:773 elf32-cris.c:1502 -#: elf32-crx.c:911 elf32-d10v.c:536 elf32-fr30.c:595 elf32-frv.c:4107 -#: elf32-h8300.c:494 elf32-i860.c:1189 elf32-ip2k.c:1474 elf32-iq2000.c:616 -#: elf32-m32c.c:465 elf32-m32r.c:3111 elf32-m68hc1x.c:1194 elf32-ms1.c:373 -#: elf32-msp430.c:508 elf32-openrisc.c:383 elf32-v850.c:1672 -#: elf32-xstormy16.c:909 elf64-mmix.c:1517 elf-m10200.c:427 elf-m10300.c:1509 -msgid "internal error: out of range error" +#: elf32-arm.c:6564 +msgid "out of range" msgstr "" -#: elf32-arm.c:4415 elf32-avr.c:884 elf32-cr16c.c:777 elf32-cris.c:1506 -#: elf32-crx.c:915 elf32-d10v.c:540 elf32-fr30.c:599 elf32-frv.c:4111 -#: elf32-h8300.c:498 elf32-i860.c:1193 elf32-iq2000.c:620 elf32-m32c.c:469 -#: elf32-m32r.c:3115 elf32-m68hc1x.c:1198 elf32-msp430.c:512 -#: elf32-openrisc.c:387 elf32-v850.c:1676 elf32-xstormy16.c:913 -#: elf64-mmix.c:1521 elf-m10200.c:431 elf-m10300.c:1513 elfxx-mips.c:7212 -msgid "internal error: unsupported relocation error" +#: elf32-arm.c:6568 +msgid "unsupported relocation" msgstr "" -#: elf32-arm.c:4419 elf32-cr16c.c:781 elf32-crx.c:919 elf32-d10v.c:544 -#: elf32-h8300.c:502 elf32-m32r.c:3119 elf32-m68hc1x.c:1202 elf-m10200.c:435 -#: elf-m10300.c:1517 -msgid "internal error: dangerous error" +#: elf32-arm.c:6576 +msgid "unknown error" msgstr "" -#: elf32-arm.c:4423 elf32-avr.c:892 elf32-cr16c.c:785 elf32-cris.c:1514 -#: elf32-crx.c:923 elf32-d10v.c:548 elf32-fr30.c:607 elf32-frv.c:4119 -#: elf32-h8300.c:506 elf32-i860.c:1201 elf32-ip2k.c:1489 elf32-iq2000.c:628 -#: elf32-m32c.c:477 elf32-m32r.c:3123 elf32-m68hc1x.c:1206 elf32-ms1.c:381 -#: elf32-msp430.c:520 elf32-openrisc.c:395 elf32-v850.c:1696 -#: elf32-xstormy16.c:921 elf64-mmix.c:1529 elf-m10200.c:439 elf-m10300.c:1521 -msgid "internal error: unknown error" -msgstr "" - -#: elf32-arm.c:4664 +#: elf32-arm.c:6676 msgid "" "Warning: Clearing the interworking flag of %B because non-interworking code " "in %B has been linked with it" msgstr "" -#: elf32-arm.c:4751 +#: elf32-arm.c:6778 msgid "ERROR: %B uses VFP register arguments, %B does not" msgstr "" -#: elf32-arm.c:4798 +#: elf32-arm.c:6828 msgid "ERROR: %B: Conflicting architecture profiles %c/%c" msgstr "" -#: elf32-arm.c:4813 +#: elf32-arm.c:6843 msgid "Warning: %B: Conflicting platform configuration" msgstr "" -#: elf32-arm.c:4821 +#: elf32-arm.c:6852 msgid "ERROR: %B: Conflicting use of R9" msgstr "" -#: elf32-arm.c:4833 +#: elf32-arm.c:6864 msgid "ERROR: %B: SB relative addressing conflicts with use of R9" msgstr "" -#: elf32-arm.c:4855 +#: elf32-arm.c:6886 msgid "ERROR: %B: Conflicting definitions of wchar_t" msgstr "" -#: elf32-arm.c:4881 -msgid "ERROR: %B: Conflicting enum sizes" +#: elf32-arm.c:6915 +msgid "" +"warning: %B uses %s enums yet the output is to use %s enums; use of enum " +"values across objects may fail" msgstr "" -#: elf32-arm.c:4892 +#: elf32-arm.c:6928 msgid "ERROR: %B uses iWMMXt register arguments, %B does not" msgstr "" -#: elf32-arm.c:4912 -msgid "ERROR: %B: Must be processed by '%s' toolchain" -msgstr "" - -#: elf32-arm.c:4932 elf32-arm.c:4951 -msgid "ERROR: %B: Incompatible object tag '%s':%d" -msgstr "" - -#: elf32-arm.c:4961 +#: elf32-arm.c:6951 msgid "Warning: %B: Unknown EABI object attribute %d" msgstr "" -#: elf32-arm.c:5069 +#: elf32-arm.c:7076 msgid "" "ERROR: Source object %B has EABI version %d, but target %B has EABI version %" "d" msgstr "" -#: elf32-arm.c:5082 +#: elf32-arm.c:7092 msgid "ERROR: %B is compiled for APCS-%d, whereas target %B uses APCS-%d" msgstr "" -#: elf32-arm.c:5107 +#: elf32-arm.c:7117 msgid "ERROR: %B uses VFP instructions, whereas %B does not" msgstr "" -#: elf32-arm.c:5111 +#: elf32-arm.c:7121 msgid "ERROR: %B uses FPA instructions, whereas %B does not" msgstr "" -#: elf32-arm.c:5121 +#: elf32-arm.c:7131 msgid "ERROR: %B uses Maverick instructions, whereas %B does not" msgstr "" -#: elf32-arm.c:5125 +#: elf32-arm.c:7135 msgid "ERROR: %B does not use Maverick instructions, whereas %B does" msgstr "" -#: elf32-arm.c:5144 +#: elf32-arm.c:7154 msgid "ERROR: %B uses software FP, whereas %B uses hardware FP" msgstr "" -#: elf32-arm.c:5148 +#: elf32-arm.c:7158 msgid "ERROR: %B uses hardware FP, whereas %B uses software FP" msgstr "" #. Ignore init flag - it may not be set, despite the flags field #. containing valid data. #. Ignore init flag - it may not be set, despite the flags field containing valid data. -#: elf32-arm.c:5195 elf32-bfin.c:2164 elf32-cris.c:3243 elf32-m68hc1x.c:1338 -#: elf32-m68k.c:428 elf32-vax.c:528 elfxx-mips.c:9933 +#: elf32-arm.c:7205 elf32-bfin.c:4795 elf32-cris.c:3233 elf32-m68hc1x.c:1276 +#: elf32-m68k.c:619 elf32-score.c:3752 elf32-vax.c:537 elfxx-mips.c:11310 #, c-format msgid "private flags = %lx:" msgstr "" -#: elf32-arm.c:5204 +#: elf32-arm.c:7214 #, c-format msgid " [interworking enabled]" msgstr "" -#: elf32-arm.c:5212 +#: elf32-arm.c:7222 #, c-format msgid " [VFP float format]" msgstr "" -#: elf32-arm.c:5214 +#: elf32-arm.c:7224 #, c-format msgid " [Maverick float format]" msgstr "" -#: elf32-arm.c:5216 +#: elf32-arm.c:7226 #, c-format msgid " [FPA float format]" msgstr "" -#: elf32-arm.c:5225 +#: elf32-arm.c:7235 #, c-format msgid " [new ABI]" msgstr "" -#: elf32-arm.c:5228 +#: elf32-arm.c:7238 #, c-format msgid " [old ABI]" msgstr "" -#: elf32-arm.c:5231 +#: elf32-arm.c:7241 #, c-format msgid " [software FP]" msgstr "" -#: elf32-arm.c:5240 +#: elf32-arm.c:7250 #, c-format msgid " [Version1 EABI]" msgstr "" -#: elf32-arm.c:5243 elf32-arm.c:5254 +#: elf32-arm.c:7253 elf32-arm.c:7264 #, c-format msgid " [sorted symbol table]" msgstr "" -#: elf32-arm.c:5245 elf32-arm.c:5256 +#: elf32-arm.c:7255 elf32-arm.c:7266 #, c-format msgid " [unsorted symbol table]" msgstr "" -#: elf32-arm.c:5251 +#: elf32-arm.c:7261 #, c-format msgid " [Version2 EABI]" msgstr "" -#: elf32-arm.c:5259 +#: elf32-arm.c:7269 #, c-format msgid " [dynamic symbols use segment index]" msgstr "" -#: elf32-arm.c:5262 +#: elf32-arm.c:7272 #, c-format msgid " [mapping symbols precede others]" msgstr "" -#: elf32-arm.c:5269 +#: elf32-arm.c:7279 #, c-format msgid " [Version3 EABI]" msgstr "" -#: elf32-arm.c:5273 +#: elf32-arm.c:7283 #, c-format msgid " [Version4 EABI]" msgstr "" -#: elf32-arm.c:5276 +#: elf32-arm.c:7287 +#, c-format +msgid " [Version5 EABI]" +msgstr "" + +#: elf32-arm.c:7290 #, c-format msgid " [BE8]" msgstr "" -#: elf32-arm.c:5279 +#: elf32-arm.c:7293 #, c-format msgid " [LE8]" msgstr "" -#: elf32-arm.c:5285 +#: elf32-arm.c:7299 #, c-format msgid " <EABI version unrecognised>" msgstr "" -#: elf32-arm.c:5292 +#: elf32-arm.c:7306 #, c-format msgid " [relocatable executable]" msgstr "" -#: elf32-arm.c:5295 +#: elf32-arm.c:7309 #, c-format msgid " [has entry point]" msgstr "" -#: elf32-arm.c:5300 +#: elf32-arm.c:7314 #, c-format msgid "<Unrecognised flag bits set>" msgstr "" -#: elf32-arm.c:5536 elf32-i386.c:902 elf32-s390.c:989 elf32-xtensa.c:784 -#: elf64-s390.c:942 elf64-x86-64.c:666 elfxx-sparc.c:1016 +#: elf32-arm.c:7545 elf32-i386.c:960 elf32-s390.c:1003 elf32-xtensa.c:814 +#: elf64-s390.c:958 elf64-x86-64.c:772 elfxx-sparc.c:1113 msgid "%B: bad symbol index: %d" msgstr "" -#: elf32-arm.c:6023 elf32-cris.c:2385 elf32-hppa.c:1813 elf32-i370.c:491 -#: elf32-i386.c:1465 elf32-m32r.c:1913 elf32-m68k.c:1088 elf32-ppc.c:4145 -#: elf32-s390.c:1686 elf32-sh.c:3920 elf32-vax.c:1059 elf64-ppc.c:5717 -#: elf64-s390.c:1659 elf64-sh64.c:3442 elf64-x86-64.c:1252 elf-m10300.c:4107 -#: elfxx-sparc.c:1720 +#: elf32-arm.c:8091 elf32-cris.c:2399 elf32-hppa.c:1905 elf32-i370.c:506 +#: elf32-i386.c:1517 elf32-m32r.c:1930 elf32-m68k.c:1330 elf32-ppc.c:4309 +#: elf32-s390.c:1679 elf32-sh.c:2583 elf32-vax.c:1049 elf64-ppc.c:5897 +#: elf64-s390.c:1654 elf64-sh64.c:3437 elf64-x86-64.c:1381 elf-m10300.c:4206 +#: elfxx-sparc.c:1795 #, c-format msgid "dynamic variable `%s' is zero size" msgstr "" -#: elf32-avr.c:888 elf32-cris.c:1510 elf32-fr30.c:603 elf32-frv.c:4115 -#: elf32-i860.c:1197 elf32-ip2k.c:1485 elf32-iq2000.c:624 elf32-m32c.c:473 -#: elf32-ms1.c:377 elf32-msp430.c:516 elf32-openrisc.c:391 elf32-v850.c:1680 -#: elf32-xstormy16.c:917 elf64-mmix.c:1525 +#: elf32-arm.c:8609 +#, c-format +msgid "Errors encountered processing file %s" +msgstr "" + +#: elf32-arm.c:9837 elf32-arm.c:9859 +msgid "%B: error: VFP11 veneer out of range" +msgstr "" + +#: elf32-avr.c:1253 elf32-bfin.c:2795 elf32-cr16.c:887 elf32-cr16c.c:789 +#: elf32-cris.c:1537 elf32-crx.c:932 elf32-d10v.c:517 elf32-fr30.c:615 +#: elf32-frv.c:4128 elf32-h8300.c:515 elf32-i860.c:1217 elf32-ip2k.c:1499 +#: elf32-iq2000.c:647 elf32-m32c.c:560 elf32-m32r.c:3123 elf32-m68hc1x.c:1132 +#: elf32-mep.c:639 elf32-msp430.c:496 elf32-mt.c:401 elf32-openrisc.c:411 +#: elf32-score.c:2455 elf32-spu.c:2813 elf32-v850.c:1700 elf32-xstormy16.c:946 +#: elf64-mmix.c:1531 elf-m10200.c:455 elf-m10300.c:1522 +msgid "internal error: out of range error" +msgstr "" + +#: elf32-avr.c:1257 elf32-bfin.c:2799 elf32-cr16.c:891 elf32-cr16c.c:793 +#: elf32-cris.c:1541 elf32-crx.c:936 elf32-d10v.c:521 elf32-fr30.c:619 +#: elf32-frv.c:4132 elf32-h8300.c:519 elf32-i860.c:1221 elf32-iq2000.c:651 +#: elf32-m32c.c:564 elf32-m32r.c:3127 elf32-m68hc1x.c:1136 elf32-mep.c:643 +#: elf32-msp430.c:500 elf32-openrisc.c:415 elf32-score.c:2459 elf32-spu.c:2817 +#: elf32-v850.c:1704 elf32-xstormy16.c:950 elf64-mmix.c:1535 elf-m10200.c:459 +#: elf-m10300.c:1526 elfxx-mips.c:8019 +msgid "internal error: unsupported relocation error" +msgstr "" + +#: elf32-avr.c:1261 elf32-bfin.c:2803 elf32-cris.c:1545 elf32-fr30.c:623 +#: elf32-frv.c:4136 elf32-i860.c:1225 elf32-ip2k.c:1510 elf32-iq2000.c:655 +#: elf32-m32c.c:568 elf32-mep.c:647 elf32-msp430.c:504 elf32-mt.c:405 +#: elf32-openrisc.c:419 elf32-v850.c:1708 elf32-xstormy16.c:954 +#: elf64-mmix.c:1539 msgid "internal error: dangerous relocation" msgstr "" -#: elf32-bfin.c:96 -msgid "Division by zero. " +#: elf32-avr.c:1265 elf32-bfin.c:2807 elf32-cr16.c:899 elf32-cr16c.c:801 +#: elf32-cris.c:1549 elf32-crx.c:944 elf32-d10v.c:529 elf32-fr30.c:627 +#: elf32-frv.c:4140 elf32-h8300.c:527 elf32-i860.c:1229 elf32-ip2k.c:1514 +#: elf32-iq2000.c:659 elf32-m32c.c:572 elf32-m32r.c:3135 elf32-m68hc1x.c:1144 +#: elf32-mep.c:651 elf32-msp430.c:508 elf32-mt.c:409 elf32-openrisc.c:423 +#: elf32-score.c:2467 elf32-spu.c:2825 elf32-v850.c:1724 elf32-xstormy16.c:958 +#: elf64-mmix.c:1543 elf-m10200.c:467 elf-m10300.c:1539 +msgid "internal error: unknown error" +msgstr "" + +#: elf32-avr.c:2369 elf32-hppa.c:594 elf32-m68hc1x.c:163 elf64-ppc.c:3801 +msgid "%B: cannot create stub entry %s" +msgstr "" + +#: elf32-bfin.c:2274 +msgid "%B: relocation at `%A+0x%x' references symbol `%s' with nonzero addend" +msgstr "" + +#: elf32-bfin.c:2288 elf32-frv.c:2918 +msgid "relocation references symbol not defined in the module" +msgstr "" + +#: elf32-bfin.c:2385 +msgid "R_BFIN_FUNCDESC references dynamic symbol with nonzero addend" +msgstr "" + +#: elf32-bfin.c:2424 elf32-bfin.c:2547 elf32-frv.c:3655 elf32-frv.c:3776 +msgid "cannot emit fixups in read-only section" +msgstr "" + +#: elf32-bfin.c:2452 elf32-bfin.c:2587 elf32-frv.c:3686 elf32-frv.c:3820 +msgid "cannot emit dynamic relocations in read-only section" +msgstr "" + +#: elf32-bfin.c:2505 +msgid "R_BFIN_FUNCDESC_VALUE references dynamic symbol with nonzero addend" msgstr "" -#: elf32-bfin.c:1958 +#: elf32-bfin.c:2673 +msgid "relocations between different segments are not supported" +msgstr "" + +#: elf32-bfin.c:2674 +msgid "warning: relocation references a different segment" +msgstr "" + +#: elf32-bfin.c:3083 msgid "%B(%A+0x%lx): unresolvable relocation against symbol `%s'" msgstr "" -#: elf32-bfin.c:1991 elf32-i386.c:3079 elf32-m68k.c:1778 elf32-s390.c:3064 -#: elf64-s390.c:3062 elf64-x86-64.c:2567 +#: elf32-bfin.c:3116 elf32-i386.c:3346 elf32-m68k.c:2022 elf32-s390.c:3100 +#: elf64-s390.c:3061 elf64-x86-64.c:3040 msgid "%B(%A+0x%lx): reloc against `%s': error %d" msgstr "" -#: elf32-cris.c:1050 +#: elf32-bfin.c:4687 elf32-frv.c:6422 +msgid "%B: unsupported relocation type %i" +msgstr "" + +#: elf32-bfin.c:4868 elf32-frv.c:6830 +#, c-format +msgid "%s: cannot link non-fdpic object file into fdpic executable" +msgstr "" + +#: elf32-bfin.c:4872 elf32-frv.c:6834 +#, c-format +msgid "%s: cannot link fdpic object file into non-fdpic executable" +msgstr "" + +#: elf32-cr16.c:895 elf32-cr16c.c:797 elf32-crx.c:940 elf32-d10v.c:525 +#: elf32-h8300.c:523 elf32-m32r.c:3131 elf32-m68hc1x.c:1140 elf32-score.c:2463 +#: elf32-spu.c:2821 elf-m10200.c:463 +msgid "internal error: dangerous error" +msgstr "" + +#: elf32-cris.c:1059 msgid "%B, section %A: unresolvable relocation %s against symbol `%s'" msgstr "" -#: elf32-cris.c:1105 +#: elf32-cris.c:1128 msgid "%B, section %A: No PLT nor GOT for relocation %s against symbol `%s'" msgstr "" -#: elf32-cris.c:1107 +#: elf32-cris.c:1130 msgid "%B, section %A: No PLT for relocation %s against symbol `%s'" msgstr "" -#: elf32-cris.c:1113 elf32-cris.c:1245 +#: elf32-cris.c:1136 elf32-cris.c:1268 msgid "[whose name is lost]" msgstr "" -#: elf32-cris.c:1231 +#: elf32-cris.c:1254 msgid "" "%B, section %A: relocation %s with non-zero addend %d against local symbol" msgstr "" -#: elf32-cris.c:1239 +#: elf32-cris.c:1262 msgid "" "%B, section %A: relocation %s with non-zero addend %d against symbol `%s'" msgstr "" -#: elf32-cris.c:1265 +#: elf32-cris.c:1288 msgid "%B, section %A: relocation %s is not allowed for global symbol: `%s'" msgstr "" -#: elf32-cris.c:1281 +#: elf32-cris.c:1304 msgid "%B, section %A: relocation %s with no GOT created" msgstr "" -#: elf32-cris.c:1399 +#: elf32-cris.c:1422 msgid "%B: Internal inconsistency; no relocation section %s" msgstr "" -#: elf32-cris.c:2520 +#: elf32-cris.c:2510 msgid "" "%B, section %A:\n" " v10/v32 compatible object %s must not contain a PIC relocation" msgstr "" -#: elf32-cris.c:2707 elf32-cris.c:2775 +#: elf32-cris.c:2697 elf32-cris.c:2765 msgid "" "%B, section %A:\n" " relocation %s should not be used in a shared object; recompile with -fPIC" msgstr "" -#: elf32-cris.c:3192 +#: elf32-cris.c:3182 msgid "Unexpected machine number" msgstr "" -#: elf32-cris.c:3246 +#: elf32-cris.c:3236 #, c-format msgid " [symbols have a _ prefix]" msgstr "" -#: elf32-cris.c:3249 +#: elf32-cris.c:3239 #, c-format msgid " [v10 and v32]" msgstr "" -#: elf32-cris.c:3252 +#: elf32-cris.c:3242 #, c-format msgid " [v32]" msgstr "" -#: elf32-cris.c:3297 +#: elf32-cris.c:3287 msgid "%B: uses _-prefixed symbols, but writing file with non-prefixed symbols" msgstr "" -#: elf32-cris.c:3298 +#: elf32-cris.c:3288 msgid "%B: uses non-prefixed symbols, but writing file with _-prefixed symbols" msgstr "" -#: elf32-cris.c:3317 +#: elf32-cris.c:3307 msgid "%B contains CRIS v32 code, incompatible with previous objects" msgstr "" -#: elf32-cris.c:3319 +#: elf32-cris.c:3309 msgid "%B contains non-CRIS-v32 code, incompatible with previous objects" msgstr "" @@ -1028,119 +1143,93 @@ msgstr "" msgid "relocation requires zero addend" msgstr "" -#: elf32-frv.c:2901 +#: elf32-frv.c:2905 msgid "%B(%A+0x%x): relocation to `%s+%x' may have caused the error above" msgstr "" -#: elf32-frv.c:2914 -msgid "relocation references symbol not defined in the module" -msgstr "" - -#: elf32-frv.c:2990 +#: elf32-frv.c:2994 msgid "R_FRV_GETTLSOFF not applied to a call instruction" msgstr "" -#: elf32-frv.c:3032 +#: elf32-frv.c:3036 msgid "R_FRV_GOTTLSDESC12 not applied to an lddi instruction" msgstr "" -#: elf32-frv.c:3103 +#: elf32-frv.c:3107 msgid "R_FRV_GOTTLSDESCHI not applied to a sethi instruction" msgstr "" -#: elf32-frv.c:3140 +#: elf32-frv.c:3144 msgid "R_FRV_GOTTLSDESCLO not applied to a setlo or setlos instruction" msgstr "" -#: elf32-frv.c:3188 +#: elf32-frv.c:3192 msgid "R_FRV_TLSDESC_RELAX not applied to an ldd instruction" msgstr "" -#: elf32-frv.c:3272 +#: elf32-frv.c:3276 msgid "R_FRV_GETTLSOFF_RELAX not applied to a calll instruction" msgstr "" -#: elf32-frv.c:3327 +#: elf32-frv.c:3331 msgid "R_FRV_GOTTLSOFF12 not applied to an ldi instruction" msgstr "" -#: elf32-frv.c:3357 +#: elf32-frv.c:3361 msgid "R_FRV_GOTTLSOFFHI not applied to a sethi instruction" msgstr "" -#: elf32-frv.c:3386 +#: elf32-frv.c:3390 msgid "R_FRV_GOTTLSOFFLO not applied to a setlo or setlos instruction" msgstr "" -#: elf32-frv.c:3417 +#: elf32-frv.c:3421 msgid "R_FRV_TLSOFF_RELAX not applied to an ld instruction" msgstr "" -#: elf32-frv.c:3462 +#: elf32-frv.c:3466 msgid "R_FRV_TLSMOFFHI not applied to a sethi instruction" msgstr "" -#: elf32-frv.c:3489 +#: elf32-frv.c:3493 msgid "R_FRV_TLSMOFFLO not applied to a setlo or setlos instruction" msgstr "" -#: elf32-frv.c:3610 +#: elf32-frv.c:3614 msgid "R_FRV_FUNCDESC references dynamic symbol with nonzero addend" msgstr "" -#: elf32-frv.c:3649 elf32-frv.c:3762 -msgid "cannot emit fixups in read-only section" -msgstr "" - -#: elf32-frv.c:3675 elf32-frv.c:3802 -msgid "cannot emit dynamic relocations in read-only section" -msgstr "" - -#: elf32-frv.c:3720 +#: elf32-frv.c:3734 msgid "R_FRV_FUNCDESC_VALUE references dynamic symbol with nonzero addend" msgstr "" -#: elf32-frv.c:3970 elf32-frv.c:4126 +#: elf32-frv.c:3991 elf32-frv.c:4147 msgid "%B(%A+0x%lx): reloc against `%s': %s" msgstr "" -#: elf32-frv.c:3972 elf32-frv.c:3976 +#: elf32-frv.c:3993 elf32-frv.c:3997 msgid "relocation references a different segment" msgstr "" -#: elf32-frv.c:6324 -msgid "%B: unsupported relocation type %i" -msgstr "" - -#: elf32-frv.c:6642 +#: elf32-frv.c:6744 #, c-format msgid "" "%s: compiled with %s and linked with modules that use non-pic relocations" msgstr "" -#: elf32-frv.c:6695 elf32-iq2000.c:801 elf32-m32c.c:785 +#: elf32-frv.c:6797 elf32-iq2000.c:808 elf32-m32c.c:819 #, c-format msgid "%s: compiled with %s and linked with modules compiled with %s" msgstr "" -#: elf32-frv.c:6707 +#: elf32-frv.c:6809 #, c-format msgid "" "%s: uses different unknown e_flags (0x%lx) fields than previous modules (0x%" "lx)" msgstr "" -#: elf32-frv.c:6728 -#, c-format -msgid "%s: cannot link non-fdpic object file into fdpic executable" -msgstr "" - -#: elf32-frv.c:6732 -#, c-format -msgid "%s: cannot link fdpic object file into non-fdpic executable" -msgstr "" - -#: elf32-frv.c:6757 elf32-iq2000.c:838 elf32-m32c.c:821 elf32-ms1.c:596 +#: elf32-frv.c:6859 elf32-iq2000.c:845 elf32-m32c.c:855 elf32-mt.c:586 #, c-format msgid "private flags = 0x%lx:" msgstr "" @@ -1149,423 +1238,461 @@ msgstr "" msgid "%B: Relocations in generic ELF (EM: %d)" msgstr "" -#: elf32-hppa.c:569 elf32-m68hc1x.c:161 elf64-ppc.c:3660 -msgid "%B: cannot create stub entry %s" -msgstr "" - -#: elf32-hppa.c:822 elf32-hppa.c:3411 +#: elf32-hppa.c:843 elf32-hppa.c:3576 msgid "%B(%A+0x%lx): cannot reach %s, recompile with -ffunction-sections" msgstr "" -#: elf32-hppa.c:1212 +#: elf32-hppa.c:1252 msgid "" "%B: relocation %s can not be used when making a shared object; recompile " "with -fPIC" msgstr "" -#: elf32-hppa.c:1405 +#: elf32-hppa.c:1505 #, c-format msgid "Could not find relocation section for %s" msgstr "" -#: elf32-hppa.c:2677 +#: elf32-hppa.c:2794 msgid "%B: duplicate export stub %s" msgstr "" -#: elf32-hppa.c:3266 +#: elf32-hppa.c:3412 msgid "" "%B(%A+0x%lx): %s fixup for insn 0x%x is not supported in a non-shared link" msgstr "" -#: elf32-hppa.c:3895 +#: elf32-hppa.c:4266 msgid "%B(%A+0x%lx): cannot handle %s for %s" msgstr "" -#: elf32-hppa.c:4189 +#: elf32-hppa.c:4573 msgid ".got section not immediately after .plt section" msgstr "" -#: elf32-i386.c:327 elf32-s390.c:368 elf64-ppc.c:2124 elf64-s390.c:390 -#: elf64-x86-64.c:204 +#: elf32-i386.c:363 elf32-ppc.c:1615 elf32-s390.c:379 elf64-ppc.c:2147 +#: elf64-s390.c:403 elf64-x86-64.c:220 msgid "%B: invalid relocation type %d" msgstr "" -#: elf32-i386.c:1015 elf32-s390.c:1171 elf32-sh.c:6389 elf64-s390.c:1133 -#: elfxx-sparc.c:1144 +#: elf32-i386.c:1084 elf32-s390.c:1185 elf32-sh.c:5062 elf64-s390.c:1149 +#: elfxx-sparc.c:1241 msgid "%B: `%s' accessed both as normal and thread local symbol" msgstr "" -#: elf32-i386.c:1130 elf32-s390.c:1280 elf64-ppc.c:4731 elf64-s390.c:1245 -#: elf64-x86-64.c:910 +#: elf32-i386.c:1199 elf32-s390.c:1294 elf64-ppc.c:4863 elf64-s390.c:1261 +#: elf64-x86-64.c:1050 msgid "%B: bad relocation section name `%s'" msgstr "" -#: elf32-i386.c:2149 +#: elf32-i386.c:2252 msgid "%B: unrecognized relocation (0x%x) in section `%A'" msgstr "" -#: elf32-i386.c:2409 +#: elf32-i386.c:2474 msgid "" "%B: relocation R_386_GOTOFF against protected function `%s' can not be used " "when making a shared object" msgstr "" -#: elf32-ip2k.c:853 elf32-ip2k.c:859 elf32-ip2k.c:926 elf32-ip2k.c:932 +#: elf32-ip2k.c:868 elf32-ip2k.c:874 elf32-ip2k.c:941 elf32-ip2k.c:947 msgid "" "ip2k relaxer: switch table without complete matching relocation information." msgstr "" -#: elf32-ip2k.c:876 elf32-ip2k.c:959 +#: elf32-ip2k.c:891 elf32-ip2k.c:974 msgid "ip2k relaxer: switch table header corrupt." msgstr "" -#: elf32-ip2k.c:1301 +#: elf32-ip2k.c:1316 #, c-format msgid "ip2k linker: missing page instruction at 0x%08lx (dest = 0x%08lx)." msgstr "" -#: elf32-ip2k.c:1317 +#: elf32-ip2k.c:1332 #, c-format msgid "ip2k linker: redundant page instruction at 0x%08lx (dest = 0x%08lx)." msgstr "" #. Only if it's not an unresolved symbol. -#: elf32-ip2k.c:1481 +#: elf32-ip2k.c:1506 msgid "unsupported relocation between data/insn address spaces" msgstr "" -#: elf32-iq2000.c:814 elf32-m32c.c:797 +#: elf32-iq2000.c:821 elf32-m32c.c:831 #, c-format msgid "%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)" msgstr "" -#: elf32-m32r.c:1436 +#: elf32-m32r.c:1452 msgid "SDA relocation when _SDA_BASE_ not defined" msgstr "" -#: elf32-m32r.c:3048 +#: elf32-m32r.c:3060 msgid "%B: The target (%s) of an %s relocation is in the wrong section (%A)" msgstr "" -#: elf32-m32r.c:3576 +#: elf32-m32r.c:3588 msgid "%B: Instruction set mismatch with previous modules" msgstr "" -#: elf32-m32r.c:3597 +#: elf32-m32r.c:3609 #, c-format msgid "private flags = %lx" msgstr "" -#: elf32-m32r.c:3602 +#: elf32-m32r.c:3614 #, c-format msgid ": m32r instructions" msgstr "" -#: elf32-m32r.c:3603 +#: elf32-m32r.c:3615 #, c-format msgid ": m32rx instructions" msgstr "" -#: elf32-m32r.c:3604 +#: elf32-m32r.c:3616 #, c-format msgid ": m32r2 instructions" msgstr "" -#: elf32-m68hc1x.c:1106 +#: elf32-m68hc1x.c:1044 #, c-format msgid "" "Reference to the far symbol `%s' using a wrong relocation may result in " "incorrect execution" msgstr "" -#: elf32-m68hc1x.c:1129 +#: elf32-m68hc1x.c:1067 #, c-format msgid "" "banked address [%lx:%04lx] (%lx) is not in the same bank as current banked " "address [%lx:%04lx] (%lx)" msgstr "" -#: elf32-m68hc1x.c:1148 +#: elf32-m68hc1x.c:1086 #, c-format msgid "" "reference to a banked address [%lx:%04lx] in the normal address space at %" "04lx" msgstr "" -#: elf32-m68hc1x.c:1281 +#: elf32-m68hc1x.c:1219 msgid "" "%B: linking files compiled for 16-bit integers (-mshort) and others for 32-" "bit integers" msgstr "" -#: elf32-m68hc1x.c:1288 +#: elf32-m68hc1x.c:1226 msgid "" "%B: linking files compiled for 32-bit double (-fshort-double) and others for " "64-bit double" msgstr "" -#: elf32-m68hc1x.c:1297 +#: elf32-m68hc1x.c:1235 msgid "%B: linking files compiled for HCS12 with others compiled for HC12" msgstr "" -#: elf32-m68hc1x.c:1313 elf32-ppc.c:3576 elf64-sparc.c:696 elfxx-mips.c:9894 +#: elf32-m68hc1x.c:1251 elf32-ppc.c:3733 elf64-sparc.c:696 elfxx-mips.c:11271 msgid "%B: uses different e_flags (0x%lx) fields than previous modules (0x%lx)" msgstr "" -#: elf32-m68hc1x.c:1341 +#: elf32-m68hc1x.c:1279 #, c-format msgid "[abi=32-bit int, " msgstr "" -#: elf32-m68hc1x.c:1343 +#: elf32-m68hc1x.c:1281 #, c-format msgid "[abi=16-bit int, " msgstr "" -#: elf32-m68hc1x.c:1346 +#: elf32-m68hc1x.c:1284 #, c-format msgid "64-bit double, " msgstr "" -#: elf32-m68hc1x.c:1348 +#: elf32-m68hc1x.c:1286 #, c-format msgid "32-bit double, " msgstr "" -#: elf32-m68hc1x.c:1351 +#: elf32-m68hc1x.c:1289 #, c-format msgid "cpu=HC11]" msgstr "" -#: elf32-m68hc1x.c:1353 +#: elf32-m68hc1x.c:1291 #, c-format msgid "cpu=HCS12]" msgstr "" -#: elf32-m68hc1x.c:1355 +#: elf32-m68hc1x.c:1293 #, c-format msgid "cpu=HC12]" msgstr "" -#: elf32-m68hc1x.c:1358 +#: elf32-m68hc1x.c:1296 #, c-format msgid " [memory=bank-model]" msgstr "" -#: elf32-m68hc1x.c:1360 +#: elf32-m68hc1x.c:1298 #, c-format msgid " [memory=flat]" msgstr "" -#: elf32-m68k.c:431 -#, c-format -msgid " [cpu32]" +#: elf32-m68k.c:634 elf32-m68k.c:635 +msgid "unknown" msgstr "" -#: elf32-m68k.c:434 -#, c-format -msgid " [m68000]" -msgstr "" - -#: elf32-mcore.c:98 elf32-mcore.c:428 +#: elf32-mcore.c:98 elf32-mcore.c:441 msgid "%B: Relocation %s (%d) is not currently supported.\n" msgstr "" -#: elf32-mcore.c:414 +#: elf32-mcore.c:427 msgid "%B: Unknown relocation type %d\n" msgstr "" -#: elf32-mips.c:971 elf64-mips.c:1929 elfn32-mips.c:1774 -msgid "literal relocation occurs for an external symbol" +#: elf32-mep.c:809 +msgid "%B and %B are for different cores" msgstr "" -#: elf32-mips.c:1011 elf64-mips.c:1972 elfn32-mips.c:1815 -msgid "32bits gp relative relocation occurs for an external symbol" +#: elf32-mep.c:826 +msgid "%B and %B are for different configurations" msgstr "" -#: elf32-mips.c:1134 elf64-mips.c:2066 elfn32-mips.c:1915 +#: elf32-mep.c:864 #, c-format -msgid "Linking mips16 objects into %s format is not supported" +msgid "private flags = 0x%lx" +msgstr "" + +#: elf32-mips.c:987 elf64-mips.c:1961 elfn32-mips.c:1806 +msgid "literal relocation occurs for an external symbol" +msgstr "" + +#: elf32-mips.c:1027 elf32-score.c:483 elf64-mips.c:2004 elfn32-mips.c:1847 +msgid "32bits gp relative relocation occurs for an external symbol" msgstr "" -#: elf32-ppc.c:1652 +#: elf32-ppc.c:1680 #, c-format msgid "generic linker can't handle %s" msgstr "" -#: elf32-ppc.c:2080 +#: elf32-ppc.c:2162 msgid "corrupt or empty %s section in %B" msgstr "" -#: elf32-ppc.c:2087 +#: elf32-ppc.c:2169 msgid "unable to read in %s section from %B" msgstr "" -#: elf32-ppc.c:2093 +#: elf32-ppc.c:2175 msgid "corrupt %s section in %B" msgstr "" -#: elf32-ppc.c:2136 +#: elf32-ppc.c:2218 msgid "warning: unable to set size of %s section in %B" msgstr "" -#: elf32-ppc.c:2183 +#: elf32-ppc.c:2266 msgid "failed to allocate space for new APUinfo section." msgstr "" -#: elf32-ppc.c:2202 +#: elf32-ppc.c:2285 msgid "failed to compute new APUinfo section." msgstr "" -#: elf32-ppc.c:2205 +#: elf32-ppc.c:2288 msgid "failed to install new APUinfo section." msgstr "" -#: elf32-ppc.c:2941 +#: elf32-ppc.c:3021 msgid "%B: relocation %s cannot be used when making a shared object" msgstr "" #. It does not make sense to have a procedure linkage #. table entry for a local symbol. -#: elf32-ppc.c:3211 +#: elf32-ppc.c:3291 msgid "%B(%A+0x%lx): %s reloc against local symbol" msgstr "" -#: elf32-ppc.c:3541 +#: elf32-ppc.c:3632 elf32-ppc.c:3636 elfxx-mips.c:11015 elfxx-mips.c:11034 +#: elfxx-mips.c:11049 +msgid "Warning: %B uses hard float, %B uses soft float" +msgstr "" + +#: elf32-ppc.c:3639 elf32-ppc.c:3643 elfxx-mips.c:10996 elfxx-mips.c:11000 +msgid "Warning: %B uses unknown floating point ABI %d" +msgstr "" + +#: elf32-ppc.c:3698 msgid "" "%B: compiled with -mrelocatable and linked with modules compiled normally" msgstr "" -#: elf32-ppc.c:3549 +#: elf32-ppc.c:3706 msgid "" "%B: compiled normally and linked with modules compiled with -mrelocatable" msgstr "" -#: elf32-ppc.c:5768 elf64-ppc.c:10186 +#: elf32-ppc.c:3792 +msgid "Using bss-plt due to %B" +msgstr "" + +#: elf32-ppc.c:5997 elf64-ppc.c:10489 msgid "%B: unknown relocation type %d for symbol %s" msgstr "" -#: elf32-ppc.c:6018 +#: elf32-ppc.c:6247 msgid "%B(%A+0x%lx): non-zero addend on %s reloc against `%s'" msgstr "" -#: elf32-ppc.c:6365 elf32-ppc.c:6391 elf32-ppc.c:6450 +#: elf32-ppc.c:6592 elf32-ppc.c:6618 elf32-ppc.c:6677 msgid "" "%B: the target (%s) of a %s relocation is in the wrong output section (%s)" msgstr "" -#: elf32-ppc.c:6505 +#: elf32-ppc.c:6732 msgid "%B: relocation %s is not yet supported for symbol %s." msgstr "" -#: elf32-ppc.c:6610 elf64-ppc.c:10872 +#: elf32-ppc.c:6840 elf64-ppc.c:11184 msgid "%B(%A+0x%lx): %s reloc against `%s': error %d" msgstr "" -#: elf32-s390.c:2253 elf64-s390.c:2225 +#: elf32-s390.c:2238 elf64-s390.c:2212 msgid "%B(%A+0x%lx): invalid instruction for TLS relocation %s" msgstr "" -#: elf32-sh64.c:218 elf64-sh64.c:2322 +#: elf32-score.c:1417 elfxx-mips.c:2695 +msgid "not enough GOT space for local GOT entries" +msgstr "" + +#: elf32-score.c:2549 +#, c-format +msgid "%s: Malformed reloc detected for section %s" +msgstr "" + +#: elf32-score.c:2600 +msgid "%B: CALL15 reloc at 0x%lx not against global symbol" +msgstr "" + +#: elf32-score.c:3755 +#, c-format +msgid " [pic]" +msgstr "" + +#: elf32-score.c:3759 +#, c-format +msgid " [fix dep]" +msgstr "" + +#: elf32-score.c:3801 elfxx-mips.c:11180 +msgid "%B: warning: linking PIC files with non-PIC files" +msgstr "" + +#: elf32-sh64.c:221 elf64-sh64.c:2349 #, c-format msgid "%s: compiled as 32-bit object and %s is 64-bit" msgstr "" -#: elf32-sh64.c:221 elf64-sh64.c:2325 +#: elf32-sh64.c:224 elf64-sh64.c:2352 #, c-format msgid "%s: compiled as 64-bit object and %s is 32-bit" msgstr "" -#: elf32-sh64.c:223 elf64-sh64.c:2327 +#: elf32-sh64.c:226 elf64-sh64.c:2354 #, c-format msgid "%s: object size does not match that of target %s" msgstr "" -#: elf32-sh64.c:446 elf64-sh64.c:2899 +#: elf32-sh64.c:449 elf64-sh64.c:2893 #, c-format msgid "%s: encountered datalabel symbol in input" msgstr "" -#: elf32-sh64.c:523 +#: elf32-sh64.c:526 msgid "PTB mismatch: a SHmedia address (bit 0 == 1)" msgstr "" -#: elf32-sh64.c:526 +#: elf32-sh64.c:529 msgid "PTA mismatch: a SHcompact address (bit 0 == 0)" msgstr "" -#: elf32-sh64.c:544 +#: elf32-sh64.c:547 #, c-format msgid "%s: GAS error: unexpected PTB insn with R_SH_PT_16" msgstr "" -#: elf32-sh64.c:593 +#: elf32-sh64.c:596 msgid "%B: error: unaligned relocation type %d at %08x reloc %p\n" msgstr "" -#: elf32-sh64.c:669 +#: elf32-sh64.c:672 #, c-format msgid "%s: could not write out added .cranges entries" msgstr "" -#: elf32-sh64.c:729 +#: elf32-sh64.c:732 #, c-format msgid "%s: could not write out sorted .cranges entries" msgstr "" -#: elf32-sh.c:2176 +#: elf32-sh.c:532 msgid "%B: 0x%lx: warning: bad R_SH_USES offset" msgstr "" -#: elf32-sh.c:2188 +#: elf32-sh.c:544 msgid "%B: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x" msgstr "" -#: elf32-sh.c:2205 +#: elf32-sh.c:561 msgid "%B: 0x%lx: warning: bad R_SH_USES load offset" msgstr "" -#: elf32-sh.c:2220 +#: elf32-sh.c:576 msgid "%B: 0x%lx: warning: could not find expected reloc" msgstr "" -#: elf32-sh.c:2248 +#: elf32-sh.c:604 msgid "%B: 0x%lx: warning: symbol in unexpected section" msgstr "" -#: elf32-sh.c:2361 +#: elf32-sh.c:730 msgid "%B: 0x%lx: warning: could not find expected COUNT reloc" msgstr "" -#: elf32-sh.c:2370 +#: elf32-sh.c:739 msgid "%B: 0x%lx: warning: bad count" msgstr "" -#: elf32-sh.c:2765 elf32-sh.c:3135 +#: elf32-sh.c:1143 elf32-sh.c:1513 msgid "%B: 0x%lx: fatal: reloc overflow while relaxing" msgstr "" -#: elf32-sh.c:4566 elf64-sh64.c:1509 +#: elf32-sh.c:3248 elf64-sh64.c:1525 msgid "Unexpected STO_SH5_ISA32 on local symbol is not handled" msgstr "" -#: elf32-sh.c:4791 +#: elf32-sh.c:3485 msgid "%B: 0x%lx: fatal: unaligned branch target for relax-support relocation" msgstr "" -#: elf32-sh.c:4824 elf32-sh.c:4839 +#: elf32-sh.c:3518 elf32-sh.c:3533 msgid "%B: 0x%lx: fatal: unaligned %s relocation 0x%lx" msgstr "" -#: elf32-sh.c:4853 +#: elf32-sh.c:3547 msgid "%B: 0x%lx: fatal: R_SH_PSHA relocation %d not in range -32..32" msgstr "" -#: elf32-sh.c:4867 +#: elf32-sh.c:3561 msgid "%B: 0x%lx: fatal: R_SH_PSHL relocation %d not in range -32..32" msgstr "" -#: elf32-sh.c:6601 elf64-alpha.c:4466 +#: elf32-sh.c:5274 elf64-alpha.c:4531 msgid "%B: TLS local exec code cannot be linked into shared objects" msgstr "" @@ -1581,57 +1708,138 @@ msgstr "" msgid "%B: Failed to add renamed symbol %s" msgstr "" -#: elf32-sparc.c:87 +#: elf32-sparc.c:88 msgid "%B: compiled for a 64 bit system and target is 32 bit" msgstr "" -#: elf32-sparc.c:100 +#: elf32-sparc.c:101 msgid "%B: linking little endian files with big endian files" msgstr "" -#: elf32-v850.c:160 +#: elf32-spu.c:995 +msgid "warning: call to non-function symbol %s defined in %B" +msgstr "" + +#: elf32-spu.c:1315 +msgid "%B is not allowed to define %s" +msgstr "" + +#: elf32-spu.c:1352 +#, c-format +msgid "%s in overlay section" +msgstr "" + +#: elf32-spu.c:1363 +msgid "overlay stub relocation overflow" +msgstr "" + +#: elf32-spu.c:1820 +#, c-format +msgid "warning: %s overlaps %s\n" +msgstr "" + +#: elf32-spu.c:1836 +#, c-format +msgid "warning: %s exceeds section size\n" +msgstr "" + +#: elf32-spu.c:1867 +msgid "%A:0x%v not found in function table\n" +msgstr "" + +#: elf32-spu.c:1958 +msgid "" +"%B(%A+0x%v): call to non-code section %B(%A), stack analysis incomplete\n" +msgstr "" + +#: elf32-spu.c:2079 +#, c-format +msgid "%A link_order not found\n" +msgstr "" + +#: elf32-spu.c:2358 +#, c-format +msgid "Stack analysis will ignore the call from %s to %s\n" +msgstr "" + +#: elf32-spu.c:2513 +msgid "%s: 0x%v 0x%v\n" +msgstr "" + +#: elf32-spu.c:2517 +msgid " calls:\n" +msgstr "" + +#: elf32-spu.c:2524 +#, c-format +msgid " %s%s %s\n" +msgstr "" + +#: elf32-spu.c:2585 +msgid "Stack size for call graph root nodes.\n" +msgstr "" + +#: elf32-spu.c:2586 +msgid "" +"\n" +"Stack size for functions. Annotations: '*' max stack, 't' tail call\n" +msgstr "" + +#: elf32-spu.c:2615 +msgid " %s: 0x%v\n" +msgstr "" + +#: elf32-spu.c:2625 +msgid "Maximum stack required is 0x%v\n" +msgstr "" + +#: elf32-spu.c:2751 +msgid "%B(%s+0x%lx): unresolvable %s relocation against symbol `%s'" +msgstr "" + +#: elf32-v850.c:162 #, c-format msgid "Variable `%s' cannot occupy in multiple small data regions" msgstr "" -#: elf32-v850.c:163 +#: elf32-v850.c:165 #, c-format msgid "" "Variable `%s' can only be in one of the small, zero, and tiny data regions" msgstr "" -#: elf32-v850.c:166 +#: elf32-v850.c:168 #, c-format msgid "" "Variable `%s' cannot be in both small and zero data regions simultaneously" msgstr "" -#: elf32-v850.c:169 +#: elf32-v850.c:171 #, c-format msgid "" "Variable `%s' cannot be in both small and tiny data regions simultaneously" msgstr "" -#: elf32-v850.c:172 +#: elf32-v850.c:174 #, c-format msgid "" "Variable `%s' cannot be in both zero and tiny data regions simultaneously" msgstr "" -#: elf32-v850.c:475 +#: elf32-v850.c:477 #, c-format msgid "FAILED to find previous HI16 reloc\n" msgstr "" -#: elf32-v850.c:1684 +#: elf32-v850.c:1712 msgid "could not locate special linker symbol __gp" msgstr "" -#: elf32-v850.c:1688 +#: elf32-v850.c:1716 msgid "could not locate special linker symbol __ep" msgstr "" -#: elf32-v850.c:1692 +#: elf32-v850.c:1720 msgid "could not locate special linker symbol __ctbp" msgstr "" @@ -1659,145 +1867,144 @@ msgstr "" msgid "v850e1 architecture" msgstr "" -#: elf32-vax.c:531 +#: elf32-vax.c:540 #, c-format msgid " [nonpic]" msgstr "" -#: elf32-vax.c:534 +#: elf32-vax.c:543 #, c-format msgid " [d-float]" msgstr "" -#: elf32-vax.c:537 +#: elf32-vax.c:546 #, c-format msgid " [g-float]" msgstr "" -#: elf32-vax.c:647 +#: elf32-vax.c:656 #, c-format msgid "" "%s: warning: GOT addend of %ld to `%s' does not match previous GOT addend of " "%ld" msgstr "" -#: elf32-vax.c:1604 +#: elf32-vax.c:1583 #, c-format msgid "%s: warning: PLT addend of %d to `%s' from %s section ignored" msgstr "" -#: elf32-vax.c:1728 +#: elf32-vax.c:1720 #, c-format msgid "%s: warning: %s relocation against symbol `%s' from %s section" msgstr "" -#: elf32-vax.c:1734 +#: elf32-vax.c:1726 #, c-format msgid "%s: warning: %s relocation to 0x%x from %s section" msgstr "" -#: elf32-xstormy16.c:425 elf32-ia64.c:2563 elf64-ia64.c:2563 +#: elf32-xstormy16.c:451 elf32-ia64.c:2961 elf64-ia64.c:2961 msgid "non-zero addend in @fptr reloc" msgstr "" -#: elf32-xtensa.c:705 +#: elf32-xtensa.c:733 msgid "%B(%A): invalid property table" msgstr "" -#: elf32-xtensa.c:2199 +#: elf32-xtensa.c:2177 msgid "%B(%A+0x%lx): relocation offset out of range (size=0x%x)" msgstr "" -#: elf32-xtensa.c:2256 +#: elf32-xtensa.c:2234 msgid "dynamic relocation in read-only section" msgstr "" -#: elf32-xtensa.c:2421 +#: elf32-xtensa.c:2407 msgid "internal inconsistency in size of .got.loc section" msgstr "" -#: elf32-xtensa.c:2735 +#: elf32-xtensa.c:2714 msgid "%B: incompatible machine type. Output is 0x%x. Input is 0x%x" msgstr "" -#: elf32-xtensa.c:3881 elf32-xtensa.c:3889 +#: elf32-xtensa.c:3920 elf32-xtensa.c:3928 msgid "Attempt to convert L32R/CALLX to CALL failed" msgstr "" -#: elf32-xtensa.c:5467 elf32-xtensa.c:5543 elf32-xtensa.c:6496 -#: elf32-xtensa.c:6550 +#: elf32-xtensa.c:5522 elf32-xtensa.c:5598 elf32-xtensa.c:6714 msgid "" "%B(%A+0x%lx): could not decode instruction; possible configuration mismatch" msgstr "" -#: elf32-xtensa.c:6369 elf32-xtensa.c:6532 +#: elf32-xtensa.c:6454 msgid "" "%B(%A+0x%lx): could not decode instruction for XTENSA_ASM_SIMPLIFY " "relocation; possible configuration mismatch" msgstr "" -#: elf32-xtensa.c:7855 +#: elf32-xtensa.c:8166 msgid "invalid relocation address" msgstr "" -#: elf32-xtensa.c:7904 +#: elf32-xtensa.c:8215 msgid "overflow after relaxation" msgstr "" -#: elf32-xtensa.c:9032 +#: elf32-xtensa.c:9341 msgid "%B(%A+0x%lx): unexpected fix for %s relocation" msgstr "" -#: elf64-alpha.c:443 +#: elf64-alpha.c:451 msgid "GPDISP relocation did not find ldah and lda instructions" msgstr "" -#: elf64-alpha.c:2363 +#: elf64-alpha.c:2402 msgid "%B: .got subsegment exceeds 64K (size %d)" msgstr "" -#: elf64-alpha.c:4210 elf64-alpha.c:4222 +#: elf64-alpha.c:4275 elf64-alpha.c:4287 msgid "%B: gp-relative relocation against dynamic symbol %s" msgstr "" -#: elf64-alpha.c:4248 elf64-alpha.c:4383 +#: elf64-alpha.c:4313 elf64-alpha.c:4448 msgid "%B: pc-relative relocation against dynamic symbol %s" msgstr "" -#: elf64-alpha.c:4276 +#: elf64-alpha.c:4341 msgid "%B: change in gp: BRSGP %s" msgstr "" -#: elf64-alpha.c:4301 +#: elf64-alpha.c:4366 msgid "<unknown>" msgstr "" -#: elf64-alpha.c:4306 +#: elf64-alpha.c:4371 msgid "%B: !samegp reloc against symbol without .prologue: %s" msgstr "" -#: elf64-alpha.c:4358 +#: elf64-alpha.c:4423 msgid "%B: unhandled dynamic relocation against %s" msgstr "" -#: elf64-alpha.c:4390 +#: elf64-alpha.c:4455 msgid "%B: pc-relative relocation against undefined weak symbol %s" msgstr "" -#: elf64-alpha.c:4450 +#: elf64-alpha.c:4515 msgid "%B: dtp-relative relocation against dynamic symbol %s" msgstr "" -#: elf64-alpha.c:4473 +#: elf64-alpha.c:4538 msgid "%B: tp-relative relocation against dynamic symbol %s" msgstr "" -#: elf64-hppa.c:2046 +#: elf64-hppa.c:2039 #, c-format msgid "stub entry for %s cannot load .plt, dp offset = %ld" msgstr "" -#: elf64-mmix.c:1163 +#: elf64-mmix.c:1175 #, c-format msgid "" "%s: Internal inconsistency error for value for\n" @@ -1805,126 +2012,122 @@ msgid "" "08lx\n" msgstr "" -#: elf64-mmix.c:1602 +#: elf64-mmix.c:1616 #, c-format msgid "" "%s: base-plus-offset relocation against register symbol: (unknown) in %s" msgstr "" -#: elf64-mmix.c:1607 +#: elf64-mmix.c:1621 #, c-format msgid "%s: base-plus-offset relocation against register symbol: %s in %s" msgstr "" -#: elf64-mmix.c:1651 +#: elf64-mmix.c:1665 #, c-format msgid "%s: register relocation against non-register symbol: (unknown) in %s" msgstr "" -#: elf64-mmix.c:1656 +#: elf64-mmix.c:1670 #, c-format msgid "%s: register relocation against non-register symbol: %s in %s" msgstr "" -#: elf64-mmix.c:1693 +#: elf64-mmix.c:1707 #, c-format msgid "%s: directive LOCAL valid only with a register or absolute value" msgstr "" -#: elf64-mmix.c:1721 +#: elf64-mmix.c:1735 #, c-format msgid "" "%s: LOCAL directive: Register $%ld is not a local register. First global " "register is $%ld." msgstr "" -#: elf64-mmix.c:2207 +#: elf64-mmix.c:2200 #, c-format msgid "" "%s: Error: multiple definition of `%s'; start of %s is set in a earlier " "linked file\n" msgstr "" -#: elf64-mmix.c:2265 +#: elf64-mmix.c:2258 msgid "Register section has contents\n" msgstr "" -#: elf64-mmix.c:2457 +#: elf64-mmix.c:2450 #, c-format msgid "" "Internal inconsistency: remaining %u != max %u.\n" " Please report this bug." msgstr "" -#: elf64-ppc.c:2500 libbfd.c:931 +#: elf64-ppc.c:2568 libbfd.c:948 msgid "%B: compiled for a big endian system and target is little endian" msgstr "" -#: elf64-ppc.c:2503 libbfd.c:933 +#: elf64-ppc.c:2571 libbfd.c:950 msgid "%B: compiled for a little endian system and target is big endian" msgstr "" -#: elf64-ppc.c:5707 +#: elf64-ppc.c:5887 #, c-format msgid "" "copy reloc against `%s' requires lazy plt linking; avoid setting " "LD_BIND_NOW=1 or upgrade gcc" msgstr "" -#: elf64-ppc.c:6155 +#: elf64-ppc.c:6315 msgid "dynreloc miscount for %B, section %A" msgstr "" -#: elf64-ppc.c:6257 +#: elf64-ppc.c:6419 msgid "%B: .opd is not a regular array of opd entries" msgstr "" -#: elf64-ppc.c:6266 +#: elf64-ppc.c:6428 msgid "%B: unexpected reloc type %u in .opd section" msgstr "" -#: elf64-ppc.c:6287 +#: elf64-ppc.c:6449 msgid "%B: undefined sym `%s' in .opd section" msgstr "" -#: elf64-ppc.c:6939 elf64-ppc.c:7318 +#: elf64-ppc.c:7156 elf64-ppc.c:7536 #, c-format msgid "%s defined in removed toc entry" msgstr "" -#: elf64-ppc.c:8041 +#: elf64-ppc.c:8271 #, c-format msgid "long branch stub `%s' offset overflow" msgstr "" -#: elf64-ppc.c:8116 +#: elf64-ppc.c:8346 #, c-format msgid "can't find branch stub `%s'" msgstr "" -#: elf64-ppc.c:8155 elf64-ppc.c:8231 +#: elf64-ppc.c:8412 elf64-ppc.c:8488 #, c-format msgid "linkage table error against `%s'" msgstr "" -#: elf64-ppc.c:8360 +#: elf64-ppc.c:8617 #, c-format msgid "can't build branch stub `%s'" msgstr "" -#: elf64-ppc.c:8784 +#: elf64-ppc.c:9069 msgid "%B section %A exceeds stub group size" msgstr "" -#: elf64-ppc.c:9295 -msgid ".glink and .plt too far apart" -msgstr "" - -#: elf64-ppc.c:9408 +#: elf64-ppc.c:9681 msgid "stubs don't match calculated size" msgstr "" -#: elf64-ppc.c:9420 +#: elf64-ppc.c:9693 #, c-format msgid "" "linker stubs in %u group%s\n" @@ -1935,28 +2138,28 @@ msgid "" " plt call %lu" msgstr "" -#: elf64-ppc.c:10075 +#: elf64-ppc.c:10377 msgid "" "%B(%A+0x%lx): automatic multiple TOCs not supported using your crt files; " "recompile with -mminimal-toc or upgrade gcc" msgstr "" -#: elf64-ppc.c:10083 +#: elf64-ppc.c:10385 msgid "" "%B(%A+0x%lx): sibling call optimization to `%s' does not allow automatic " "multiple TOCs; recompile with -mminimal-toc or -fno-optimize-sibling-calls, " "or make `%s' extern" msgstr "" -#: elf64-ppc.c:10727 +#: elf64-ppc.c:11036 msgid "%B: relocation %s is not supported for symbol %s." msgstr "" -#: elf64-ppc.c:10806 +#: elf64-ppc.c:11118 msgid "%B: error: relocation %s not a multiple of %d" msgstr "" -#: elf64-sh64.c:1676 +#: elf64-sh64.c:1700 #, c-format msgid "%s: error: unaligned relocation type %d at %08x reloc %08x\n" msgstr "" @@ -1981,471 +2184,519 @@ msgstr "" msgid "%B: linking UltraSPARC specific with HAL specific code" msgstr "" -#: elf64-x86-64.c:692 elf64-x86-64.c:818 elf64-x86-64.c:2069 +#: elf64-x86-64.c:798 elf64-x86-64.c:958 elf64-x86-64.c:2359 msgid "" "%B: relocation %s against `%s' can not be used when making a shared object; " "recompile with -fPIC" msgstr "" -#: elf64-x86-64.c:760 +#: elf64-x86-64.c:889 msgid "%B: %s' accessed both as normal and thread local symbol" msgstr "" -#: elf64-x86-64.c:2000 +#: elf64-x86-64.c:2271 msgid "" "%B: relocation R_X86_64_GOTOFF64 against protected function `%s' can not be " "used when making a shared object" msgstr "" -#: elf64-x86-64.c:2065 +#: elf64-x86-64.c:2355 msgid "" "%B: relocation R_X86_64_PC32 against protected function `%s' can not be used " "when making a shared object" msgstr "" -#: elf.c:288 +#: elf-attrs.c:581 +msgid "ERROR: %B: Must be processed by '%s' toolchain" +msgstr "" + +#: elf-attrs.c:601 elf-attrs.c:620 +msgid "ERROR: %B: Incompatible object tag '%s':%d" +msgstr "" + +#: elf.c:309 msgid "%B: invalid string offset %u >= %lu for section `%s'" msgstr "" -#: elf.c:552 +#: elf.c:411 +msgid "%B symbol number %lu references nonexistent SHT_SYMTAB_SHNDX section" +msgstr "" + +#: elf.c:564 +msgid "%B: Corrupt size field in group section header: 0x%lx" +msgstr "" + +#: elf.c:600 msgid "%B: invalid SHT_GROUP entry" msgstr "" -#: elf.c:622 +#: elf.c:670 msgid "%B: no group info for section %A" msgstr "" -#: elf.c:652 elf.c:3091 elflink.c:7588 +#: elf.c:700 elf.c:3251 elflink.c:9120 msgid "%B: warning: sh_link not set for section `%A'" msgstr "" -#: elf.c:688 +#: elf.c:716 +msgid "%B: sh_link [%d] in section `%A' is incorrect" +msgstr "" + +#: elf.c:751 msgid "%B: unknown [%d] section `%s' in group [%s]" msgstr "" -#: elf.c:1071 +#: elf.c:1160 #, c-format msgid "" "\n" "Program Header:\n" msgstr "" -#: elf.c:1123 +#: elf.c:1202 #, c-format msgid "" "\n" "Dynamic Section:\n" msgstr "" -#: elf.c:1248 +#: elf.c:1328 #, c-format msgid "" "\n" "Version definitions:\n" msgstr "" -#: elf.c:1273 +#: elf.c:1353 #, c-format msgid "" "\n" "Version References:\n" msgstr "" -#: elf.c:1278 +#: elf.c:1358 #, c-format msgid " required from %s:\n" msgstr "" -#: elf.c:1985 +#: elf.c:2054 msgid "%B: invalid link %lu for reloc section %s (index %u)" msgstr "" -#: elf.c:3062 +#: elf.c:2222 +msgid "" +"%B: don't know how to handle allocated, application specific section `%s' [0x" +"%8x]" +msgstr "" + +#: elf.c:2234 +msgid "%B: don't know how to handle processor specific section `%s' [0x%8x]" +msgstr "" + +#: elf.c:2245 +msgid "%B: don't know how to handle OS specific section `%s' [0x%8x]" +msgstr "" + +#: elf.c:2255 +msgid "%B: don't know how to handle section `%s' [0x%8x]" +msgstr "" + +#: elf.c:3208 msgid "%B: sh_link of section `%A' points to discarded section `%A' of `%B'" msgstr "" -#: elf.c:4070 -msgid "%B: Not enough room for program headers (allocated %u, need %u)" +#: elf.c:3231 +msgid "%B: sh_link of section `%A' points to removed section `%A' of `%B'" msgstr "" -#: elf.c:4173 +#: elf.c:4472 msgid "" "%B: The first section in the PT_DYNAMIC segment is not the .dynamic section" msgstr "" -#: elf.c:4217 +#: elf.c:4495 msgid "%B: Not enough room for program headers, try linking with -N" msgstr "" -#: elf.c:4308 +#: elf.c:4573 msgid "%B: section %A lma 0x%lx overlaps previous sections" msgstr "" -#: elf.c:4709 +#: elf.c:4671 +msgid "%B: section `%A' can't be allocated in segment %d" +msgstr "" + +#: elf.c:4720 msgid "%B: warning: allocated section `%s' not in segment" msgstr "" -#: elf.c:5002 +#: elf.c:5209 msgid "%B: symbol `%s' required but not present" msgstr "" -#: elf.c:5299 +#: elf.c:5522 msgid "%B: warning: Empty loadable segment detected, is this intentional ?\n" msgstr "" -#: elf.c:5961 +#: elf.c:6425 #, c-format msgid "" "Unable to find equivalent output section for symbol '%s' from section '%s'" msgstr "" -#: elf.c:6917 +#: elf.c:7399 msgid "%B: unsupported relocation type %s" msgstr "" -#: elfcode.h:1110 +#: elfcode.h:810 +#, c-format +msgid "warning: %s has a corrupt string table index - ignoring" +msgstr "" + +#: elfcode.h:1176 #, c-format msgid "%s: version count (%ld) does not match symbol count (%ld)" msgstr "" -#: elfcode.h:1337 +#: elfcode.h:1409 #, c-format msgid "%s(%s): relocation %d has invalid symbol index %ld" msgstr "" -#: elf-hppa.h:1443 elf-hppa.h:1458 +#: elf-eh-frame.c:822 +msgid "" +"%P: fde encoding in %B(%A) prevents .eh_frame_hdr table being created.\n" +msgstr "" + +#: elf-eh-frame.c:973 +msgid "%P: error in %B(%A); no .eh_frame_hdr table will be created.\n" +msgstr "" + +#: elf-hppa.h:2218 elf-hppa.h:2232 msgid "%B(%A): warning: unresolvable relocation against symbol `%s'" msgstr "" -#: elflink.c:907 +#: elflink.c:1004 msgid "" "%s: TLS definition in %B section %A mismatches non-TLS definition in %B " "section %A" msgstr "" -#: elflink.c:911 +#: elflink.c:1008 msgid "%s: TLS reference in %B mismatches non-TLS reference in %B" msgstr "" -#: elflink.c:915 +#: elflink.c:1012 msgid "%s: TLS definition in %B section %A mismatches non-TLS reference in %B" msgstr "" -#: elflink.c:919 +#: elflink.c:1016 msgid "%s: TLS reference in %B mismatches non-TLS definition in %B section %A" msgstr "" -#: elflink.c:1491 +#: elflink.c:1630 msgid "%B: unexpected redefinition of indirect versioned symbol `%s'" msgstr "" -#: elflink.c:1807 -msgid "%B: undefined versioned symbol name %s" +#: elflink.c:1950 +msgid "%B: version node not found for symbol %s" msgstr "" -#: elflink.c:1955 +#: elflink.c:2098 msgid "" "%B: bad reloc symbol index (0x%lx >= 0x%lx) for offset 0x%lx in section `%A'" msgstr "" -#: elflink.c:2147 +#: elflink.c:2290 msgid "%B: relocation size mismatch in %B section %A" msgstr "" -#: elflink.c:2437 +#: elflink.c:2598 #, c-format msgid "warning: type and size of dynamic symbol `%s' are not defined" msgstr "" -#: elflink.c:2761 -msgid "warning: creating a DT_TEXTREL in a shared object." -msgstr "" - -#: elflink.c:3696 +#: elflink.c:3893 msgid "%B: %s: invalid version %u (max %d)" msgstr "" -#: elflink.c:3732 +#: elflink.c:3929 msgid "%B: %s: invalid needed version %d" msgstr "" -#: elflink.c:3912 +#: elflink.c:4112 +msgid "" +"Warning: alignment %u of common symbol `%s' in %B is greater than the " +"alignment (%u) of its section %A" +msgstr "" + +#: elflink.c:4118 msgid "Warning: alignment %u of symbol `%s' in %B is smaller than %u in %B" msgstr "" -#: elflink.c:3924 +#: elflink.c:4133 msgid "Warning: size of symbol `%s' changed from %lu in %B to %lu in %B" msgstr "" -#: elflink.c:4091 +#: elflink.c:4309 #, c-format msgid "%s: invalid DSO for symbol `%s' definition" msgstr "" -#: elflink.c:5152 +#: elflink.c:5535 #, c-format msgid "%s: undefined version: %s" msgstr "" -#: elflink.c:5219 +#: elflink.c:5603 msgid "%B: .preinit_array section is not allowed in DSO" msgstr "" -#: elflink.c:5978 +#: elflink.c:6621 +#, c-format +msgid "undefined %s reference in complex symbol: %s" +msgstr "" + +#: elflink.c:6776 +#, c-format +msgid "unknown operator '%c' in complex symbol" +msgstr "" + +#: elflink.c:7315 elflink.c:7332 elflink.c:7369 elflink.c:7386 +msgid "%B: Unable to sort relocs - they are in more than one size" +msgstr "" + +#: elflink.c:7346 elflink.c:7400 +msgid "%B: Unable to sort relocs - they are of an unknown size" +msgstr "" + +#: elflink.c:7449 msgid "Not enough memory to sort relocations" msgstr "" -#: elflink.c:6369 +#: elflink.c:7636 +msgid "%B: Too many sections: %d (>= %d)" +msgstr "" + +#: elflink.c:7870 msgid "%B: %s symbol `%s' in %B is referenced by DSO" msgstr "" -#: elflink.c:6452 +#: elflink.c:7953 msgid "%B: could not find output section %A for input section %A" msgstr "" -#: elflink.c:6549 +#: elflink.c:8050 msgid "%B: %s symbol `%s' isn't defined" msgstr "" -#: elflink.c:7024 +#: elflink.c:8546 msgid "" "error: %B contains a reloc (0x%s) for section %A that references a non-" "existent global symbol" msgstr "" -#: elflink.c:7058 +#: elflink.c:8580 msgid "" "%X`%s' referenced in section `%A' of %B: defined in discarded section `%A' " "of %B\n" msgstr "" -#: elflink.c:7665 +#: elflink.c:9198 msgid "%A has both ordered [`%A' in %B] and unordered [`%A' in %B] sections" msgstr "" -#: elflink.c:7670 +#: elflink.c:9203 #, c-format msgid "%A has both ordered and unordered sections" msgstr "" -#: elflink.c:8487 elflink.c:8528 +#: elflink.c:10090 elflink.c:10134 msgid "%B: could not find output section %s" msgstr "" -#: elflink.c:8492 +#: elflink.c:10095 #, c-format msgid "warning: %s section has zero size" msgstr "" -#: elflink.c:9087 +#: elflink.c:10199 +msgid "%P: warning: creating a DT_TEXTREL in a shared object.\n" +msgstr "" + +#: elflink.c:10567 +msgid "Removing unused section '%s' in file '%B'" +msgstr "" + +#: elflink.c:10758 msgid "Warning: gc-sections option ignored" msgstr "" -#: elflink.c:9704 +#: elflink.c:11249 +msgid "%P%X: can not read symbols: %E\n" +msgstr "" + +#: elflink.c:11391 msgid "%B: ignoring duplicate section `%A'" msgstr "" -#: elflink.c:9711 elflink.c:9718 +#: elflink.c:11398 elflink.c:11405 msgid "%B: duplicate section `%A' has different size" msgstr "" -#: elflink.c:9726 elflink.c:9731 +#: elflink.c:11413 elflink.c:11418 msgid "%B: warning: could not read contents of section `%A'" msgstr "" -#: elflink.c:9735 +#: elflink.c:11422 msgid "%B: warning: duplicate section `%A' has different contents" msgstr "" -#: elfxx-mips.c:866 -msgid "static procedure (no name)" +#: elf-m10300.c:1531 +msgid "" +"error: inappropriate relocation type for shared library (did you forget -" +"fpic?)" msgstr "" -#: elfxx-mips.c:2513 -msgid "not enough GOT space for local GOT entries" +#: elf-m10300.c:1534 +msgid "internal error: suspicious relocation type used in shared library" +msgstr "" + +#: elfxx-mips.c:986 +msgid "static procedure (no name)" msgstr "" -#: elfxx-mips.c:4356 +#: elfxx-mips.c:4657 msgid "%B: %A+0x%lx: jump to stub routine which is not jal" msgstr "" -#: elfxx-mips.c:4993 elfxx-mips.c:5214 +#: elfxx-mips.c:5320 elfxx-mips.c:5540 msgid "%B: Warning: bad `%s' option size %u smaller than its header" msgstr "" -#: elfxx-mips.c:5965 +#: elfxx-mips.c:6399 msgid "%B: Malformed reloc detected for section %s" msgstr "" -#: elfxx-mips.c:6041 +#: elfxx-mips.c:6441 +msgid "%B: GOT reloc at 0x%lx not expected in executables" +msgstr "" + +#: elfxx-mips.c:6511 msgid "%B: CALL16 reloc at 0x%lx not against global symbol" msgstr "" -#: elfxx-mips.c:9380 +#: elfxx-mips.c:7874 +msgid "" +"%B: Can't find matching LO16 reloc against `%s' for %s at 0x%lx in section `%" +"A'" +msgstr "" + +#: elfxx-mips.c:10640 #, c-format msgid "%s: illegal section name `%s'" msgstr "" -#: elfxx-mips.c:9719 -msgid "%B: endianness incompatible with that of the selected emulation" +#: elfxx-mips.c:11010 elfxx-mips.c:11029 +msgid "Warning: %B uses -msingle-float, %B uses -mdouble-float" msgstr "" -#: elfxx-mips.c:9731 -msgid "%B: ABI is incompatible with that of the selected emulation" +#: elfxx-mips.c:11085 +msgid "%B: endianness incompatible with that of the selected emulation" msgstr "" -#: elfxx-mips.c:9803 -msgid "%B: warning: linking PIC files with non-PIC files" +#: elfxx-mips.c:11097 +msgid "%B: ABI is incompatible with that of the selected emulation" msgstr "" -#: elfxx-mips.c:9820 +#: elfxx-mips.c:11197 msgid "%B: linking 32-bit code with 64-bit code" msgstr "" -#: elfxx-mips.c:9848 +#: elfxx-mips.c:11225 msgid "%B: linking %s module with previous %s modules" msgstr "" -#: elfxx-mips.c:9871 +#: elfxx-mips.c:11248 msgid "%B: ABI mismatch: linking %s module with previous %s modules" msgstr "" -#: elfxx-mips.c:9936 +#: elfxx-mips.c:11313 #, c-format msgid " [abi=O32]" msgstr "" -#: elfxx-mips.c:9938 +#: elfxx-mips.c:11315 #, c-format msgid " [abi=O64]" msgstr "" -#: elfxx-mips.c:9940 +#: elfxx-mips.c:11317 #, c-format msgid " [abi=EABI32]" msgstr "" -#: elfxx-mips.c:9942 +#: elfxx-mips.c:11319 #, c-format msgid " [abi=EABI64]" msgstr "" -#: elfxx-mips.c:9944 +#: elfxx-mips.c:11321 #, c-format msgid " [abi unknown]" msgstr "" -#: elfxx-mips.c:9946 +#: elfxx-mips.c:11323 #, c-format msgid " [abi=N32]" msgstr "" -#: elfxx-mips.c:9948 +#: elfxx-mips.c:11325 #, c-format msgid " [abi=64]" msgstr "" -#: elfxx-mips.c:9950 +#: elfxx-mips.c:11327 #, c-format msgid " [no abi set]" msgstr "" -#: elfxx-mips.c:9953 -#, c-format -msgid " [mips1]" -msgstr "" - -#: elfxx-mips.c:9955 -#, c-format -msgid " [mips2]" -msgstr "" - -#: elfxx-mips.c:9957 -#, c-format -msgid " [mips3]" -msgstr "" - -#: elfxx-mips.c:9959 -#, c-format -msgid " [mips4]" -msgstr "" - -#: elfxx-mips.c:9961 -#, c-format -msgid " [mips5]" -msgstr "" - -#: elfxx-mips.c:9963 -#, c-format -msgid " [mips32]" -msgstr "" - -#: elfxx-mips.c:9965 -#, c-format -msgid " [mips64]" -msgstr "" - -#: elfxx-mips.c:9967 -#, c-format -msgid " [mips32r2]" -msgstr "" - -#: elfxx-mips.c:9969 -#, c-format -msgid " [mips64r2]" -msgstr "" - -#: elfxx-mips.c:9971 +#: elfxx-mips.c:11348 #, c-format msgid " [unknown ISA]" msgstr "" -#: elfxx-mips.c:9974 -#, c-format -msgid " [mdmx]" -msgstr "" - -#: elfxx-mips.c:9977 -#, c-format -msgid " [mips16]" -msgstr "" - -#: elfxx-mips.c:9980 -#, c-format -msgid " [32bitmode]" -msgstr "" - -#: elfxx-mips.c:9982 +#: elfxx-mips.c:11359 #, c-format msgid " [not 32bitmode]" msgstr "" -#: elfxx-sparc.c:402 +#: elfxx-sparc.c:428 #, c-format msgid "invalid relocation type %d" msgstr "" -#: elfxx-sparc.c:2783 +#: elfxx-sparc.c:2899 msgid "%B: probably compiled without -fPIC?" msgstr "" -#: i386linux.c:457 m68klinux.c:461 sparclinux.c:458 +#: i386linux.c:454 m68klinux.c:458 sparclinux.c:453 #, c-format msgid "Output file requires shared library `%s'\n" msgstr "" -#: i386linux.c:465 m68klinux.c:469 sparclinux.c:466 +#: i386linux.c:462 m68klinux.c:466 sparclinux.c:461 #, c-format msgid "Output file requires shared library `%s.so.%s'\n" msgstr "" -#: i386linux.c:654 i386linux.c:704 m68klinux.c:661 m68klinux.c:709 -#: sparclinux.c:656 sparclinux.c:706 +#: i386linux.c:651 i386linux.c:701 m68klinux.c:658 m68klinux.c:706 +#: sparclinux.c:651 sparclinux.c:701 #, c-format msgid "Symbol %s not defined for fixups\n" msgstr "" -#: i386linux.c:728 m68klinux.c:733 sparclinux.c:730 +#: i386linux.c:725 m68klinux.c:730 sparclinux.c:725 msgid "Warning: fixup count mismatch\n" msgstr "" @@ -2479,161 +2730,161 @@ msgstr "" msgid "%B:%u: bad checksum in Intel Hex file (expected %u, found %u)" msgstr "" -#: ihex.c:389 +#: ihex.c:390 msgid "%B:%u: bad extended address record length in Intel Hex file" msgstr "" -#: ihex.c:406 +#: ihex.c:407 msgid "%B:%u: bad extended start address length in Intel Hex file" msgstr "" -#: ihex.c:423 +#: ihex.c:424 msgid "%B:%u: bad extended linear address record length in Intel Hex file" msgstr "" -#: ihex.c:440 +#: ihex.c:441 msgid "%B:%u: bad extended linear start address length in Intel Hex file" msgstr "" -#: ihex.c:457 +#: ihex.c:458 msgid "%B:%u: unrecognized ihex type %u in Intel Hex file" msgstr "" -#: ihex.c:578 +#: ihex.c:577 msgid "%B: internal error in ihex_read_section" msgstr "" -#: ihex.c:612 +#: ihex.c:611 msgid "%B: bad section length in ihex_read_section" msgstr "" -#: ihex.c:824 +#: ihex.c:823 #, c-format msgid "%s: address 0x%s out of range for Intel Hex file" msgstr "" -#: libbfd.c:961 +#: libbfd.c:978 #, c-format msgid "Deprecated %s called at %s line %d in %s\n" msgstr "" -#: libbfd.c:964 +#: libbfd.c:981 #, c-format msgid "Deprecated %s called\n" msgstr "" -#: linker.c:1873 +#: linker.c:1877 msgid "%B: indirect symbol `%s' to `%s' is a loop" msgstr "" -#: linker.c:2740 +#: linker.c:2743 #, c-format msgid "Attempt to do relocatable link with %s input and %s output" msgstr "" -#: linker.c:3037 +#: linker.c:3044 msgid "%B: warning: ignoring duplicate section `%A'\n" msgstr "" -#: linker.c:3051 +#: linker.c:3058 msgid "%B: warning: duplicate section `%A' has different size\n" msgstr "" -#: merge.c:817 +#: merge.c:818 #, c-format msgid "%s: access beyond end of merged section (%ld)" msgstr "" -#: mmo.c:456 +#: mmo.c:454 #, c-format msgid "%s: No core to allocate section name %s\n" msgstr "" -#: mmo.c:531 +#: mmo.c:529 #, c-format msgid "%s: No core to allocate a symbol %d bytes long\n" msgstr "" -#: mmo.c:1187 +#: mmo.c:1185 #, c-format msgid "%s: invalid mmo file: initialization value for $255 is not `Main'\n" msgstr "" -#: mmo.c:1332 +#: mmo.c:1330 #, c-format msgid "" "%s: unsupported wide character sequence 0x%02X 0x%02X after symbol name " "starting with `%s'\n" msgstr "" -#: mmo.c:1566 +#: mmo.c:1564 #, c-format msgid "%s: invalid mmo file: unsupported lopcode `%d'\n" msgstr "" -#: mmo.c:1576 +#: mmo.c:1574 #, c-format msgid "%s: invalid mmo file: expected YZ = 1 got YZ = %d for lop_quote\n" msgstr "" -#: mmo.c:1612 +#: mmo.c:1610 #, c-format msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_loc\n" msgstr "" -#: mmo.c:1658 +#: mmo.c:1656 #, c-format msgid "" "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_fixo\n" msgstr "" -#: mmo.c:1697 +#: mmo.c:1695 #, c-format msgid "%s: invalid mmo file: expected y = 0, got y = %d for lop_fixrx\n" msgstr "" -#: mmo.c:1706 +#: mmo.c:1704 #, c-format msgid "" "%s: invalid mmo file: expected z = 16 or z = 24, got z = %d for lop_fixrx\n" msgstr "" -#: mmo.c:1729 +#: mmo.c:1727 #, c-format msgid "" "%s: invalid mmo file: leading byte of operand word must be 0 or 1, got %d " "for lop_fixrx\n" msgstr "" -#: mmo.c:1752 +#: mmo.c:1750 #, c-format msgid "%s: cannot allocate file name for file number %d, %d bytes\n" msgstr "" -#: mmo.c:1772 +#: mmo.c:1770 #, c-format msgid "" "%s: invalid mmo file: file number %d `%s', was already entered as `%s'\n" msgstr "" -#: mmo.c:1785 +#: mmo.c:1783 #, c-format msgid "" "%s: invalid mmo file: file name for number %d was not specified before use\n" msgstr "" -#: mmo.c:1892 +#: mmo.c:1890 #, c-format msgid "" "%s: invalid mmo file: fields y and z of lop_stab non-zero, y: %d, z: %d\n" msgstr "" -#: mmo.c:1928 +#: mmo.c:1926 #, c-format msgid "%s: invalid mmo file: lop_end not last item in file\n" msgstr "" -#: mmo.c:1941 +#: mmo.c:1939 #, c-format msgid "" "%s: invalid mmo file: YZ of lop_end (%ld) not equal to the number of tetras " @@ -2686,7 +2937,7 @@ msgid "" "08lx\n" msgstr "" -#: oasys.c:876 +#: oasys.c:880 #, c-format msgid "%s: can not represent section `%s' in oasys" msgstr "" @@ -2697,37 +2948,37 @@ msgid "Unhandled OSF/1 core file section type %d\n" msgstr "" #. XXX code yet to be written. -#: peicode.h:731 +#: peicode.h:757 msgid "%B: Unhandled import type; %x" msgstr "" -#: peicode.h:736 +#: peicode.h:762 msgid "%B: Unrecognised import type; %x" msgstr "" -#: peicode.h:750 +#: peicode.h:776 msgid "%B: Unrecognised import name type; %x" msgstr "" -#: peicode.h:1120 +#: peicode.h:1159 msgid "%B: Unrecognised machine type (0x%x) in Import Library Format archive" msgstr "" -#: peicode.h:1132 +#: peicode.h:1171 msgid "" "%B: Recognised but unhandled machine type (0x%x) in Import Library Format " "archive" msgstr "" -#: peicode.h:1150 +#: peicode.h:1189 msgid "%B: size field is zero in Import Library Format header" msgstr "" -#: peicode.h:1181 +#: peicode.h:1220 msgid "%B: string not null terminated in ILF object file." msgstr "" -#: pe-mips.c:588 +#: pe-mips.c:605 msgid "%B: `ld -r' not supported with PE MIPS objects\n" msgstr "" @@ -2735,75 +2986,75 @@ msgstr "" #. src = VMA of the memory we're fixing up #. mem = pointer to memory we're fixing up #. val = VMA of what we need to refer to. -#: pe-mips.c:704 +#: pe-mips.c:721 msgid "%B: unimplemented %s\n" msgstr "" -#: pe-mips.c:730 +#: pe-mips.c:747 msgid "%B: jump too far away\n" msgstr "" -#: pe-mips.c:756 +#: pe-mips.c:773 msgid "%B: bad pair/reflo after refhi\n" msgstr "" -#: ppcboot.c:419 +#: ppcboot.c:412 #, c-format msgid "" "\n" "ppcboot header:\n" msgstr "" -#: ppcboot.c:420 +#: ppcboot.c:413 #, c-format msgid "Entry offset = 0x%.8lx (%ld)\n" msgstr "" -#: ppcboot.c:421 +#: ppcboot.c:414 #, c-format msgid "Length = 0x%.8lx (%ld)\n" msgstr "" -#: ppcboot.c:424 +#: ppcboot.c:417 #, c-format msgid "Flag field = 0x%.2x\n" msgstr "" -#: ppcboot.c:430 +#: ppcboot.c:423 #, c-format msgid "Partition name = \"%s\"\n" msgstr "" -#: ppcboot.c:449 +#: ppcboot.c:442 #, c-format msgid "" "\n" "Partition[%d] start = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" msgstr "" -#: ppcboot.c:455 +#: ppcboot.c:448 #, c-format msgid "Partition[%d] end = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" msgstr "" -#: ppcboot.c:461 +#: ppcboot.c:454 #, c-format msgid "Partition[%d] sector = 0x%.8lx (%ld)\n" msgstr "" -#: ppcboot.c:462 +#: ppcboot.c:455 #, c-format msgid "Partition[%d] length = 0x%.8lx (%ld)\n" msgstr "" -#: som.c:5069 +#: som.c:5088 #, c-format msgid "" "\n" "Exec Auxiliary Header\n" msgstr "" -#: som.c:5330 +#: som.c:5349 msgid "som_sizeof_headers unimplemented" msgstr "" @@ -2811,11 +3062,11 @@ msgstr "" msgid "%B:%d: Unexpected character `%s' in S-record file\n" msgstr "" -#: stabs.c:276 +#: stabs.c:277 msgid "%B(%A+0x%lx): Stabs entry has invalid string index." msgstr "" -#: syms.c:1048 +#: syms.c:1056 msgid "Unsupported .stab relocation" msgstr "" @@ -2978,316 +3229,320 @@ msgstr "" msgid "Unhandled relocation %s" msgstr "" -#: xcofflink.c:564 +#: xcofflink.c:565 #, c-format msgid "%s: XCOFF shared object when not producing XCOFF output" msgstr "" -#: xcofflink.c:585 +#: xcofflink.c:586 #, c-format msgid "%s: dynamic object with no .loader section" msgstr "" -#: xcofflink.c:1148 +#: xcofflink.c:1149 msgid "%B: `%s' has line numbers but no enclosing section" msgstr "" -#: xcofflink.c:1200 +#: xcofflink.c:1201 msgid "%B: class %d symbol `%s' has no aux entries" msgstr "" -#: xcofflink.c:1223 +#: xcofflink.c:1224 msgid "%B: symbol `%s' has unrecognized csect type %d" msgstr "" -#: xcofflink.c:1235 +#: xcofflink.c:1236 msgid "%B: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d" msgstr "" -#: xcofflink.c:1271 +#: xcofflink.c:1272 msgid "%B: XMC_TC0 symbol `%s' is class %d scnlen %d" msgstr "" -#: xcofflink.c:1417 +#: xcofflink.c:1418 msgid "%B: csect `%s' not in enclosing section" msgstr "" -#: xcofflink.c:1524 +#: xcofflink.c:1525 msgid "%B: misplaced XTY_LD `%s'" msgstr "" -#: xcofflink.c:1839 +#: xcofflink.c:1841 msgid "%B: reloc %s:%d not in csect" msgstr "" -#: xcofflink.c:2637 +#: xcofflink.c:2639 #, c-format msgid "%s: no such symbol" msgstr "" -#: xcofflink.c:2866 +#: xcofflink.c:2868 #, c-format msgid "warning: attempt to export undefined symbol `%s'" msgstr "" -#: xcofflink.c:3033 +#: xcofflink.c:3035 msgid "error: undefined symbol __rtinit" msgstr "" -#: xcofflink.c:3653 +#: xcofflink.c:3655 #, c-format msgid "TOC overflow: 0x%lx > 0x10000; try -mminimal-toc when compiling" msgstr "" -#: xcofflink.c:4489 +#: xcofflink.c:4491 msgid "%B: loader reloc in unrecognized section `%A'" msgstr "" -#: xcofflink.c:4510 +#: xcofflink.c:4512 msgid "%B: `%s' in loader reloc but not loader sym" msgstr "" -#: xcofflink.c:4525 +#: xcofflink.c:4527 msgid "%B: loader reloc in read-only section %A" msgstr "" -#: xcofflink.c:4934 xcofflink.c:4996 xcofflink.c:5291 +#: xcofflink.c:4936 xcofflink.c:4998 xcofflink.c:5293 #, c-format msgid "%s: loader reloc in unrecognized section `%s'" msgstr "" -#: xcofflink.c:5302 +#: xcofflink.c:5304 #, c-format msgid "%s: `%s' in loader reloc but not loader sym" msgstr "" -#: elf32-ia64.c:1139 elf64-ia64.c:1139 +#: elf32-ia64.c:1168 elf64-ia64.c:1168 msgid "" "%B: Can't relax br at 0x%lx in section `%A'. Please use brl or indirect " "branch." msgstr "" -#: elf32-ia64.c:2508 elf64-ia64.c:2508 +#: elf32-ia64.c:2909 elf64-ia64.c:2909 msgid "@pltoff reloc against local symbol" msgstr "" -#: elf32-ia64.c:3955 elf64-ia64.c:3955 +#: elf32-ia64.c:4522 elf64-ia64.c:4522 #, c-format msgid "%s: short data segment overflowed (0x%lx >= 0x400000)" msgstr "" -#: elf32-ia64.c:3966 elf64-ia64.c:3966 +#: elf32-ia64.c:4533 elf64-ia64.c:4533 #, c-format msgid "%s: __gp does not cover short data segment" msgstr "" -#: elf32-ia64.c:4213 elf64-ia64.c:4213 +#: elf32-ia64.c:4807 elf64-ia64.c:4807 msgid "%B: non-pic code with imm relocation against dynamic symbol `%s'" msgstr "" -#: elf32-ia64.c:4280 elf64-ia64.c:4280 +#: elf32-ia64.c:4874 elf64-ia64.c:4874 msgid "%B: @gprel relocation against dynamic symbol %s" msgstr "" -#: elf32-ia64.c:4343 elf64-ia64.c:4343 +#: elf32-ia64.c:4937 elf64-ia64.c:4937 msgid "%B: linking non-pic code in a position independent executable" msgstr "" -#: elf32-ia64.c:4480 elf64-ia64.c:4480 +#: elf32-ia64.c:5074 elf64-ia64.c:5074 msgid "%B: @internal branch to dynamic symbol %s" msgstr "" -#: elf32-ia64.c:4482 elf64-ia64.c:4482 +#: elf32-ia64.c:5076 elf64-ia64.c:5076 msgid "%B: speculation fixup to dynamic symbol %s" msgstr "" -#: elf32-ia64.c:4484 elf64-ia64.c:4484 +#: elf32-ia64.c:5078 elf64-ia64.c:5078 msgid "%B: @pcrel relocation against dynamic symbol %s" msgstr "" -#: elf32-ia64.c:4691 elf64-ia64.c:4691 +#: elf32-ia64.c:5278 elf64-ia64.c:5278 msgid "unsupported reloc" msgstr "" -#: elf32-ia64.c:4724 elf64-ia64.c:4724 +#: elf32-ia64.c:5311 elf64-ia64.c:5311 msgid "" "%B: Can't relax br (%s) to `%s' at 0x%lx in section `%A' with size 0x%lx (> " "0x1000000)." msgstr "" -#: elf32-ia64.c:4985 elf64-ia64.c:4985 +#: elf32-ia64.c:5572 elf64-ia64.c:5572 msgid "%B: linking trap-on-NULL-dereference with non-trapping files" msgstr "" -#: elf32-ia64.c:4994 elf64-ia64.c:4994 +#: elf32-ia64.c:5581 elf64-ia64.c:5581 msgid "%B: linking big-endian files with little-endian files" msgstr "" -#: elf32-ia64.c:5003 elf64-ia64.c:5003 +#: elf32-ia64.c:5590 elf64-ia64.c:5590 msgid "%B: linking 64-bit files with 32-bit files" msgstr "" -#: elf32-ia64.c:5012 elf64-ia64.c:5012 +#: elf32-ia64.c:5599 elf64-ia64.c:5599 msgid "%B: linking constant-gp files with non-constant-gp files" msgstr "" -#: elf32-ia64.c:5022 elf64-ia64.c:5022 +#: elf32-ia64.c:5609 elf64-ia64.c:5609 msgid "%B: linking auto-pic files with non-auto-pic files" msgstr "" -#: peigen.c:979 pepigen.c:979 +#: peigen.c:998 pepigen.c:998 pex64igen.c:998 #, c-format msgid "%s: line number overflow: 0x%lx > 0xffff" msgstr "" -#: peigen.c:1006 pepigen.c:1006 +#: peigen.c:1025 pepigen.c:1025 pex64igen.c:1025 msgid "Export Directory [.edata (or where ever we found it)]" msgstr "" -#: peigen.c:1007 pepigen.c:1007 +#: peigen.c:1026 pepigen.c:1026 pex64igen.c:1026 msgid "Import Directory [parts of .idata]" msgstr "" -#: peigen.c:1008 pepigen.c:1008 +#: peigen.c:1027 pepigen.c:1027 pex64igen.c:1027 msgid "Resource Directory [.rsrc]" msgstr "" -#: peigen.c:1009 pepigen.c:1009 +#: peigen.c:1028 pepigen.c:1028 pex64igen.c:1028 msgid "Exception Directory [.pdata]" msgstr "" -#: peigen.c:1010 pepigen.c:1010 +#: peigen.c:1029 pepigen.c:1029 pex64igen.c:1029 msgid "Security Directory" msgstr "" -#: peigen.c:1011 pepigen.c:1011 +#: peigen.c:1030 pepigen.c:1030 pex64igen.c:1030 msgid "Base Relocation Directory [.reloc]" msgstr "" -#: peigen.c:1012 pepigen.c:1012 +#: peigen.c:1031 pepigen.c:1031 pex64igen.c:1031 msgid "Debug Directory" msgstr "" -#: peigen.c:1013 pepigen.c:1013 +#: peigen.c:1032 pepigen.c:1032 pex64igen.c:1032 msgid "Description Directory" msgstr "" -#: peigen.c:1014 pepigen.c:1014 +#: peigen.c:1033 pepigen.c:1033 pex64igen.c:1033 msgid "Special Directory" msgstr "" -#: peigen.c:1015 pepigen.c:1015 +#: peigen.c:1034 pepigen.c:1034 pex64igen.c:1034 msgid "Thread Storage Directory [.tls]" msgstr "" -#: peigen.c:1016 pepigen.c:1016 +#: peigen.c:1035 pepigen.c:1035 pex64igen.c:1035 msgid "Load Configuration Directory" msgstr "" -#: peigen.c:1017 pepigen.c:1017 +#: peigen.c:1036 pepigen.c:1036 pex64igen.c:1036 msgid "Bound Import Directory" msgstr "" -#: peigen.c:1018 pepigen.c:1018 +#: peigen.c:1037 pepigen.c:1037 pex64igen.c:1037 msgid "Import Address Table Directory" msgstr "" -#: peigen.c:1019 pepigen.c:1019 +#: peigen.c:1038 pepigen.c:1038 pex64igen.c:1038 msgid "Delay Import Directory" msgstr "" -#: peigen.c:1020 peigen.c:1021 pepigen.c:1020 pepigen.c:1021 +#: peigen.c:1039 pepigen.c:1039 pex64igen.c:1039 +msgid "CLR Runtime Header" +msgstr "" + +#: peigen.c:1040 pepigen.c:1040 pex64igen.c:1040 msgid "Reserved" msgstr "" -#: peigen.c:1081 pepigen.c:1081 +#: peigen.c:1100 pepigen.c:1100 pex64igen.c:1100 #, c-format msgid "" "\n" "There is an import table, but the section containing it could not be found\n" msgstr "" -#: peigen.c:1086 pepigen.c:1086 +#: peigen.c:1105 pepigen.c:1105 pex64igen.c:1105 #, c-format msgid "" "\n" "There is an import table in %s at 0x%lx\n" msgstr "" -#: peigen.c:1129 pepigen.c:1129 +#: peigen.c:1148 pepigen.c:1148 pex64igen.c:1148 #, c-format msgid "" "\n" "Function descriptor located at the start address: %04lx\n" msgstr "" -#: peigen.c:1132 pepigen.c:1132 +#: peigen.c:1151 pepigen.c:1151 pex64igen.c:1151 #, c-format msgid "\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n" msgstr "" -#: peigen.c:1140 pepigen.c:1140 +#: peigen.c:1159 pepigen.c:1159 pex64igen.c:1159 #, c-format msgid "" "\n" "No reldata section! Function descriptor not decoded.\n" msgstr "" -#: peigen.c:1145 pepigen.c:1145 +#: peigen.c:1164 pepigen.c:1164 pex64igen.c:1164 #, c-format msgid "" "\n" "The Import Tables (interpreted %s section contents)\n" msgstr "" -#: peigen.c:1148 pepigen.c:1148 +#: peigen.c:1167 pepigen.c:1167 pex64igen.c:1167 #, c-format msgid "" " vma: Hint Time Forward DLL First\n" " Table Stamp Chain Name Thunk\n" msgstr "" -#: peigen.c:1196 pepigen.c:1196 +#: peigen.c:1215 pepigen.c:1215 pex64igen.c:1215 #, c-format msgid "" "\n" "\tDLL Name: %s\n" msgstr "" -#: peigen.c:1207 pepigen.c:1207 +#: peigen.c:1226 pepigen.c:1226 pex64igen.c:1226 #, c-format msgid "\tvma: Hint/Ord Member-Name Bound-To\n" msgstr "" -#: peigen.c:1232 pepigen.c:1232 +#: peigen.c:1251 pepigen.c:1251 pex64igen.c:1251 #, c-format msgid "" "\n" "There is a first thunk, but the section containing it could not be found\n" msgstr "" -#: peigen.c:1365 pepigen.c:1365 +#: peigen.c:1416 pepigen.c:1416 pex64igen.c:1416 #, c-format msgid "" "\n" "There is an export table, but the section containing it could not be found\n" msgstr "" -#: peigen.c:1374 pepigen.c:1374 +#: peigen.c:1425 pepigen.c:1425 pex64igen.c:1425 #, c-format msgid "" "\n" "There is an export table in %s, but it does not fit into that section\n" msgstr "" -#: peigen.c:1380 pepigen.c:1380 +#: peigen.c:1431 pepigen.c:1431 pex64igen.c:1431 #, c-format msgid "" "\n" "There is an export table in %s at 0x%lx\n" msgstr "" -#: peigen.c:1408 pepigen.c:1408 +#: peigen.c:1459 pepigen.c:1459 pex64igen.c:1459 #, c-format msgid "" "\n" @@ -3295,128 +3550,128 @@ msgid "" "\n" msgstr "" -#: peigen.c:1412 pepigen.c:1412 +#: peigen.c:1463 pepigen.c:1463 pex64igen.c:1463 #, c-format msgid "Export Flags \t\t\t%lx\n" msgstr "" -#: peigen.c:1415 pepigen.c:1415 +#: peigen.c:1466 pepigen.c:1466 pex64igen.c:1466 #, c-format msgid "Time/Date stamp \t\t%lx\n" msgstr "" -#: peigen.c:1418 pepigen.c:1418 +#: peigen.c:1469 pepigen.c:1469 pex64igen.c:1469 #, c-format msgid "Major/Minor \t\t\t%d/%d\n" msgstr "" -#: peigen.c:1421 pepigen.c:1421 +#: peigen.c:1472 pepigen.c:1472 pex64igen.c:1472 #, c-format msgid "Name \t\t\t\t" msgstr "" -#: peigen.c:1427 pepigen.c:1427 +#: peigen.c:1478 pepigen.c:1478 pex64igen.c:1478 #, c-format msgid "Ordinal Base \t\t\t%ld\n" msgstr "" -#: peigen.c:1430 pepigen.c:1430 +#: peigen.c:1481 pepigen.c:1481 pex64igen.c:1481 #, c-format msgid "Number in:\n" msgstr "" -#: peigen.c:1433 pepigen.c:1433 +#: peigen.c:1484 pepigen.c:1484 pex64igen.c:1484 #, c-format msgid "\tExport Address Table \t\t%08lx\n" msgstr "" -#: peigen.c:1437 pepigen.c:1437 +#: peigen.c:1488 pepigen.c:1488 pex64igen.c:1488 #, c-format msgid "\t[Name Pointer/Ordinal] Table\t%08lx\n" msgstr "" -#: peigen.c:1440 pepigen.c:1440 +#: peigen.c:1491 pepigen.c:1491 pex64igen.c:1491 #, c-format msgid "Table Addresses\n" msgstr "" -#: peigen.c:1443 pepigen.c:1443 +#: peigen.c:1494 pepigen.c:1494 pex64igen.c:1494 #, c-format msgid "\tExport Address Table \t\t" msgstr "" -#: peigen.c:1448 pepigen.c:1448 +#: peigen.c:1499 pepigen.c:1499 pex64igen.c:1499 #, c-format msgid "\tName Pointer Table \t\t" msgstr "" -#: peigen.c:1453 pepigen.c:1453 +#: peigen.c:1504 pepigen.c:1504 pex64igen.c:1504 #, c-format msgid "\tOrdinal Table \t\t\t" msgstr "" -#: peigen.c:1467 pepigen.c:1467 +#: peigen.c:1518 pepigen.c:1518 pex64igen.c:1518 #, c-format msgid "" "\n" "Export Address Table -- Ordinal Base %ld\n" msgstr "" -#: peigen.c:1486 pepigen.c:1486 +#: peigen.c:1537 pepigen.c:1537 pex64igen.c:1537 msgid "Forwarder RVA" msgstr "" -#: peigen.c:1497 pepigen.c:1497 +#: peigen.c:1548 pepigen.c:1548 pex64igen.c:1548 msgid "Export RVA" msgstr "" -#: peigen.c:1504 pepigen.c:1504 +#: peigen.c:1555 pepigen.c:1555 pex64igen.c:1555 #, c-format msgid "" "\n" "[Ordinal/Name Pointer] Table\n" msgstr "" -#: peigen.c:1557 pepigen.c:1557 +#: peigen.c:1608 pepigen.c:1608 pex64igen.c:1608 #, c-format msgid "Warning, .pdata section size (%ld) is not a multiple of %d\n" msgstr "" -#: peigen.c:1561 pepigen.c:1561 +#: peigen.c:1612 pepigen.c:1612 pex64igen.c:1612 #, c-format msgid "" "\n" "The Function Table (interpreted .pdata section contents)\n" msgstr "" -#: peigen.c:1564 pepigen.c:1564 +#: peigen.c:1615 pepigen.c:1615 pex64igen.c:1615 #, c-format msgid " vma:\t\t\tBegin Address End Address Unwind Info\n" msgstr "" -#: peigen.c:1566 pepigen.c:1566 +#: peigen.c:1617 pepigen.c:1617 pex64igen.c:1617 #, c-format msgid "" " vma:\t\tBegin End EH EH PrologEnd Exception\n" " \t\tAddress Address Handler Data Address Mask\n" msgstr "" -#: peigen.c:1636 pepigen.c:1636 +#: peigen.c:1687 pepigen.c:1687 pex64igen.c:1687 #, c-format msgid " Register save millicode" msgstr "" -#: peigen.c:1639 pepigen.c:1639 +#: peigen.c:1690 pepigen.c:1690 pex64igen.c:1690 #, c-format msgid " Register restore millicode" msgstr "" -#: peigen.c:1642 pepigen.c:1642 +#: peigen.c:1693 pepigen.c:1693 pex64igen.c:1693 #, c-format msgid " Glue code sequence" msgstr "" -#: peigen.c:1692 pepigen.c:1692 +#: peigen.c:1743 pepigen.c:1743 pex64igen.c:1743 #, c-format msgid "" "\n" @@ -3424,14 +3679,14 @@ msgid "" "PE File Base Relocations (interpreted .reloc section contents)\n" msgstr "" -#: peigen.c:1722 pepigen.c:1722 +#: peigen.c:1773 pepigen.c:1773 pex64igen.c:1773 #, c-format msgid "" "\n" "Virtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n" msgstr "" -#: peigen.c:1735 pepigen.c:1735 +#: peigen.c:1786 pepigen.c:1786 pex64igen.c:1786 #, c-format msgid "\treloc %4d offset %4x [%4lx] %s" msgstr "" @@ -3439,9 +3694,31 @@ msgstr "" #. The MS dumpbin program reportedly ands with 0xff0f before #. printing the characteristics field. Not sure why. No reason to #. emulate it here. -#: peigen.c:1773 pepigen.c:1773 +#: peigen.c:1825 pepigen.c:1825 pex64igen.c:1825 #, c-format msgid "" "\n" "Characteristics 0x%x\n" msgstr "" + +#: peigen.c:2086 pepigen.c:2086 pex64igen.c:2086 +msgid "%B: unable to fill in DataDictionary[1] because .idata$2 is missing" +msgstr "" + +#: peigen.c:2104 pepigen.c:2104 pex64igen.c:2104 +msgid "%B: unable to fill in DataDictionary[1] because .idata$4 is missing" +msgstr "" + +#: peigen.c:2123 pepigen.c:2123 pex64igen.c:2123 +msgid "%B: unable to fill in DataDictionary[12] because .idata$5 is missing" +msgstr "" + +#: peigen.c:2141 pepigen.c:2141 pex64igen.c:2141 +msgid "" +"%B: unable to fill in DataDictionary[PE_IMPORT_ADDRESS_TABLE (12)] because ." +"idata$6 is missing" +msgstr "" + +#: peigen.c:2161 pepigen.c:2161 pex64igen.c:2161 +msgid "%B: unable to fill in DataDictionary[9] because __tls_used is missing" +msgstr "" diff --git a/contrib/binutils/bfd/ppcboot.c b/contrib/binutils/bfd/ppcboot.c index 7c8a4190bac2..da8c6b8019bd 100644 --- a/contrib/binutils/bfd/ppcboot.c +++ b/contrib/binutils/bfd/ppcboot.c @@ -1,6 +1,6 @@ /* BFD back-end for PPCbug boot records. - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 - Free Software Foundation, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006, + 2007 Free Software Foundation, Inc. Written by Michael Meissner, Cygnus Support, <meissner@cygnus.com> This file is part of BFD, the Binary File Descriptor library. @@ -32,9 +32,9 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. the file. objcopy cooperates by specially setting the start address to zero by default. */ +#include "sysdep.h" #include "safe-ctype.h" #include "bfd.h" -#include "sysdep.h" #include "libbfd.h" /* PPCbug location structure */ @@ -99,7 +99,6 @@ static long ppcboot_canonicalize_symtab PARAMS ((bfd *, asymbol **)); static void ppcboot_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); static bfd_boolean ppcboot_set_section_contents PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type)); -static int ppcboot_sizeof_headers PARAMS ((bfd *, bfd_boolean)); static bfd_boolean ppcboot_bfd_print_private_bfd_data PARAMS ((bfd *, PTR)); #define ppcboot_set_tdata(abfd, ptr) ((abfd)->tdata.any = (PTR) (ptr)) @@ -151,6 +150,7 @@ ppcboot_object_p (abfd) ppcboot_hdr_t hdr; size_t i; ppcboot_data_t *tdata; + flagword flags; BFD_ASSERT (sizeof (ppcboot_hdr_t) == 1024); @@ -205,10 +205,10 @@ ppcboot_object_p (abfd) abfd->symcount = PPCBOOT_SYMS; /* One data section. */ - sec = bfd_make_section (abfd, ".data"); + flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_CODE | SEC_HAS_CONTENTS; + sec = bfd_make_section_with_flags (abfd, ".data", flags); if (sec == NULL) return NULL; - sec->flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_CODE | SEC_HAS_CONTENTS; sec->vma = 0; sec->size = statbuf.st_size - sizeof (ppcboot_hdr_t); sec->filepos = sizeof (ppcboot_hdr_t); @@ -354,12 +354,6 @@ ppcboot_get_symbol_info (ignore_abfd, symbol, ret) #define ppcboot_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define ppcboot_read_minisymbols _bfd_generic_read_minisymbols #define ppcboot_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol - -#define ppcboot_get_reloc_upper_bound \ - ((long (*) PARAMS ((bfd *, asection *))) bfd_0l) -#define ppcboot_canonicalize_reloc \ - ((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) bfd_0l) -#define ppcboot_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup /* Write section contents of a ppcboot file. */ @@ -395,9 +389,8 @@ ppcboot_set_section_contents (abfd, sec, data, offset, size) static int -ppcboot_sizeof_headers (abfd, exec) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_boolean exec ATTRIBUTE_UNUSED; +ppcboot_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return sizeof (ppcboot_hdr_t); } @@ -535,7 +528,7 @@ const bfd_target ppcboot_vec = BFD_JUMP_TABLE_CORE (_bfd_nocore), BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), BFD_JUMP_TABLE_SYMBOLS (ppcboot), - BFD_JUMP_TABLE_RELOCS (ppcboot), + BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), BFD_JUMP_TABLE_WRITE (ppcboot), BFD_JUMP_TABLE_LINK (ppcboot), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), diff --git a/contrib/binutils/bfd/ptrace-core.c b/contrib/binutils/bfd/ptrace-core.c index 4ac28aa1dece..8607225da16f 100644 --- a/contrib/binutils/bfd/ptrace-core.c +++ b/contrib/binutils/bfd/ptrace-core.c @@ -1,6 +1,6 @@ /* BFD backend for core files which use the ptrace_user structure - Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002, 2003, 2004 - Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002, 2003, 2004, + 2006, 2007 Free Software Foundation, Inc. The structure of this file is based on trad-core.c written by John Gilmore of Cygnus Support. Modified to work with the ptrace_user structure by Kevin A. Buettner. @@ -24,8 +24,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. #ifdef PTRACE_CORE -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include <sys/param.h> @@ -63,6 +63,7 @@ ptrace_unix_core_file_p (abfd) struct ptrace_user u; struct trad_core_struct *rawptr; bfd_size_type amt; + flagword flags; val = bfd_bread ((void *)&u, (bfd_size_type) sizeof u, abfd); if (val != sizeof u || u.pt_magic != _BCS_PTRACE_MAGIC @@ -89,13 +90,17 @@ ptrace_unix_core_file_p (abfd) /* Create the sections. */ - core_stacksec (abfd) = bfd_make_section_anyway (abfd, ".stack"); + flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS; + core_stacksec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".stack", + flags); if (core_stacksec (abfd) == NULL) goto fail; - core_datasec (abfd) = bfd_make_section_anyway (abfd, ".data"); + core_datasec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".data", + flags); if (core_datasec (abfd) == NULL) goto fail; - core_regsec (abfd) = bfd_make_section_anyway (abfd, ".reg"); + core_regsec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".reg", + SEC_HAS_CONTENTS); if (core_regsec (abfd) == NULL) goto fail; @@ -103,10 +108,6 @@ ptrace_unix_core_file_p (abfd) text. I don't think that any of these things are supported on the system on which I am developing this for though. */ - core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS; - core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS; - core_regsec (abfd)->flags = SEC_HAS_CONTENTS; - core_datasec (abfd)->size = u.pt_dsize; core_stacksec (abfd)->size = u.pt_ssize; core_regsec (abfd)->size = sizeof (u); diff --git a/contrib/binutils/bfd/reloc.c b/contrib/binutils/bfd/reloc.c index f1d09a5ab073..1e5d4bd03fa7 100644 --- a/contrib/binutils/bfd/reloc.c +++ b/contrib/binutils/bfd/reloc.c @@ -1,6 +1,6 @@ /* BFD support for handling relocation entries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -47,8 +47,8 @@ SECTION /* DO compile in the reloc_code name table from libbfd.h. */ #define _BFD_MAKE_TABLE_bfd_reloc_code_real -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "bfdlink.h" #include "libbfd.h" /* @@ -1522,7 +1522,6 @@ _bfd_relocate_contents (reloc_howto_type *howto, switch (size) { default: - case 0: abort (); case 1: bfd_put_8 (input_bfd, x, location); @@ -1545,6 +1544,72 @@ _bfd_relocate_contents (reloc_howto_type *howto, return flag; } +/* Clear a given location using a given howto, by applying a relocation value + of zero and discarding any in-place addend. This is used for fixed-up + relocations against discarded symbols, to make ignorable debug or unwind + information more obvious. */ + +void +_bfd_clear_contents (reloc_howto_type *howto, + bfd *input_bfd, + bfd_byte *location) +{ + int size; + bfd_vma x = 0; + + /* Get the value we are going to relocate. */ + size = bfd_get_reloc_size (howto); + switch (size) + { + default: + case 0: + abort (); + case 1: + x = bfd_get_8 (input_bfd, location); + break; + case 2: + x = bfd_get_16 (input_bfd, location); + break; + case 4: + x = bfd_get_32 (input_bfd, location); + break; + case 8: +#ifdef BFD64 + x = bfd_get_64 (input_bfd, location); +#else + abort (); +#endif + break; + } + + /* Zero out the unwanted bits of X. */ + x &= ~howto->dst_mask; + + /* Put the relocated value back in the object file. */ + switch (size) + { + default: + case 0: + abort (); + case 1: + bfd_put_8 (input_bfd, x, location); + break; + case 2: + bfd_put_16 (input_bfd, x, location); + break; + case 4: + bfd_put_32 (input_bfd, x, location); + break; + case 8: +#ifdef BFD64 + bfd_put_64 (input_bfd, x, location); +#else + abort (); +#endif + break; + } +} + /* DOCDD INODE @@ -1884,6 +1949,37 @@ ENUMDOC SPARC TLS relocations ENUM + BFD_RELOC_SPU_IMM7 +ENUMX + BFD_RELOC_SPU_IMM8 +ENUMX + BFD_RELOC_SPU_IMM10 +ENUMX + BFD_RELOC_SPU_IMM10W +ENUMX + BFD_RELOC_SPU_IMM16 +ENUMX + BFD_RELOC_SPU_IMM16W +ENUMX + BFD_RELOC_SPU_IMM18 +ENUMX + BFD_RELOC_SPU_PCREL9a +ENUMX + BFD_RELOC_SPU_PCREL9b +ENUMX + BFD_RELOC_SPU_PCREL16 +ENUMX + BFD_RELOC_SPU_LO16 +ENUMX + BFD_RELOC_SPU_HI16 +ENUMX + BFD_RELOC_SPU_PPU32 +ENUMX + BFD_RELOC_SPU_PPU64 +ENUMDOC + SPU Relocations. + +ENUM BFD_RELOC_ALPHA_GPDISP_HI16 ENUMDOC Alpha ECOFF and ELF relocations. Some of these treat the symbol or @@ -2701,6 +2797,24 @@ ENUM BFD_RELOC_ARM_PREL31 ENUMDOC 31-bit PC relative address. +ENUM + BFD_RELOC_ARM_MOVW +ENUMX + BFD_RELOC_ARM_MOVT +ENUMX + BFD_RELOC_ARM_MOVW_PCREL +ENUMX + BFD_RELOC_ARM_MOVT_PCREL +ENUMX + BFD_RELOC_ARM_THUMB_MOVW +ENUMX + BFD_RELOC_ARM_THUMB_MOVT +ENUMX + BFD_RELOC_ARM_THUMB_MOVW_PCREL +ENUMX + BFD_RELOC_ARM_THUMB_MOVT_PCREL +ENUMDOC + Low and High halfword relocations for MOVW and MOVT instructions. ENUM BFD_RELOC_ARM_JUMP_SLOT @@ -2739,12 +2853,73 @@ ENUMDOC ARM thread-local storage relocations. ENUM + BFD_RELOC_ARM_ALU_PC_G0_NC +ENUMX + BFD_RELOC_ARM_ALU_PC_G0 +ENUMX + BFD_RELOC_ARM_ALU_PC_G1_NC +ENUMX + BFD_RELOC_ARM_ALU_PC_G1 +ENUMX + BFD_RELOC_ARM_ALU_PC_G2 +ENUMX + BFD_RELOC_ARM_LDR_PC_G0 +ENUMX + BFD_RELOC_ARM_LDR_PC_G1 +ENUMX + BFD_RELOC_ARM_LDR_PC_G2 +ENUMX + BFD_RELOC_ARM_LDRS_PC_G0 +ENUMX + BFD_RELOC_ARM_LDRS_PC_G1 +ENUMX + BFD_RELOC_ARM_LDRS_PC_G2 +ENUMX + BFD_RELOC_ARM_LDC_PC_G0 +ENUMX + BFD_RELOC_ARM_LDC_PC_G1 +ENUMX + BFD_RELOC_ARM_LDC_PC_G2 +ENUMX + BFD_RELOC_ARM_ALU_SB_G0_NC +ENUMX + BFD_RELOC_ARM_ALU_SB_G0 +ENUMX + BFD_RELOC_ARM_ALU_SB_G1_NC +ENUMX + BFD_RELOC_ARM_ALU_SB_G1 +ENUMX + BFD_RELOC_ARM_ALU_SB_G2 +ENUMX + BFD_RELOC_ARM_LDR_SB_G0 +ENUMX + BFD_RELOC_ARM_LDR_SB_G1 +ENUMX + BFD_RELOC_ARM_LDR_SB_G2 +ENUMX + BFD_RELOC_ARM_LDRS_SB_G0 +ENUMX + BFD_RELOC_ARM_LDRS_SB_G1 +ENUMX + BFD_RELOC_ARM_LDRS_SB_G2 +ENUMX + BFD_RELOC_ARM_LDC_SB_G0 +ENUMX + BFD_RELOC_ARM_LDC_SB_G1 +ENUMX + BFD_RELOC_ARM_LDC_SB_G2 +ENUMDOC + ARM group relocations. + +ENUM BFD_RELOC_ARM_IMMEDIATE ENUMX BFD_RELOC_ARM_ADRL_IMMEDIATE ENUMX BFD_RELOC_ARM_T32_IMMEDIATE ENUMX + BFD_RELOC_ARM_T32_ADD_IMM +ENUMX BFD_RELOC_ARM_T32_IMM12 ENUMX BFD_RELOC_ARM_T32_ADD_PC12 @@ -3530,6 +3705,50 @@ ENUMDOC Motorola Mcore relocations. ENUM + BFD_RELOC_MEP_8 +ENUMX + BFD_RELOC_MEP_16 +ENUMX + BFD_RELOC_MEP_32 +ENUMX + BFD_RELOC_MEP_PCREL8A2 +ENUMX + BFD_RELOC_MEP_PCREL12A2 +ENUMX + BFD_RELOC_MEP_PCREL17A2 +ENUMX + BFD_RELOC_MEP_PCREL24A2 +ENUMX + BFD_RELOC_MEP_PCABS24A2 +ENUMX + BFD_RELOC_MEP_LOW16 +ENUMX + BFD_RELOC_MEP_HI16U +ENUMX + BFD_RELOC_MEP_HI16S +ENUMX + BFD_RELOC_MEP_GPREL +ENUMX + BFD_RELOC_MEP_TPREL +ENUMX + BFD_RELOC_MEP_TPREL7 +ENUMX + BFD_RELOC_MEP_TPREL7A2 +ENUMX + BFD_RELOC_MEP_TPREL7A4 +ENUMX + BFD_RELOC_MEP_UIMM24 +ENUMX + BFD_RELOC_MEP_ADDR24A4 +ENUMX + BFD_RELOC_MEP_GNU_VTINHERIT +ENUMX + BFD_RELOC_MEP_GNU_VTENTRY +ENUMDOC + Toshiba Media Processor Relocations. +COMMENT + +ENUM BFD_RELOC_MMIX_GETA ENUMX BFD_RELOC_MMIX_GETA_1 @@ -3666,11 +3885,25 @@ ENUMDOC This is a 16 bit reloc for the AVR that stores 8 bit value (usually command address) into 8 bit immediate value of LDI insn. ENUM + BFD_RELOC_AVR_LO8_LDI_GS +ENUMDOC + This is a 16 bit reloc for the AVR that stores 8 bit value + (command address) into 8 bit immediate value of LDI insn. If the address + is beyond the 128k boundary, the linker inserts a jump stub for this reloc + in the lower 128k. +ENUM BFD_RELOC_AVR_HI8_LDI_PM ENUMDOC This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit of command address) into 8 bit immediate value of LDI insn. ENUM + BFD_RELOC_AVR_HI8_LDI_GS +ENUMDOC + This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit + of command address) into 8 bit immediate value of LDI insn. If the address + is beyond the 128k boundary, the linker inserts a jump stub for this reloc + below 128k. +ENUM BFD_RELOC_AVR_HH8_LDI_PM ENUMDOC This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit @@ -3873,6 +4106,43 @@ ENUMDOC Long displacement extension. ENUM + BFD_RELOC_SCORE_DUMMY1 +ENUMDOC + Score relocations +ENUM + BFD_RELOC_SCORE_GPREL15 +ENUMDOC + Low 16 bit for load/store +ENUM + BFD_RELOC_SCORE_DUMMY2 +ENUMX + BFD_RELOC_SCORE_JMP +ENUMDOC + This is a 24-bit reloc with the right 1 bit assumed to be 0 +ENUM + BFD_RELOC_SCORE_BRANCH +ENUMDOC + This is a 19-bit reloc with the right 1 bit assumed to be 0 +ENUM + BFD_RELOC_SCORE16_JMP +ENUMDOC + This is a 11-bit reloc with the right 1 bit assumed to be 0 +ENUM + BFD_RELOC_SCORE16_BRANCH +ENUMDOC + This is a 8-bit reloc with the right 1 bit assumed to be 0 +ENUM + BFD_RELOC_SCORE_GOT15 +ENUMX + BFD_RELOC_SCORE_GOT_LO16 +ENUMX + BFD_RELOC_SCORE_CALL15 +ENUMX + BFD_RELOC_SCORE_DUMMY_HI16 +ENUMDOC + Undocumented Score relocs + +ENUM BFD_RELOC_IP2K_FR9 ENUMDOC Scenix IP2K - 9-bit register number / data address @@ -4246,6 +4516,63 @@ ENUMDOC NS CR16C Relocations. ENUM + BFD_RELOC_CR16_NUM8 +ENUMX + BFD_RELOC_CR16_NUM16 +ENUMX + BFD_RELOC_CR16_NUM32 +ENUMX + BFD_RELOC_CR16_NUM32a +ENUMX + BFD_RELOC_CR16_REGREL0 +ENUMX + BFD_RELOC_CR16_REGREL4 +ENUMX + BFD_RELOC_CR16_REGREL4a +ENUMX + BFD_RELOC_CR16_REGREL14 +ENUMX + BFD_RELOC_CR16_REGREL14a +ENUMX + BFD_RELOC_CR16_REGREL16 +ENUMX + BFD_RELOC_CR16_REGREL20 +ENUMX + BFD_RELOC_CR16_REGREL20a +ENUMX + BFD_RELOC_CR16_ABS20 +ENUMX + BFD_RELOC_CR16_ABS24 +ENUMX + BFD_RELOC_CR16_IMM4 +ENUMX + BFD_RELOC_CR16_IMM8 +ENUMX + BFD_RELOC_CR16_IMM16 +ENUMX + BFD_RELOC_CR16_IMM20 +ENUMX + BFD_RELOC_CR16_IMM24 +ENUMX + BFD_RELOC_CR16_IMM32 +ENUMX + BFD_RELOC_CR16_IMM32a +ENUMX + BFD_RELOC_CR16_DISP4 +ENUMX + BFD_RELOC_CR16_DISP8 +ENUMX + BFD_RELOC_CR16_DISP16 +ENUMX + BFD_RELOC_CR16_DISP20 +ENUMX + BFD_RELOC_CR16_DISP24 +ENUMX + BFD_RELOC_CR16_DISP24a +ENUMDOC + NS CR16 Relocations. + +ENUM BFD_RELOC_CRX_REL4 ENUMX BFD_RELOC_CRX_REL8 @@ -4449,6 +4776,12 @@ ENUMDOC Sony Xstormy16 Relocations. ENUM + BFD_RELOC_RELC +ENUMDOC + Self-describing complex relocations. +COMMENT + +ENUM BFD_RELOC_XC16X_PAG ENUMX BFD_RELOC_XC16X_POF @@ -4670,10 +5003,13 @@ CODE_FRAGMENT /* FUNCTION bfd_reloc_type_lookup + bfd_reloc_name_lookup SYNOPSIS reloc_howto_type *bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code); + reloc_howto_type *bfd_reloc_name_lookup + (bfd *abfd, const char *reloc_name); DESCRIPTION Return a pointer to a howto structure which, when @@ -4688,6 +5024,12 @@ bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code) return BFD_SEND (abfd, reloc_type_lookup, (abfd, code)); } +reloc_howto_type * +bfd_reloc_name_lookup (bfd *abfd, const char *reloc_name) +{ + return BFD_SEND (abfd, reloc_name_lookup, (abfd, reloc_name)); +} + static reloc_howto_type bfd_howto_32 = HOWTO (0, 00, 2, 32, FALSE, 0, complain_overflow_dont, 0, "VRT32", FALSE, 0xffffffff, 0xffffffff, TRUE); @@ -4876,13 +5218,31 @@ bfd_generic_get_relocated_section_contents (bfd *abfd, for (parent = reloc_vector; *parent != NULL; parent++) { char *error_message = NULL; - bfd_reloc_status_type r = - bfd_perform_relocation (input_bfd, - *parent, - data, - input_section, - relocatable ? abfd : NULL, - &error_message); + asymbol *symbol; + bfd_reloc_status_type r; + + symbol = *(*parent)->sym_ptr_ptr; + if (symbol->section && elf_discarded_section (symbol->section)) + { + bfd_byte *p; + static reloc_howto_type none_howto + = HOWTO (0, 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL, + "unused", FALSE, 0, 0, FALSE); + + p = data + (*parent)->address * bfd_octets_per_byte (input_bfd); + _bfd_clear_contents ((*parent)->howto, input_bfd, p); + (*parent)->sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr; + (*parent)->addend = 0; + (*parent)->howto = &none_howto; + r = bfd_reloc_ok; + } + else + r = bfd_perform_relocation (input_bfd, + *parent, + data, + input_section, + relocatable ? abfd : NULL, + &error_message); if (relocatable) { diff --git a/contrib/binutils/bfd/reloc16.c b/contrib/binutils/bfd/reloc16.c index 3adbbc75cd1a..f5c78b2c73b6 100644 --- a/contrib/binutils/bfd/reloc16.c +++ b/contrib/binutils/bfd/reloc16.c @@ -1,6 +1,6 @@ /* 8 and 16 bit COFF relocation functions, for BFD. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001, - 2002, 2003, 2004 Free Software Foundation, Inc. + 2002, 2003, 2004, 2007 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -32,8 +32,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. file) (unless info->keep_memory is FALSE, in which case they should free up the relocs after dealing with them). */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "bfdlink.h" #include "genlink.h" diff --git a/contrib/binutils/bfd/rs6000-core.c b/contrib/binutils/bfd/rs6000-core.c index 280a020a754e..4a2e107d3d7c 100644 --- a/contrib/binutils/bfd/rs6000-core.c +++ b/contrib/binutils/bfd/rs6000-core.c @@ -1,13 +1,8 @@ /* IBM RS/6000 "XCOFF" back-end for BFD. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, - 2001, 2002, 2004 + 2001, 2002, 2004, 2006, 2007 Free Software Foundation, Inc. - FIXME: Can someone provide a transliteration of this name into ASCII? - Using the following chars caused a compiler warning on HIUX (so I replaced - them with octal escapes), and isn't useful without an understanding of what - character set it is. - Written by Metin G. Ozisik, Mimi Ph\373\364ng-Th\345o V\365, - and John Gilmore. + Written by Metin G. Ozisik, Mimi Phuong-Thao Vo, and John Gilmore. Archive support from Damon A. Permezel. Contributed by IBM Corporation and Cygnus Support. @@ -44,8 +39,8 @@ #define _LONG_LONG #endif -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #ifdef AIX_CORE @@ -294,11 +289,10 @@ make_bfd_asection (bfd *abfd, const char *name, flagword flags, { asection *asect; - asect = bfd_make_section_anyway (abfd, name); + asect = bfd_make_section_anyway_with_flags (abfd, name, flags); if (!asect) return NULL; - asect->flags = flags; asect->size = size; asect->vma = vma; asect->filepos = filepos; diff --git a/contrib/binutils/bfd/sco5-core.c b/contrib/binutils/bfd/sco5-core.c index 9a06b8839f54..21631cf5b84e 100644 --- a/contrib/binutils/bfd/sco5-core.c +++ b/contrib/binutils/bfd/sco5-core.c @@ -1,5 +1,5 @@ /* BFD back end for SCO5 core files (U-area and raw sections) - Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Jouke Numan <jnuman@hiscom.nl> @@ -19,8 +19,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "libaout.h" /* BFD a.out internal data structures */ @@ -63,10 +63,9 @@ make_bfd_asection (abfd, name, flags, size, vma, filepos) { asection *asect; - asect = bfd_make_section_anyway (abfd, name); + asect = bfd_make_section_anyway_with_flags (abfd, name, flags); if (!asect) return NULL; - asect->flags = flags; asect->size = size; asect->vma = vma; asect->filepos = filepos; diff --git a/contrib/binutils/bfd/section.c b/contrib/binutils/bfd/section.c index f870e6bfc08a..135f44c0780d 100644 --- a/contrib/binutils/bfd/section.c +++ b/contrib/binutils/bfd/section.c @@ -1,6 +1,6 @@ /* Object file "section" support for the BFD library. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -133,8 +133,8 @@ SUBSECTION */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "bfdlink.h" @@ -294,7 +294,9 @@ CODE_FRAGMENT . else up the line will take care of it later. *} .#define SEC_LINKER_CREATED 0x200000 . -. {* This section should not be subject to garbage collection. *} +. {* This section should not be subject to garbage collection. +. Also set to inform the linker that this section should not be +. listed in the link map as discarded. *} .#define SEC_KEEP 0x400000 . . {* This section contains "short" data, and should be placed @@ -540,11 +542,6 @@ CODE_FRAGMENT . || ((SEC) == bfd_com_section_ptr) \ . || ((SEC) == bfd_ind_section_ptr)) . -.extern const struct bfd_symbol * const bfd_abs_symbol; -.extern const struct bfd_symbol * const bfd_com_symbol; -.extern const struct bfd_symbol * const bfd_und_symbol; -.extern const struct bfd_symbol * const bfd_ind_symbol; -. .{* Macros to handle insertion and deletion of a bfd's sections. These . only handle the list pointers, ie. do not adjust section_count, . target_index etc. *} @@ -635,7 +632,7 @@ CODE_FRAGMENT .#define bfd_section_removed_from_list(ABFD, S) \ . ((S)->next == NULL ? (ABFD)->section_last != (S) : (S)->next->prev != (S)) . -.#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, SYM_PTR, NAME, IDX) \ +.#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, NAME, IDX) \ . {* name, id, index, next, prev, flags, user_set_vma, *} \ . { NAME, IDX, 0, NULL, NULL, FLAGS, 0, \ . \ @@ -666,11 +663,8 @@ CODE_FRAGMENT . {* target_index, used_by_bfd, constructor_chain, owner, *} \ . 0, NULL, NULL, NULL, \ . \ -. {* symbol, *} \ -. (struct bfd_symbol *) SYM, \ -. \ -. {* symbol_ptr_ptr, *} \ -. (struct bfd_symbol **) SYM_PTR, \ +. {* symbol, symbol_ptr_ptr, *} \ +. (struct bfd_symbol *) SYM, &SEC.symbol, \ . \ . {* map_head, map_tail *} \ . { NULL }, { NULL } \ @@ -701,16 +695,14 @@ static const asymbol global_syms[] = GLOBAL_SYM_INIT (BFD_IND_SECTION_NAME, &bfd_ind_section) }; -#define STD_SECTION(SEC, FLAGS, SYM, NAME, IDX) \ - const asymbol * const SYM = (asymbol *) &global_syms[IDX]; \ - asection SEC = BFD_FAKE_SECTION(SEC, FLAGS, &global_syms[IDX], &SYM, \ +#define STD_SECTION(SEC, FLAGS, NAME, IDX) \ + asection SEC = BFD_FAKE_SECTION(SEC, FLAGS, &global_syms[IDX], \ NAME, IDX) -STD_SECTION (bfd_com_section, SEC_IS_COMMON, bfd_com_symbol, - BFD_COM_SECTION_NAME, 0); -STD_SECTION (bfd_und_section, 0, bfd_und_symbol, BFD_UND_SECTION_NAME, 1); -STD_SECTION (bfd_abs_section, 0, bfd_abs_symbol, BFD_ABS_SECTION_NAME, 2); -STD_SECTION (bfd_ind_section, 0, bfd_ind_symbol, BFD_IND_SECTION_NAME, 3); +STD_SECTION (bfd_com_section, SEC_IS_COMMON, BFD_COM_SECTION_NAME, 0); +STD_SECTION (bfd_und_section, 0, BFD_UND_SECTION_NAME, 1); +STD_SECTION (bfd_abs_section, 0, BFD_ABS_SECTION_NAME, 2); +STD_SECTION (bfd_ind_section, 0, BFD_IND_SECTION_NAME, 3); #undef STD_SECTION /* Initialize an entry in the section hash table. */ @@ -743,23 +735,16 @@ bfd_section_hash_newfunc (struct bfd_hash_entry *entry, ((struct section_hash_entry *) \ bfd_hash_lookup ((table), (string), (create), (copy))) -/* Initializes a new section. NEWSECT->NAME is already set. */ +/* Create a symbol whose only job is to point to this section. This + is useful for things like relocs which are relative to the base + of a section. */ -static asection * -bfd_section_init (bfd *abfd, asection *newsect) +bfd_boolean +_bfd_generic_new_section_hook (bfd *abfd, asection *newsect) { - static int section_id = 0x10; /* id 0 to 3 used by STD_SECTION. */ - - newsect->id = section_id; - newsect->index = abfd->section_count; - newsect->owner = abfd; - - /* Create a symbol whose only job is to point to this section. This - is useful for things like relocs which are relative to the base - of a section. */ newsect->symbol = bfd_make_empty_symbol (abfd); if (newsect->symbol == NULL) - return NULL; + return FALSE; newsect->symbol->name = newsect->name; newsect->symbol->value = 0; @@ -767,6 +752,19 @@ bfd_section_init (bfd *abfd, asection *newsect) newsect->symbol->flags = BSF_SECTION_SYM; newsect->symbol_ptr_ptr = &newsect->symbol; + return TRUE; +} + +/* Initializes a new section. NEWSECT->NAME is already set. */ + +static asection * +bfd_section_init (bfd *abfd, asection *newsect) +{ + static int section_id = 0x10; /* id 0 to 3 used by STD_SECTION. */ + + newsect->id = section_id; + newsect->index = abfd->section_count; + newsect->owner = abfd; if (! BFD_SEND (abfd, _new_section_hook, (abfd, newsect))) return NULL; @@ -964,7 +962,6 @@ DESCRIPTION asection * bfd_make_section_old_way (bfd *abfd, const char *name) { - struct section_hash_entry *sh; asection *newsect; if (abfd->output_has_begun) @@ -974,30 +971,38 @@ bfd_make_section_old_way (bfd *abfd, const char *name) } if (strcmp (name, BFD_ABS_SECTION_NAME) == 0) - return bfd_abs_section_ptr; - - if (strcmp (name, BFD_COM_SECTION_NAME) == 0) - return bfd_com_section_ptr; + newsect = bfd_abs_section_ptr; + else if (strcmp (name, BFD_COM_SECTION_NAME) == 0) + newsect = bfd_com_section_ptr; + else if (strcmp (name, BFD_UND_SECTION_NAME) == 0) + newsect = bfd_und_section_ptr; + else if (strcmp (name, BFD_IND_SECTION_NAME) == 0) + newsect = bfd_ind_section_ptr; + else + { + struct section_hash_entry *sh; - if (strcmp (name, BFD_UND_SECTION_NAME) == 0) - return bfd_und_section_ptr; + sh = section_hash_lookup (&abfd->section_htab, name, TRUE, FALSE); + if (sh == NULL) + return NULL; - if (strcmp (name, BFD_IND_SECTION_NAME) == 0) - return bfd_ind_section_ptr; + newsect = &sh->section; + if (newsect->name != NULL) + { + /* Section already exists. */ + return newsect; + } - sh = section_hash_lookup (&abfd->section_htab, name, TRUE, FALSE); - if (sh == NULL) - return NULL; - - newsect = &sh->section; - if (newsect->name != NULL) - { - /* Section already exists. */ - return newsect; + newsect->name = name; + return bfd_section_init (abfd, newsect); } - newsect->name = name; - return bfd_section_init (abfd, newsect); + /* Call new_section_hook when "creating" the standard abs, com, und + and ind sections to tack on format specific section data. + Also, create a proper section symbol. */ + if (! BFD_SEND (abfd, _new_section_hook, (abfd, newsect))) + return NULL; + return newsect; } /* diff --git a/contrib/binutils/bfd/simple.c b/contrib/binutils/bfd/simple.c index d06ce2a96e11..8ebc47e0597e 100644 --- a/contrib/binutils/bfd/simple.c +++ b/contrib/binutils/bfd/simple.c @@ -1,5 +1,5 @@ /* simple.c -- BFD simple client routines - Copyright 2002, 2003, 2004, 2005 + Copyright 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Contributed by MontaVista Software, Inc. @@ -19,8 +19,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "bfdlink.h" @@ -183,6 +183,7 @@ bfd_simple_get_relocated_section_contents (bfd *abfd, /* Fill in the bare minimum number of fields for our purposes. */ memset (&link_info, 0, sizeof (link_info)); link_info.input_bfds = abfd; + link_info.input_bfds_tail = &abfd->link_next; link_info.hash = _bfd_generic_link_hash_table_create (abfd); link_info.callbacks = &callbacks; diff --git a/contrib/binutils/bfd/sparclinux.c b/contrib/binutils/bfd/sparclinux.c index d8659eec16ba..445a66c0e103 100644 --- a/contrib/binutils/bfd/sparclinux.c +++ b/contrib/binutils/bfd/sparclinux.c @@ -1,23 +1,23 @@ /* BFD back-end for linux flavored sparc a.out binaries. Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, - 2003, 2004, 2006 Free Software Foundation, Inc. + 2003, 2004, 2006, 2007 Free Software Foundation, Inc. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, -USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ #define TARGET_PAGE_SIZE 4096 #define ZMAGIC_DISK_BLOCK_SIZE 1024 @@ -27,8 +27,8 @@ USA. */ #define MACHTYPE_OK(mtype) ((mtype) == M_SPARC || (mtype) == M_UNKNOWN) -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "aout/aout64.h" #include "aout/stab_gnu.h" @@ -94,8 +94,7 @@ sparclinux_write_object_contents (abfd) #define GOT_REF_PREFIX "__GOT_" #endif -#define IS_GOT_SYM(name) \ - (strncmp (name, GOT_REF_PREFIX, sizeof GOT_REF_PREFIX - 1) == 0) +#define IS_GOT_SYM(name) (CONST_STRNEQ (name, GOT_REF_PREFIX)) /* See if a symbol name is a reference to the procedure linkage table. */ @@ -103,8 +102,7 @@ sparclinux_write_object_contents (abfd) #define PLT_REF_PREFIX "__PLT_" #endif -#define IS_PLT_SYM(name) \ - (strncmp (name, PLT_REF_PREFIX, sizeof PLT_REF_PREFIX - 1) == 0) +#define IS_PLT_SYM(name) (CONST_STRNEQ (name, PLT_REF_PREFIX)) /* This string is used to generate specialized error messages. */ @@ -313,9 +311,8 @@ linux_link_create_dynamic_sections (abfd, info) /* We choose to use the name ".linux-dynamic" for the fixup table. Why not? */ - s = bfd_make_section (abfd, ".linux-dynamic"); + s = bfd_make_section_with_flags (abfd, ".linux-dynamic", flags); if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags) || ! bfd_set_section_alignment (abfd, s, 2)) return FALSE; s->size = 0; @@ -429,9 +426,7 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string, This function is called via linux_link_hash_traverse. */ static bfd_boolean -linux_tally_symbols (h, data) - struct linux_link_hash_entry *h; - PTR data; +linux_tally_symbols (struct linux_link_hash_entry *h, void * data) { struct bfd_link_info *info = (struct bfd_link_info *) data; struct fixup *f, *f1; @@ -443,8 +438,7 @@ linux_tally_symbols (h, data) h = (struct linux_link_hash_entry *) h->root.root.u.i.link; if (h->root.root.type == bfd_link_hash_undefined - && strncmp (h->root.root.root.string, NEEDS_SHRLIB, - sizeof NEEDS_SHRLIB - 1) == 0) + && CONST_STRNEQ (h->root.root.root.string, NEEDS_SHRLIB)) { const char *name; char *p; diff --git a/contrib/binutils/bfd/srec.c b/contrib/binutils/bfd/srec.c index 2b24f46ffb64..354a6ee670f0 100644 --- a/contrib/binutils/bfd/srec.c +++ b/contrib/binutils/bfd/srec.c @@ -1,6 +1,6 @@ /* BFD back-end for s-record objects. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>. @@ -101,8 +101,8 @@ We allow symbols to be anywhere in the data stream - the module names are always ignored. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "libiberty.h" #include "safe-ctype.h" @@ -526,15 +526,16 @@ srec_scan (bfd *abfd) char secbuf[20]; char *secname; bfd_size_type amt; + flagword flags; sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1); amt = strlen (secbuf) + 1; secname = bfd_alloc (abfd, amt); strcpy (secname, secbuf); - sec = bfd_make_section (abfd, secname); + flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC; + sec = bfd_make_section_with_flags (abfd, secname, flags); if (sec == NULL) goto error_return; - sec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC; sec->vma = address; sec->lma = address; sec->size = bytes; @@ -1099,7 +1100,7 @@ symbolsrec_write_object_contents (bfd *abfd) static int srec_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, - bfd_boolean exec ATTRIBUTE_UNUSED) + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return 0; } @@ -1193,9 +1194,6 @@ srec_print_symbol (bfd *abfd, #define srec_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define srec_read_minisymbols _bfd_generic_read_minisymbols #define srec_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol -#define srec_get_reloc_upper_bound ((long (*) (bfd *, asection *)) bfd_0l) -#define srec_canonicalize_reloc ((long (*) (bfd *, asection *, arelent **, asymbol **)) bfd_0l) -#define srec_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup #define srec_get_section_contents_in_window _bfd_generic_get_section_contents_in_window #define srec_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents #define srec_bfd_relax_section bfd_generic_relax_section @@ -1256,7 +1254,7 @@ const bfd_target srec_vec = BFD_JUMP_TABLE_CORE (_bfd_nocore), BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), BFD_JUMP_TABLE_SYMBOLS (srec), - BFD_JUMP_TABLE_RELOCS (srec), + BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), BFD_JUMP_TABLE_WRITE (srec), BFD_JUMP_TABLE_LINK (srec), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), @@ -1311,7 +1309,7 @@ const bfd_target symbolsrec_vec = BFD_JUMP_TABLE_CORE (_bfd_nocore), BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), BFD_JUMP_TABLE_SYMBOLS (srec), - BFD_JUMP_TABLE_RELOCS (srec), + BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), BFD_JUMP_TABLE_WRITE (srec), BFD_JUMP_TABLE_LINK (srec), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), diff --git a/contrib/binutils/bfd/stabs.c b/contrib/binutils/bfd/stabs.c index ba3f93446193..1192cd165b91 100644 --- a/contrib/binutils/bfd/stabs.c +++ b/contrib/binutils/bfd/stabs.c @@ -1,6 +1,6 @@ /* Stabs in sections linking support. Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006 Free Software Foundation, Inc. + 2006, 2007 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -22,8 +22,8 @@ /* This file contains support for linking stabs in sections, as used on COFF and ELF. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "aout/stab_gnu.h" #include "safe-ctype.h" @@ -175,10 +175,8 @@ _bfd_link_section_stabs (bfd *abfd, prepared to handle them. */ return TRUE; - if ((stabsec->output_section != NULL - && bfd_is_abs_section (stabsec->output_section)) - || (stabstrsec->output_section != NULL - && bfd_is_abs_section (stabstrsec->output_section))) + if (bfd_is_abs_section (stabsec->output_section) + || bfd_is_abs_section (stabstrsec->output_section)) /* At least one of the sections is being discarded from the link, so we should just ignore them. */ return TRUE; @@ -187,6 +185,8 @@ _bfd_link_section_stabs (bfd *abfd, if (sinfo->stabstr == NULL) { + flagword flags; + /* Initialize the stabs information we need to keep track of. */ first = TRUE; sinfo->strings = _bfd_stringtab_init (); @@ -198,11 +198,12 @@ _bfd_link_section_stabs (bfd *abfd, stab_link_includes_newfunc, sizeof (struct stab_link_includes_entry))) goto error_return; - sinfo->stabstr = bfd_make_section_anyway (abfd, ".stabstr"); + flags = (SEC_HAS_CONTENTS | SEC_READONLY | SEC_DEBUGGING + | SEC_LINKER_CREATED); + sinfo->stabstr = bfd_make_section_anyway_with_flags (abfd, ".stabstr", + flags); if (sinfo->stabstr == NULL) goto error_return; - sinfo->stabstr->flags |= (SEC_HAS_CONTENTS | SEC_READONLY - | SEC_DEBUGGING | SEC_LINKER_CREATED); } /* Initialize the information we are going to store for this .stab @@ -430,7 +431,7 @@ _bfd_link_section_stabs (bfd *abfd, ++nest; else if (incl_type == (int) N_EXCL) /* Keep existing exclusion marks. */ - continue; + continue; else if (nest == 0) { *incl_pstridx = (bfd_size_type) -1; @@ -455,8 +456,8 @@ _bfd_link_section_stabs (bfd *abfd, for that section. */ stabsec->size = (count - skip) * STABSIZE; if (stabsec->size == 0) - stabsec->flags |= SEC_EXCLUDE; - stabstrsec->flags |= SEC_EXCLUDE; + stabsec->flags |= SEC_EXCLUDE | SEC_KEEP; + stabstrsec->flags |= SEC_EXCLUDE | SEC_KEEP; sinfo->stabstr->size = _bfd_stringtab_size (sinfo->strings); /* Calculate the `cumulative_skips' array now that stabs have been @@ -608,7 +609,7 @@ _bfd_discard_section_stabs (bfd *abfd, /* Shrink the stabsec as needed. */ stabsec->size -= skip * STABSIZE; if (stabsec->size == 0) - stabsec->flags |= SEC_EXCLUDE; + stabsec->flags |= SEC_EXCLUDE | SEC_KEEP; /* Recalculate the `cumulative_skips' array now that stabs have been deleted for this section. */ diff --git a/contrib/binutils/bfd/sunos.c b/contrib/binutils/bfd/sunos.c index 024320fbfa18..a9117f477181 100644 --- a/contrib/binutils/bfd/sunos.c +++ b/contrib/binutils/bfd/sunos.c @@ -745,57 +745,50 @@ sunos_create_dynamic_sections (bfd *abfd, /* The .dynamic section holds the basic dynamic information: the sun4_dynamic structure, the dynamic debugger information, and the sun4_dynamic_link structure. */ - s = bfd_make_section (abfd, ".dynamic"); + s = bfd_make_section_with_flags (abfd, ".dynamic", flags); if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags) || ! bfd_set_section_alignment (abfd, s, 2)) return FALSE; /* The .got section holds the global offset table. The address is put in the ld_got field. */ - s = bfd_make_section (abfd, ".got"); + s = bfd_make_section_with_flags (abfd, ".got", flags); if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags) || ! bfd_set_section_alignment (abfd, s, 2)) return FALSE; /* The .plt section holds the procedure linkage table. The address is put in the ld_plt field. */ - s = bfd_make_section (abfd, ".plt"); + s = bfd_make_section_with_flags (abfd, ".plt", flags | SEC_CODE); if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_CODE) || ! bfd_set_section_alignment (abfd, s, 2)) return FALSE; /* The .dynrel section holds the dynamic relocs. The address is put in the ld_rel field. */ - s = bfd_make_section (abfd, ".dynrel"); + s = bfd_make_section_with_flags (abfd, ".dynrel", flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) || ! bfd_set_section_alignment (abfd, s, 2)) return FALSE; /* The .hash section holds the dynamic hash table. The address is put in the ld_hash field. */ - s = bfd_make_section (abfd, ".hash"); + s = bfd_make_section_with_flags (abfd, ".hash", flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) || ! bfd_set_section_alignment (abfd, s, 2)) return FALSE; /* The .dynsym section holds the dynamic symbols. The address is put in the ld_stab field. */ - s = bfd_make_section (abfd, ".dynsym"); + s = bfd_make_section_with_flags (abfd, ".dynsym", flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) || ! bfd_set_section_alignment (abfd, s, 2)) return FALSE; /* The .dynstr section holds the dynamic symbol string table. The address is put in the ld_symbols field. */ - s = bfd_make_section (abfd, ".dynstr"); + s = bfd_make_section_with_flags (abfd, ".dynstr", flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) || ! bfd_set_section_alignment (abfd, s, 2)) return FALSE; @@ -890,14 +883,10 @@ sunos_add_dynamic_symbols (bfd *abfd, /* The .need section holds the list of names of shared objets which must be included at runtime. The address of this section is put in the ld_need field. */ - asection *s = bfd_make_section (dynobj, ".need"); + flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS + | SEC_IN_MEMORY | SEC_READONLY); + asection *s = bfd_make_section_with_flags (dynobj, ".need", flags); if (s == NULL - || ! bfd_set_section_flags (dynobj, s, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_READONLY)) || ! bfd_set_section_alignment (dynobj, s, 2)) return FALSE; } @@ -907,14 +896,10 @@ sunos_add_dynamic_symbols (bfd *abfd, /* The .rules section holds the path to search for shared objects. The address of this section is put in the ld_rules field. */ - asection *s = bfd_make_section (dynobj, ".rules"); + flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS + | SEC_IN_MEMORY | SEC_READONLY); + asection *s = bfd_make_section_with_flags (dynobj, ".rules", flags); if (s == NULL - || ! bfd_set_section_flags (dynobj, s, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_READONLY)) || ! bfd_set_section_alignment (dynobj, s, 2)) return FALSE; } diff --git a/contrib/binutils/bfd/syms.c b/contrib/binutils/bfd/syms.c index 0ff94164ed5e..89c38692ed30 100644 --- a/contrib/binutils/bfd/syms.c +++ b/contrib/binutils/bfd/syms.c @@ -1,6 +1,6 @@ /* Generic symbol-table support for the BFD library. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004 + 2000, 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -288,6 +288,14 @@ CODE_FRAGMENT . {* This symbol is thread local. Used in ELF. *} .#define BSF_THREAD_LOCAL 0x40000 . +. {* This symbol represents a complex relocation expression, +. with the expression tree serialized in the symbol name. *} +.#define BSF_RELC 0x80000 +. +. {* This symbol represents a signed complex relocation expression, +. with the expression tree serialized in the symbol name. *} +.#define BSF_SRELC 0x100000 +. . flagword flags; . . {* A pointer to the section to which this symbol is @@ -307,8 +315,8 @@ CODE_FRAGMENT . */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "safe-ctype.h" #include "bfdlink.h" diff --git a/contrib/binutils/bfd/sysdep.h b/contrib/binutils/bfd/sysdep.h index f6313d3905ce..e1b070b4a899 100644 --- a/contrib/binutils/bfd/sysdep.h +++ b/contrib/binutils/bfd/sysdep.h @@ -1,5 +1,5 @@ /* sysdep.h -- handle host dependencies for the BFD library - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -22,10 +22,10 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. #ifndef BFD_SYSDEP_H #define BFD_SYSDEP_H -#include "ansidecl.h" - #include "config.h" +#include "ansidecl.h" + #ifdef HAVE_STDDEF_H #include <stddef.h> #endif diff --git a/contrib/binutils/bfd/targets.c b/contrib/binutils/bfd/targets.c index 3b04f60a4bf5..04b52df057c6 100644 --- a/contrib/binutils/bfd/targets.c +++ b/contrib/binutils/bfd/targets.c @@ -1,6 +1,6 @@ /* Generic target-file-type support for the BFD library. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -20,8 +20,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "fnmatch.h" @@ -402,7 +402,8 @@ BFD_JUMP_TABLE macros. .#define BFD_JUMP_TABLE_RELOCS(NAME) \ . NAME##_get_reloc_upper_bound, \ . NAME##_canonicalize_reloc, \ -. NAME##_bfd_reloc_type_lookup +. NAME##_bfd_reloc_type_lookup, \ +. NAME##_bfd_reloc_name_lookup . . long (*_get_reloc_upper_bound) (bfd *, sec_ptr); . long (*_bfd_canonicalize_reloc) @@ -410,6 +411,9 @@ BFD_JUMP_TABLE macros. . {* See documentation on reloc types. *} . reloc_howto_type * . (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); +. reloc_howto_type * +. (*reloc_name_lookup) (bfd *, const char *); +. . . {* Routines used when writing an object file. *} .#define BFD_JUMP_TABLE_WRITE(NAME) \ @@ -438,7 +442,7 @@ BFD_JUMP_TABLE macros. . NAME##_bfd_discard_group, \ . NAME##_section_already_linked \ . -. int (*_bfd_sizeof_headers) (bfd *, bfd_boolean); +. int (*_bfd_sizeof_headers) (bfd *, struct bfd_link_info *); . bfd_byte * (*_bfd_get_relocated_section_contents) . (bfd *, struct bfd_link_info *, struct bfd_link_order *, . bfd_byte *, bfd_boolean, struct bfd_symbol **); @@ -481,7 +485,8 @@ BFD_JUMP_TABLE macros. . . {* Check if SEC has been already linked during a reloceatable or . final link. *} -. void (*_section_already_linked) (bfd *, struct bfd_section *); +. void (*_section_already_linked) (bfd *, struct bfd_section *, +. struct bfd_link_info *); . . {* Routines to handle dynamic symbols and relocs. *} .#define BFD_JUMP_TABLE_DYNAMIC(NAME) \ @@ -541,6 +546,10 @@ extern const bfd_target arm_epoc_pe_big_vec; extern const bfd_target arm_epoc_pe_little_vec; extern const bfd_target arm_epoc_pei_big_vec; extern const bfd_target arm_epoc_pei_little_vec; +extern const bfd_target arm_wince_pe_big_vec; +extern const bfd_target arm_wince_pe_little_vec; +extern const bfd_target arm_wince_pei_big_vec; +extern const bfd_target arm_wince_pei_little_vec; extern const bfd_target armcoff_big_vec; extern const bfd_target armcoff_little_vec; extern const bfd_target armnetbsd_vec; @@ -563,6 +572,7 @@ extern const bfd_target bfd_elf32_bigarm_symbian_vec; extern const bfd_target bfd_elf32_bigarm_vxworks_vec; extern const bfd_target bfd_elf32_bigmips_vec; extern const bfd_target bfd_elf32_bigmips_vxworks_vec; +extern const bfd_target bfd_elf32_cr16_vec; extern const bfd_target bfd_elf32_cr16c_vec; extern const bfd_target bfd_elf32_cris_vec; extern const bfd_target bfd_elf32_crx_vec; @@ -605,6 +615,8 @@ extern const bfd_target bfd_elf32_m68k_vec; extern const bfd_target bfd_elf32_m88k_vec; extern const bfd_target bfd_elf32_mcore_big_vec; extern const bfd_target bfd_elf32_mcore_little_vec; +extern const bfd_target bfd_elf32_mep_vec; +extern const bfd_target bfd_elf32_mep_little_vec; extern const bfd_target bfd_elf32_mn10200_vec; extern const bfd_target bfd_elf32_mn10300_vec; extern const bfd_target bfd_elf32_mt_vec; @@ -621,6 +633,8 @@ extern const bfd_target bfd_elf32_powerpc_vec; extern const bfd_target bfd_elf32_powerpcle_vec; extern const bfd_target bfd_elf32_powerpc_vxworks_vec; extern const bfd_target bfd_elf32_s390_vec; +extern const bfd_target bfd_elf32_bigscore_vec; +extern const bfd_target bfd_elf32_littlescore_vec; extern const bfd_target bfd_elf32_sh64_vec; extern const bfd_target bfd_elf32_sh64l_vec; extern const bfd_target bfd_elf32_sh64lin_vec; @@ -633,9 +647,12 @@ 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_spu_vec; extern const bfd_target bfd_elf32_tradbigmips_vec; extern const bfd_target bfd_elf32_tradlittlemips_vec; extern const bfd_target bfd_elf32_us_cris_vec; @@ -667,8 +684,10 @@ extern const bfd_target bfd_elf64_sh64blin_vec; extern const bfd_target bfd_elf64_sh64lnbsd_vec; extern const bfd_target bfd_elf64_sh64nbsd_vec; extern const bfd_target bfd_elf64_sparc_vec; +extern const bfd_target bfd_elf64_sparc_freebsd_vec; extern const bfd_target bfd_elf64_tradbigmips_vec; extern const bfd_target bfd_elf64_tradlittlemips_vec; +extern const bfd_target bfd_elf64_x86_64_freebsd_vec; extern const bfd_target bfd_elf64_x86_64_vec; extern const bfd_target bfd_mmo_vec; extern const bfd_target bfd_powerpc_pe_vec; @@ -781,6 +800,9 @@ extern const bfd_target vms_alpha_vec; extern const bfd_target vms_vax_vec; extern const bfd_target w65_vec; extern const bfd_target we32kcoff_vec; +extern const bfd_target x86_64pe_vec; +extern const bfd_target x86_64pei_vec; +extern const bfd_target x86_64coff_vec; extern const bfd_target z80coff_vec; extern const bfd_target z8kcoff_vec; @@ -805,8 +827,8 @@ extern const bfd_target sco5_core_vec; extern const bfd_target trad_core_vec; extern const bfd_target bfd_elf32_am33lin_vec; -static const bfd_target * const _bfd_target_vector[] = { - +static const bfd_target * const _bfd_target_vector[] = +{ #ifdef SELECT_VECS SELECT_VECS, @@ -842,6 +864,10 @@ static const bfd_target * const _bfd_target_vector[] = { &arm_epoc_pe_little_vec, &arm_epoc_pei_big_vec, &arm_epoc_pei_little_vec, + &arm_wince_pe_big_vec, + &arm_wince_pe_little_vec, + &arm_wince_pei_big_vec, + &arm_wince_pei_little_vec, &armcoff_big_vec, &armcoff_little_vec, &armnetbsd_vec, @@ -854,6 +880,7 @@ static const bfd_target * const _bfd_target_vector[] = { &bfd_efi_app_ia32_vec, &bfd_efi_app_x86_64_vec, #ifdef BFD64 + &bfd_efi_app_x86_64_vec, &bfd_efi_app_ia64_vec, #endif &bfd_elf32_avr_vec, @@ -871,6 +898,7 @@ static const bfd_target * const _bfd_target_vector[] = { &bfd_elf32_bigarm_vxworks_vec, &bfd_elf32_bigmips_vec, &bfd_elf32_bigmips_vxworks_vec, + &bfd_elf32_cr16_vec, &bfd_elf32_cr16c_vec, &bfd_elf32_cris_vec, &bfd_elf32_crx_vec, @@ -917,6 +945,7 @@ static const bfd_target * const _bfd_target_vector[] = { &bfd_elf32_m88k_vec, &bfd_elf32_mcore_big_vec, &bfd_elf32_mcore_little_vec, + &bfd_elf32_mep_vec, &bfd_elf32_mn10200_vec, &bfd_elf32_mn10300_vec, &bfd_elf32_mt_vec, @@ -935,13 +964,17 @@ static const bfd_target * const _bfd_target_vector[] = { &bfd_elf32_powerpc_vxworks_vec, &bfd_elf32_powerpcle_vec, &bfd_elf32_s390_vec, + &bfd_elf32_bigscore_vec, + &bfd_elf32_littlescore_vec, &bfd_elf32_sh_vec, &bfd_elf32_shblin_vec, &bfd_elf32_shl_vec, &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, @@ -952,6 +985,7 @@ static const bfd_target * const _bfd_target_vector[] = { #endif &bfd_elf32_sparc_vec, &bfd_elf32_sparc_vxworks_vec, + &bfd_elf32_spu_vec, &bfd_elf32_tradbigmips_vec, &bfd_elf32_tradlittlemips_vec, &bfd_elf32_us_cris_vec, @@ -984,8 +1018,10 @@ static const bfd_target * const _bfd_target_vector[] = { &bfd_elf64_sh64lin_vec, &bfd_elf64_sh64blin_vec, &bfd_elf64_sparc_vec, + &bfd_elf64_sparc_freebsd_vec, &bfd_elf64_tradbigmips_vec, &bfd_elf64_tradlittlemips_vec, + &bfd_elf64_x86_64_freebsd_vec, &bfd_elf64_x86_64_vec, &bfd_mmo_vec, #endif @@ -1038,6 +1074,11 @@ static const bfd_target * const _bfd_target_vector[] = { &i386os9k_vec, &i386pe_vec, &i386pei_vec, +#ifdef BFD64 + &x86_64coff_vec, + &x86_64pe_vec, + &x86_64pei_vec, +#endif &i860coff_vec, &icoff_big_vec, &icoff_little_vec, @@ -1262,7 +1303,6 @@ find_target (const char *name) while (match->vector == NULL) ++match; return match->vector; - break; } } @@ -1309,14 +1349,15 @@ SYNOPSIS DESCRIPTION Return a pointer to the transfer vector for the object target - named @var{target_name}. If @var{target_name} is <<NULL>>, choose the - one in the environment variable <<GNUTARGET>>; if that is null or not - defined, then choose the first entry in the target list. - Passing in the string "default" or setting the environment - variable to "default" will cause the first entry in the target - list to be returned, and "target_defaulted" will be set in the - BFD. This causes <<bfd_check_format>> to loop over all the - targets to find the one that matches the file being read. + named @var{target_name}. If @var{target_name} is <<NULL>>, + choose the one in the environment variable <<GNUTARGET>>; if + that is null or not defined, then choose the first entry in the + target list. Passing in the string "default" or setting the + environment variable to "default" will cause the first entry in + the target list to be returned, and "target_defaulted" will be + set in the BFD if @var{abfd} isn't <<NULL>>. This causes + <<bfd_check_format>> to loop over all the targets to find the + one that matches the file being read. */ const bfd_target * @@ -1333,21 +1374,27 @@ bfd_find_target (const char *target_name, bfd *abfd) /* This is safe; the vector cannot be null. */ if (targname == NULL || strcmp (targname, "default") == 0) { - abfd->target_defaulted = TRUE; if (bfd_default_vector[0] != NULL) - abfd->xvec = bfd_default_vector[0]; + target = bfd_default_vector[0]; else - abfd->xvec = bfd_target_vector[0]; - return abfd->xvec; + target = bfd_target_vector[0]; + if (abfd) + { + abfd->xvec = target; + abfd->target_defaulted = TRUE; + } + return target; } - abfd->target_defaulted = FALSE; + if (abfd) + abfd->target_defaulted = FALSE; target = find_target (targname); if (target == NULL) return NULL; - abfd->xvec = target; + if (abfd) + abfd->xvec = target; return target; } diff --git a/contrib/binutils/bfd/tekhex.c b/contrib/binutils/bfd/tekhex.c index afe42cc948a9..78deaf99ae14 100644 --- a/contrib/binutils/bfd/tekhex.c +++ b/contrib/binutils/bfd/tekhex.c @@ -1,6 +1,6 @@ /* BFD backend for Extended Tektronix Hex Format objects. Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, - 2003, 2004 Free Software Foundation, Inc. + 2003, 2004, 2007 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>. This file is part of BFD, the Binary File Descriptor library. @@ -65,8 +65,8 @@ The data can come out of order, and may be discontigous. This is a serial protocol, so big files are unlikely, so we keep a list of 8k chunks. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "libiberty.h" @@ -436,6 +436,7 @@ first_phase (bfd *abfd, int type, char *src) if (!getvalue (&src, &val)) return FALSE; new->symbol.value = val - section->vma; + break; } default: return FALSE; @@ -457,11 +458,10 @@ pass_over (bfd *abfd, bfd_boolean (*func) (bfd *, int, char *)) /* To the front of the file. */ if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) - abort (); + return FALSE; while (! eof) { - char buffer[MAXCHUNK]; - char *src = buffer; + char src[MAXCHUNK]; char type; /* Find first '%'. */ @@ -471,22 +471,24 @@ pass_over (bfd *abfd, bfd_boolean (*func) (bfd *, int, char *)) if (eof) break; - src++; /* Fetch the type and the length and the checksum. */ if (bfd_bread (src, (bfd_size_type) 5, abfd) != 5) - abort (); /* FIXME. */ + return FALSE; type = src[2]; if (!ISHEX (src[0]) || !ISHEX (src[1])) break; - /* Already read five char. */ + /* Already read five chars. */ chars_on_line = HEX (src) - 5; + if (chars_on_line >= MAXCHUNK) + return FALSE; + if (bfd_bread (src, (bfd_size_type) chars_on_line, abfd) != chars_on_line) - abort (); /* FIXME. */ + return FALSE; /* Put a null at the end. */ src[chars_on_line] = 0; @@ -751,7 +753,6 @@ out (bfd *abfd, int type, char *start, char *end) static bfd_boolean tekhex_write_object_contents (bfd *abfd) { - int bytes_written; char buffer[100]; asymbol **p; asection *s; @@ -759,8 +760,6 @@ tekhex_write_object_contents (bfd *abfd) tekhex_init (); - bytes_written = 0; - /* And the raw data. */ for (d = abfd->tdata.tekhex_data->data; d != NULL; @@ -868,7 +867,7 @@ tekhex_write_object_contents (bfd *abfd) static int tekhex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, - bfd_boolean exec ATTRIBUTE_UNUSED) + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return 0; } diff --git a/contrib/binutils/bfd/trad-core.c b/contrib/binutils/bfd/trad-core.c index cb4111fb9418..79b869cb37af 100644 --- a/contrib/binutils/bfd/trad-core.c +++ b/contrib/binutils/bfd/trad-core.c @@ -1,6 +1,6 @@ /* BFD back end for traditional Unix core files (U-area and raw sections) Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by John Gilmore of Cygnus Support. @@ -20,8 +20,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "libaout.h" /* BFD a.out internal data structures */ @@ -79,6 +79,7 @@ trad_unix_core_file_p (abfd) struct user u; struct trad_core_struct *rawptr; bfd_size_type amt; + flagword flags; #ifdef TRAD_CORE_USER_OFFSET /* If defined, this macro is the file position of the user struct. */ @@ -113,24 +114,24 @@ trad_unix_core_file_p (abfd) if (bfd_stat (abfd, &statbuf) < 0) return 0; - if ((unsigned long) (NBPG * (UPAGES + u.u_dsize + if ((ufile_ptr) NBPG * (UPAGES + u.u_dsize #ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE - - u.u_tsize + - u.u_tsize #endif - + u.u_ssize)) - > (unsigned long) statbuf.st_size) + + u.u_ssize) + > (ufile_ptr) statbuf.st_size) { bfd_set_error (bfd_error_wrong_format); return 0; } #ifndef TRAD_CORE_ALLOW_ANY_EXTRA_SIZE - if ((unsigned long) (NBPG * (UPAGES + u.u_dsize + u.u_ssize) + if (((ufile_ptr) NBPG * (UPAGES + u.u_dsize + u.u_ssize) #ifdef TRAD_CORE_EXTRA_SIZE_ALLOWED /* Some systems write the file too big. */ - + TRAD_CORE_EXTRA_SIZE_ALLOWED + + TRAD_CORE_EXTRA_SIZE_ALLOWED #endif - ) - < (unsigned long) statbuf.st_size) + ) + < (ufile_ptr) statbuf.st_size) { /* The file is too big. Maybe it's not a core file or we otherwise have bad values for u_dsize and u_ssize). */ @@ -155,20 +156,20 @@ trad_unix_core_file_p (abfd) /* Create the sections. */ - core_stacksec(abfd) = bfd_make_section_anyway (abfd, ".stack"); + flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS; + core_stacksec(abfd) = bfd_make_section_anyway_with_flags (abfd, ".stack", + flags); if (core_stacksec (abfd) == NULL) goto fail; - core_datasec (abfd) = bfd_make_section_anyway (abfd, ".data"); + core_datasec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".data", + flags); if (core_datasec (abfd) == NULL) goto fail; - core_regsec (abfd) = bfd_make_section_anyway (abfd, ".reg"); + core_regsec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".reg", + SEC_HAS_CONTENTS); if (core_regsec (abfd) == NULL) goto fail; - core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS; - core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS; - core_regsec (abfd)->flags = SEC_HAS_CONTENTS; - core_datasec (abfd)->size = NBPG * u.u_dsize #ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE - NBPG * u.u_tsize diff --git a/contrib/binutils/bfd/version.h b/contrib/binutils/bfd/version.h index f0ad1a889092..88dbbce9fc80 100644 --- a/contrib/binutils/bfd/version.h +++ b/contrib/binutils/bfd/version.h @@ -1,3 +1,4 @@ -#define BFD_VERSION_DATE 20070807 +#define BFD_VERSION_DATE 20070703 #define BFD_VERSION @bfd_version@ -#define BFD_VERSION_STRING @bfd_version_string@ +#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ +#define REPORT_BUGS_TO @report_bugs_to@ diff --git a/contrib/binutils/bfd/xcoff-target.h b/contrib/binutils/bfd/xcoff-target.h index 7e73cf26a59d..b912fdf35e6d 100644 --- a/contrib/binutils/bfd/xcoff-target.h +++ b/contrib/binutils/bfd/xcoff-target.h @@ -1,5 +1,5 @@ /* Common definitions for backends based on IBM RS/6000 "XCOFF64" files. - Copyright 2000, 2001, 2002, 2004, 2005 + Copyright 2000, 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc. Contributed by Cygnus Support. @@ -125,7 +125,7 @@ extern bfd * _bfd_xcoff_openr_next_archived_file (bfd *, bfd *); extern int _bfd_xcoff_generic_stat_arch_elt (bfd *, struct stat *); extern bfd_boolean _bfd_xcoff_write_armap (bfd *, unsigned int, struct orl *, unsigned int, int); extern bfd_boolean _bfd_xcoff_write_archive_contents (bfd *); -extern int _bfd_xcoff_sizeof_headers (bfd *, bfd_boolean); +extern int _bfd_xcoff_sizeof_headers (bfd *, struct bfd_link_info *); extern void _bfd_xcoff_swap_sym_in (bfd *, void *, void *); extern unsigned int _bfd_xcoff_swap_sym_out (bfd *, void *, void *); extern void _bfd_xcoff_swap_aux_in (bfd *, void *, int, int, int, int, void *); diff --git a/contrib/binutils/bfd/xcofflink.c b/contrib/binutils/bfd/xcofflink.c index 47c330b6c15f..b02886a416b9 100644 --- a/contrib/binutils/bfd/xcofflink.c +++ b/contrib/binutils/bfd/xcofflink.c @@ -1,6 +1,6 @@ /* POWER/PowerPC XCOFF linker support. Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006 Free Software Foundation, Inc. + 2005, 2006, 2007 Free Software Foundation, Inc. Written by Ian Lance Taylor <ian@cygnus.com>, Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -19,8 +19,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "bfdlink.h" #include "libbfd.h" #include "coff/internal.h" @@ -794,27 +794,27 @@ xcoff_link_create_extra_sections (bfd * abfd, struct bfd_link_info *info) if (xcoff_hash_table (info)->loader_section == NULL) { asection *lsec; + flagword flags = SEC_HAS_CONTENTS | SEC_IN_MEMORY; - lsec = bfd_make_section_anyway (abfd, ".loader"); + lsec = bfd_make_section_anyway_with_flags (abfd, ".loader", flags); if (lsec == NULL) goto end_return; xcoff_hash_table (info)->loader_section = lsec; - lsec->flags |= SEC_HAS_CONTENTS | SEC_IN_MEMORY; } /* Likewise for the linkage section. */ if (xcoff_hash_table (info)->linkage_section == NULL) { asection *lsec; + flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS + | SEC_IN_MEMORY); - lsec = bfd_make_section_anyway (abfd, ".gl"); + lsec = bfd_make_section_anyway_with_flags (abfd, ".gl", flags); if (lsec == NULL) goto end_return; xcoff_hash_table (info)->linkage_section = lsec; - lsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY); lsec->alignment_power = 2; } @@ -822,14 +822,14 @@ xcoff_link_create_extra_sections (bfd * abfd, struct bfd_link_info *info) if (xcoff_hash_table (info)->toc_section == NULL) { asection *tsec; + flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS + | SEC_IN_MEMORY); - tsec = bfd_make_section_anyway (abfd, ".tc"); + tsec = bfd_make_section_anyway_with_flags (abfd, ".tc", flags); if (tsec == NULL) goto end_return; xcoff_hash_table (info)->toc_section = tsec; - tsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY); tsec->alignment_power = 2; } @@ -837,14 +837,14 @@ xcoff_link_create_extra_sections (bfd * abfd, struct bfd_link_info *info) if (xcoff_hash_table (info)->descriptor_section == NULL) { asection *dsec; + flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS + | SEC_IN_MEMORY); - dsec = bfd_make_section_anyway (abfd, ".ds"); + dsec = bfd_make_section_anyway_with_flags (abfd, ".ds", flags); if (dsec == NULL) goto end_return; xcoff_hash_table (info)->descriptor_section = dsec; - dsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY); dsec->alignment_power = 2; } @@ -853,13 +853,13 @@ xcoff_link_create_extra_sections (bfd * abfd, struct bfd_link_info *info) && info->strip != strip_all) { asection *dsec; + flagword flags = SEC_HAS_CONTENTS | SEC_IN_MEMORY; - dsec = bfd_make_section_anyway (abfd, ".debug"); + dsec = bfd_make_section_anyway_with_flags (abfd, ".debug", flags); if (dsec == NULL) goto end_return; xcoff_hash_table (info)->debug_section = dsec; - dsec->flags |= SEC_HAS_CONTENTS | SEC_IN_MEMORY; } } @@ -1552,16 +1552,17 @@ xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info) { /* The linker script puts the .td section in the data section after the .tc section. */ - csect = bfd_make_section_anyway (abfd, ".td"); + csect = bfd_make_section_anyway_with_flags (abfd, ".td", + SEC_ALLOC); } else - csect = bfd_make_section_anyway (abfd, ".bss"); + csect = bfd_make_section_anyway_with_flags (abfd, ".bss", + SEC_ALLOC); if (csect == NULL) goto error_return; csect->vma = sym.n_value; csect->size = aux.x_csect.x_scnlen.l; - csect->flags |= SEC_ALLOC; csect->alignment_power = SMTYP_ALIGN (aux.x_csect.x_smtyp); /* There are a number of other fields and section flags which we do not bother to set. */ @@ -5460,8 +5461,8 @@ _bfd_xcoff_bfd_final_link (bfd *abfd, struct bfd_link_info *info) that needs padding. This requires unlinking and relinking the bfd's section list. */ - n = bfd_make_section_anyway (abfd, ".pad"); - n->flags = SEC_HAS_CONTENTS; + n = bfd_make_section_anyway_with_flags (abfd, ".pad", + SEC_HAS_CONTENTS); n->alignment_power = 0; bfd_section_list_remove (abfd, n); |