Commit Graph

6005 Commits

Author SHA1 Message Date
Alan Modra 4f3fedcf68 * elflink.c (_bfd_elf_merge_symbol): Set old_alignment for
usual common symbols as well as for dynamic.  Add poldbfd param.
	Save old bfd.  Adjust callers.
	(_bfd_elf_add_default_symbol): Add poldbfd param.  Pass "section"
	and "value" by value, not pointer.  Adjust caller.
	(elf_link_add_object_symbols): Combine undef_bfd and old_bfd vars.
	Delete code to set same.  Use old_bfd and old_alignment from
	_bfd_elf_merge_symbol instead.  Add default symbol before
	alignment and size checks.  Wrap overlong lines.
2013-03-25 06:12:06 +00:00
Alan Modra e3c9d23467 * elflink.c (_bfd_elf_add_default_symbol): Delete "override" param.
(elf_link_add_object_symbols): Don't call _bfd_elf_add_default_symbol
	when override is true.
2013-03-25 06:06:35 +00:00
Alan Modra 6c9b78e691 * elflink.c (_bfd_elf_merge_symbol): Use local var holding value
of *sym_hash.
2013-03-25 06:03:48 +00:00
Alan Modra 191c0c4245 * elflink.c (_bfd_elf_merge_symbol): Don't discard TLS symbols here.
Wrap long lines.
	(elf_link_add_object_symbols): Discard TLS symbols for --just-syms
	early in symbol loop.
2013-03-25 06:02:28 +00:00
Alan Modra 5d13b3b319 * elf-bfd.h (struct elf_backend_data <merge_symbol>): Update proto.
(_bfd_elf_init_reloc_shdr): Delete.
	* elf.c (_bfd_elf_init_reloc_shdr): Make static.
	* elf64-x86-64.c (elf_x86_64_merge_symbol): Trim parameters to
	just what is needed.
	* elflink.c (_bfd_elf_merge_symbol): Update bed->merge_symbol call.
2013-03-25 06:00:06 +00:00
Alan Modra 8a56bd0251 * elf-bfd.h (_bfd_elf_merge_symbol): Delete declaration.
* elflink.c (_bfd_elf_merge_symbol): Make static.
	* elf32-sh-symbian.c (sh_symbian_relocate_section): Don't call
	_bfd_elf_merge_symbol, call _bfd_generic_link_add_one_symbol.
2013-03-23 10:25:02 +00:00
Alan Modra 96f29d96af PR ld/15270
* elflink.c (elf_link_add_object_symbols): Don't set def_regular
	or ref_regular for BFD_PLUGIN owned syms, or have them affect
	def_dynamic/ref_dynamic.
	(_bfd_elf_fix_symbol_flags): Don't set def_regular for BFD_PLUGIN
	owned syms.
2013-03-22 23:35:55 +00:00
David S. Miller 209be8d2a9 Fix attribute section output on sparc.
bfd/

	* elfxx-sparc.c (_bfd_sparc_elf_merge_private_bfd_data): Set type of
	hwcaps attribute.
2013-03-22 15:54:21 +00:00
Nick Clifton 5c0df4846e PR ld/14902
* elf32-h8300.c (elf32_h8_relax_delete_bytes): Fix off by one
	errors adjusting relocs and symbols.
2013-03-22 15:53:36 +00:00
Nick Clifton 81f5558e3d * elf32-h8300 (h8_relax_section): Add new relaxation of mov
@(disp:32,ERx) to mov @(disp:16,ERx).
	(R_H8_DISP32A16): New reloc.
	Comments added and corrected.
	* reloc.c (BFD_RELOC_H8_DISP32A16): New reloc.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.

	* ld.texinfo (H8/300): Add description of relaxation of
	mov @(disp:32,ERx) to mov @(disp:16,ERx).

	* ld-h8300/h8300.exp: Add new relax-7 test on ELF.
	* ld-h8300/relax-2.s: Add other direction and .w/.l variants of
	mov insns.
	* ld-h8300/relax-2.d: Update expected disassembly.
	* ld-h8300/relax-7a.s: New: tests for mov @(disp:32,ERx) -> mov
	@(disp:16,ERx).
	* ld-h8300/relax-7b.s: New: Likewise.
	* ld-h8300/relax-7.d: New: expected disassembly.

	* config/tc-h8300.c (do_a_fix_imm): Add relaxation of mov
	@(disp:32,ERx) to mov @(disp:16,ERx) insns by new reloc
	R_H8_DISP32A16.
	* config/tc-h8300.h: Remove duplicated defines.
2013-03-21 16:08:07 +00:00
Kai Tietz ce63b7b388 * coffgen.c (coff_real_object_p): Make global.
* peicode.h (coff_real_object_p): Add prototype.
	(FILHDR): Defined for COFF_IMAGE_WITH_PE as
	external_PEI_IMAGE_hdr structure.
	(coff_swap_filehdr_in): Handle variable header-size.
	* peXXigen.c (_bfd_XXi_swap_aouthdr_in): Just handle amount
	of directory-entiries as specified in pe-header.
2013-03-21 14:07:08 +00:00
Nick Clifton 088ca6c1e3 PR sim/15286
* elf32-arm.c (bfd_arm_get_mach_from_attributes): Identify XScale,
	iWMMXt and iWMMXt2 processors from attributes.
2013-03-21 10:34:11 +00:00
Alan Modra 8877b5e517 bfd/
* elflink.c (_bfd_elf_make_dynamic_reloc_section): Override
	sh_type according to is_rela.
ld/testsuite/
	* ld-elf/rel.c, ld-elf/relmain.c, ld-elf/relmain.out: New test.
	* ld-elf/shared.exp: Build and run it.
2013-03-20 03:44:56 +00:00
Alan Modra ffa9430db1 PR ld/12549
bfd/
	* elflink.c (elf_link_add_object_symbols): Exclude weak refs when
	considering whether an --as-needed library is needed.
ld/
	* ld.texinfo (--as-needed): Update.
ld/testsuite/
	* ld-elf/pr14862.out: Expect no output.
2013-03-18 02:47:03 +00:00
Tom Tromey cc0ea93c75 gdb
* symfile.c (get_debug_link_info): Remove.
	(find_separate_debug_file_by_debuglink): Use
	bfd_get_debug_link_info.
bfd
	* opncls.c (bfd_get_debug_link_info): Rename from
	get_debug_link_info.  Export.  Update comment.
	(find_separate_debug_file): Update.
	* bfd-in2.h: Rebuild.
2013-03-14 20:11:12 +00:00
Nick Clifton 59c108f731 * elf64-aarch64.c (elf_backend_can_gc_sections): Enable
gc-section support.
        (elf64_aarch64_gc_sweep_hook): Handle GOT, TLS and PLT related relocs.

        * lib/ld-lib.exp (check_gc_sections_available): Remove aarch64
from list of
        targets that don't support gc-section.
2013-03-08 17:37:30 +00:00
Nick Clifton abb3f6cca7 * elf-bfd.h (elfcore_write_s390_tdb): Add prototype.
* elf.c (elfcore_write_s390_tdb): New function.
	(elfcore_write_register_note): Call it.
	(elfcore_grok_s390_tdb): New function.
	(elfcore_grok_note): Call it.

	* readelf.c (get_note_type): Add NT_S390_TDB.
2013-03-08 17:13:31 +00:00
Maciej W. Rozycki af924177b5 * elfxx-mips.c (mips_elf_allocate_lazy_stub): Correct data type. 2013-03-08 11:50:27 +00:00
Corinna Vinschen 48385e3898 * config.bfd: Add x86_64-*-cygwin to list of supported targets. 2013-03-05 11:47:01 +00:00
Alan Modra f75e0e336f * elf32-ppc.c (ppc_elf_relocate_section <R_PPC_PLTREL24>): Adjust
non-zero addends when relocatable, rather than addends >= 32768.
	Always zero "addend" before applying relocation.
2013-03-04 12:12:11 +00:00
Nick Clifton 17e3916e23 * archive64.c (bfd_elf64_archive_write_armap): Fix calculation of
file pointer offsets for thin archives.
2013-03-04 09:21:43 +00:00
Julian Brown 3064e1ff79 bfd/
* elf32-arm.c (elf32_arm_size_dynamic_sections): Don't call
    elf32_arm_allocate_dynrelocs for source reloc for non-dynamic link.

    ld/testsuite/
    * ld-arm/tls-local-static.s: New test.
    * ld-arm/tls-local-static.d: New.
    * ld-arm/arm-elf.exp (tls-local-static): Add test.
2013-02-28 10:31:34 +00:00
DJ Delorie 4107ae2218 * reloc.c (BFD_RELOC_RL78_CODE): Add.
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.
* elf32-rl78.c (rl78_elf_relocate_section): Handle weak code
references in compuated relocs.

* config/tc-rl78.c (reloc_function): Add %code -> BFD_RELOC_RL78_CODE.
(rl78_op): Handle %code().
(rl78_cons_fix_new): Likewise, but ignore for 20-bit operands.
(tc_gen_reloc): Likwise; convert to a computed reloc.
(md_apply_fix): Likewise.
2013-02-27 21:39:20 +00:00
Anthony Green 730fbaf8fd Tweak moxie-rtems triplet recognition 2013-02-26 22:07:55 +00:00
H.J. Lu 35399224a1 Set unique_global only for definition
bfd/

	PR ld/15167
	* elf64-ia64-vms.c (elf64_vms_link_add_object_symbols): Set
	unique_global only for definition.
	* elflink.c (_bfd_elf_merge_symbol): Don't set unique_global
	here.
	(elf_link_add_object_symbols): Set unique_global only
	for definition.

ld/testsuite/

	PR ld/15167
	* ld-unique/unique.exp: Add a test for shared library with
	reference.
2013-02-22 01:20:48 +00:00
Alan Modra c03551323c bfd/
* elf-bfd.h (struct elf_build_id): Extracted from..
	(struct elf_build_id_info): ..here.  Delete.
	(struct output_elf_obj_tdata): New, extracted from..
	(struct elf_obj_tdata): ..here.  Reorganize for better packing.
	Add "o" field.
	(elf_program_header_size): Reference tdata->o.
	(elf_seg_map, elf_next_file_pos, elf_eh_frame_hdr, elf_linker,
	elf_stack_flags, elf_shstrtab, elf_strtab_sec, elf_shstrtab_sec,
	elf_section_syms, elf_num_section_syms, elf_flags_init): Likewise.
	* elf.c (bfd_elf_allocate_object): Allocate output_elf_obj_tdata
	when opening bfd in any mode that might write.
	(_bfd_elf_write_object_contents): Use build_id field in
	output_elf_obj_tdata.
	(_bfd_elf_close_and_cleanup): Tweak elf_shstrtab test.
	(elfobj_grok_gnu_build_id): Adjust for elf_tdata changes.
gdb/
	* elfread.c (build_id_bfd_get): Adjust for elf_tdata changes.
ld/
	* emultempl/elf32.em (write_build_id, setup_build_id): Adjust
	for elf_tdata changes.
2013-02-21 04:35:22 +00:00
Alan Modra 228e534f16 * elf-bfd.h (struct core_elf_obj_tdata): New.
(struct elf_obj_tdata): Delete core_signal, core_pid, core_lwpid,
	core_program, and core_command.  Add "core".
	* elf.c (bfd_elf_mkcorefile): Allocate "core" struct.
	Update all refs to tdata core fields.
	* elf32-am33lin.c, * elf32-arm.c, * elf32-cris.c, * elf32-frv.c,
	* elf32-hppa.c, * elf32-i386.c, * elf32-m68k.c, * elf32-mips.c,
	* elf32-nios2.c, * elf32-ppc.c, * elf32-s390.c, * elf32-score.c,
	* elf32-score7.c, * elf32-sh.c, * elf32-sparc.c, * elf32-tilegx.c,
	* elf32-tilepro.c, * elf32-xtensa.c, * elf64-aarch64.c,
	* elf64-hppa.c, * elf64-mips.c, * elf64-ppc.c, * elf64-tilegx.c,
	* elf64-x86-64.c, * elfcore.h, * elfn32-mips.c: Update all refs
	to tdata core fields.
2013-02-21 03:02:30 +00:00
Alan Modra 12bd695738 bfd/
* elf-bfd.h (struct elf_obj_tdata): Rename segment_map to seg_map.
	Delete num_locals and num_globals.
	(elf_num_locals, elf_num_globals): Don't define.
	(elf_seg_map, elf_next_file_pos, elf_eh_frame_hdr, elf_linker,
	elf_stack_flags, elf_strtab_sec, elf_shstrtab_sec): Define.
	* bfd.c, * elf-eh-frame.c, * elf-nacl.c, * elf-vxworks.c, * elf.c,
	* elf32-arm.c, * elf32-lm32.c, * elf32-ppc.c, * elf32-rx.c,
	* elf32-spu.c, * elf64-hppa.c, * elfcode.h, * elflink.c,
	* elfnn-ia64.c, * elfxx-mips.c: Use newly defined elf_obj_tdata
	accessor macros.
	* elf.c (elf_map_symbols): Add pnum_locals param.  Return
	number of locals syms via new param.
	(swap_out_syms): Adjust to suit elf_map_symbols change.
ld/
	* emultempl/elf-generic.em: Use newly defined elf_obj_tdata
	accessor macros.
2013-02-21 02:29:11 +00:00
Maciej W. Rozycki cbf8d970f7 * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Also clear
STO_MICROMIPS annotation.
2013-02-19 21:58:46 +00:00
Alan Modra 30e8ee25e3 include/
* bfdlink.h (struct bfd_link_info): Delete emit_note_gnu_build_id.
bfd/
	* configure.in: Bump version to 2.23.52.
	* elf-bfd.h (struct elf_build_id_info): New.
	(struct elf_obj_tdata): Delete after_write_object_contents,
	after_write_object_contents_info and build_id_size.  Make build_id
	a pointer to struct elf_build_id_info.
	* elf.c (_bfd_elf_write_object_contents): Style.  Update
	after_write_ibject_contents invocation.
	(elfobj_grok_gnu_build_id): Update for new build_id struct.  Don't
	allow zero size notes.
	* configure: Regenerate.
gdb/
	* elfread.c (struct build_id): Delete.  Use struct elf_build_id
	throughout file instead.
	(build_id_bfd_get): Update to use new elf_tdata build_id field.
	Don't xmalloc return value.
	(build_id_verify): Similarly.  Don't xfree.
	(build_id_to_debug_filename): Update.
	(find_separate_debug_file_by_buildid): Update, don't xfree.
ld/
	* emultempl/elf32.em (emit_note_gnu_build_id): New static var.
	Replace all info->emit_note_gnu_build_id refs.
	(id_note_section_size): Rename from
	gld${EMULATION_NAME}_id_note_section_size.
	(struct build_id_info): Delete.
	(write_build_id): Rename from
	gld${EMULATION_NAME}_write_build_id_section.
	Update elf_tdata usage.  Style, formatting.
	(setup_build_id): New function.
	(gld${EMULATION_NAME}_after_open): Use setup_build_id.
2013-02-18 23:50:32 +00:00
Maciej W. Rozycki 5b175e562b * elf64-mips.c (micromips_elf64_howto_table_rel): Add
R_MICROMIPS_SCN_DISP and R_MICROMIPS_JALR.
	(micromips_elf64_howto_table_rela): Likewise.
	(micromips_reloc_map): Add BFD_RELOC_MICROMIPS_JALR.
	* elfn32-mips.c (elf_micromips_howto_table_rel): Add
	R_MICROMIPS_SCN_DISP and R_MICROMIPS_JALR.
	(elf_micromips_howto_table_rela): Likewise.
	(micromips_reloc_map): Add BFD_RELOC_MICROMIPS_JALR.
2013-02-18 23:20:45 +00:00
Maciej W. Rozycki e8faf7d129 * elfxx-mips.c (MICROMIPS_P): New macro.
(_bfd_mips_elf_symbol_processing): Use it.
2013-02-18 23:18:16 +00:00
Maciej W. Rozycki c164a95dfa * elfxx-mips.c (_bfd_mips_elf_create_dynamic_sections): Clarify
comment on _PROCEDURE_LINKAGE_TABLE_ creation.
2013-02-18 23:16:35 +00:00
Alan Modra d45f8bdadc PR ld/12549
* elf-bfd.h (_bfd_elf_strtab_clear_refs): Delete.
	(_bfd_elf_strtab_clear_all_refs): Declare.
	(_bfd_elf_strtab_resize): Declare.
	* elf-strtab.c (_bfd_elf_strtab_clear_refs): Delete.
	(_bfd_elf_strtab_clear_all_refs): New function.
	(_bfd_elf_strtab_resize): Likewise.
	* elflink.c (elf_link_add_object_symbols): Use _bfd_elf_strtab_resize.
2013-02-18 10:40:19 +00:00
Alan Modra 698600e4b4 * elf-bfd.h (struct elf_obj_tdata): Move find_line_info, local_stubs,
local_call_stubs, elf_data_symbol, elf_text_symbol, elf_data_section,
	and elf_text_section to..
	* elfxx-mips.c (struct mips_elf_obj_tdata): ..here.  Update all refs.
	* elf64-alpha.c (struct mips_elf_find_line): Rename to..
	(struct alpha_elf_find_line): ..this.
	(struct alpha_elf_obj_tdata): Add find_line_info, update refs.
2013-02-18 02:56:58 +00:00
H.J. Lu 3d5bef4c08 Don't add DT_NEEDED for references from the dummy bfd
bfd/

	PR ld/15146
	* elflink.c (elf_link_add_object_symbols): Don't add DT_NEEDED
	for references from the dummy bfd.

ld/

	PR ld/15146
	* plugin.c (plugin_notice): Replace the undefined dummy bfd with
	the real one.

ld/testsuite/

	PR ld/15146
	* ld-plugin/pr15146.d: New file.
	* ld-plugin/pr15146a.c: Likewise.
	* ld-plugin/pr15146b.c: Likewise.
	* ld-plugin/pr15146c.c: Likewise.
	* ld-plugin/pr15146d.c: Likewise.

	* ld-plugin/lto.exp: Add tests for PR ld/15146.
2013-02-16 17:54:37 +00:00
H.J. Lu 313ed4a9b0 Also track weak references
PR ld/15149
	* elflink.c (elf_link_add_object_symbols): Also track weak
	references.
2013-02-16 17:48:57 +00:00
H.J. Lu 989fbeffb2 Don't allow a nested archive pointing to itself
PR binutils/15151
	* archive.c (_bfd_find_nested_archive): Don't allow a nested
	archive pointing to itself.
	(_bfd_get_elt_at_filepos): Revert the last 2 changes.
2013-02-15 18:26:06 +00:00
Nick Clifton a043396b72 PR binutils/15140
* ar.c (open_inarch): Fail on attempts to convert a normal archive
	to a thin archive or vice versa.
	* elfcomm.c (make_qualified_name): Handle corrupted thin
	archives.
	* readelf.c (process_archive): Likewise.
	* doc/binutils.texi: Clarify documentation describing thin
	archives.

	* archive.c (_bfd_get_elt_at_filepos): Prevent an infinite loop
	accessing a corrupt nested archive.
2013-02-15 14:37:39 +00:00
Richard Sandiford 13db6b44ea bfd/
* elfxx-mips.c (mips_got_page_ref): New structure.
	(mips_got_page_entry): Use a section rather than a (bfd, symndx)
	pair to represent the anchor point.
	(mips_got_info): Add a got_page_refs field.
	(mips_elf_link_hash_table): Add a sym_cache field.
	(mips_got_page_ref_hash, mips_got_page_ref_eq): New functions.
	(mips_got_page_entry_hash, mips_got_page_entry_eq): Update for
	new anchor representation.
	(mips_elf_create_got_info): Create got_page_refs rather than
	got_page_entries.
	(mips_elf_record_got_page_ref): New function.
	(mips_elf_pages_for_range): Move further down file.
	(mips_elf_record_got_page_entry): Likewise.  Take a got as argument.
	Use a section rather than a (bfd, symndx) pair to represent the
	anchor point.
	(mips_elf_resolve_got_page_ref): New function.
	(mips_elf_resolve_final_got_entries): Use it to populate
	got_page_entries.
	(_bfd_mips_elf_check_relocs): Call mips_elf_record_got_page_ref
	rather than mips_elf_record_got_page_entry.  Only nullify h
	afterwards.
	(mips_elf_lay_out_got): Call mips_elf_resolve_final_got_entries
	earlier.

ld/testsuite/
	* ld-mips-elf/mips16-pic-2.dd,
	ld-mips-elf/mips16-pic-2.gd: Remove 3 unused local GOT entries.
	* ld-mips-elf/got-page-4a.s, ld-mips-elf/got-page-4b.s,
	ld-mips-elf/got-page-4a.d, ld-mips-elf/got-page-4a.got,
	ld-mips-elf/got-page-4b.d, ld-mips-elf/got-page-4b.got,
	ld-mips-elf/got-page-5.s, ld-mips-elf/got-page-5.d,
	ld-mips-elf/got-page-5.got, ld-mips-elf/got-page-6.s,
	ld-mips-elf/got-page-6.d, ld-mips-elf/got-page-6.got,
	ld-mips-elf/got-page-7a.s, ld-mips-elf/got-page-7b.s,
	ld-mips-elf/got-page-7c.s, ld-mips-elf/got-page-7d.s,
	ld-mips-elf/got-page-7e.s, ld-mips-elf/got-page-7.d,
	ld-mips-elf/got-page-7.got: New tests.
	* ld-mips-elf/mips-elf.exp: Run them.
2013-02-13 14:08:58 +00:00
Richard Sandiford 57093f5e80 bfd/
* elfxx-mips.c (mips_elf_lay_out_got): Count VxWorks GOT relocs
	in g->relocs.
2013-02-12 09:54:56 +00:00
Alan Modra 9c3f90c430 * elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Provide
suitable definition when using generic linker hash table.
2013-02-11 22:15:53 +00:00
Richard Sandiford 476366af69 bfd/
* elfxx-mips.c (mips_elf_count_got_entries): Delete.
	(mips_elf_check_recreate_got, mips_elf_recreate_got): Take a
	mips_elf_traverse_got_arg.  Count GOT entries.
	(mips_elf_resolve_final_got_entries): Take the bfd_link_info
	as argument.  Update after above changes.
	(mips_elf_merge_got, mips_elf_lay_out_got): Don't call
	mips_elf_count_got_entries.  Update the calls to
	mips_elf_resolve_final_got_entries.
2013-02-11 18:20:51 +00:00
Richard Sandiford 9ab066b4cf bfd/
* elfxx-mips.c (mips_got_tls_type): New enum.
	(mips_got_entry): Add tls_initialized.
	(mips_elf_got_entry_hash, mips_elf_got_entry_eq, mips_tls_got_relocs)
	(mips_elf_count_got_entry, mips_elf_initialize_tls_index): Remove
	GOT_TLS_TYPE masks.
	(mips_elf_reloc_tls_type, mips_tls_got_entries)
	(mips_elf_record_global_got_symbol, mips_elf_initialize_tls_index)
	(_bfd_mips_elf_finish_dynamic_symbol): Use GOT_TLS_NONE rather
	than GOT_NORMAL.
	(mips_elf_initialize_tls_slots): Replace got_offset and tls_type_p
	arguments with a GOT entry.  Remove GOT_TLS_TYPE masks.  Use
	tls_initialized rather than GOT_TLS_DONE.
	(mips_tls_got_index): Delete.
	(mips_elf_local_got_index, mips_elf_global_got_index): Use
	mips_elf_initialize_tls_slots rather than mips_tls_got_index.
	(mips_elf_record_got_entry): Initialize tls_initialized.
2013-02-11 18:17:57 +00:00
Richard Sandiford 6c42ddb92b bfd/
* elfxx-mips.c (mips_got_entry): Remove tls_ldm_offset.
	(mips_elf_link_hash_entry): Remove tls_ie_type, tls_gd_type,
	tls_ie_got_offset and tls_gd_got_offset.
	(mips_elf_link_hash_newfunc): Remove initialization.
	(mips_elf_create_got_info): Likewise.
	(mips_elf_count_local_got_entries, mips_elf_count_global_tls_entries)
	(mips_tls_single_got_index): Delete.
	(mips_elf_local_got_index): Always use the GOT entry to track
	GOT indices.
	(mips_elf_global_got_index): Likewise.
	(mips_elf_create_local_got_entry): Assert that TLS entries have
	already been allocated.
	(mips_elf_record_global_got_symbol): Don't initialize
	tls_ie_type or tls_gd_type.
	(mips_elf_count_got_symbols): Only count reloc-only GOT entries here.
	(mips_elf_initialize_tls_index): Allocate a GOT index for every TLS
	entry.
	(mips_elf_lay_out_got): Use mips_elf_count_got_entries to count
	the GOT entries.
	(_bfd_mips_elf_finish_dynamic_symbol): Assert that TLS GOT offsets
	have been allocated.
	(_bfd_mips_elf_copy_indirect_symbol): Remove handling of
	tls_ie_type and tls_gd_type.
2013-02-11 18:15:47 +00:00
Richard Sandiford ebc53538f7 bfd/
* elfxx-mips.c (mips_elf_create_local_got_entry): Tidy.  Avoid
	aliasing violation.  Check for htab allocation failures.
2013-02-11 18:12:27 +00:00
Richard Sandiford 13fbec8390 bfd/
* elfxx-mips.c (mips_elf_primary_global_got_index): New function,
	split out from...
	(mips_elf_global_got_index): ...here.  Reorder arguments so that
	the output bfd and info come first.
	(mips_elf_calculate_relocation): Update the call to
	mips_elf_global_got_index accordingly.
	(_bfd_mips_elf_finish_dynamic_symbol): Use
	mips_elf_primary_global_got_index rather than
	mips_elf_global_got_index.
	(_bfd_mips_vxworks_finish_dynamic_symbol): Likewise.
2013-02-11 18:11:17 +00:00
Richard Sandiford 3dff0dd1e3 bfd/
* elfxx-mips.c (mips_got_entry): Update comments.
	(mips_elf_multi_got_entry_eq): Rename to...
	(mips_elf_got_entry_eq): ...this, deleting the old definition.
	(mips_elf_create_got_info): Remove master_got_p argument.
	Always use mips_elf_got_entry_eq.
	(mips_elf_bfd_got, mips_elf_multi_got, mips_elf_create_got_section):
	Update calls accordingly.

ld/testsuite/
	* ld-mips-elf/tlsdyn-o32-1.d, ld-mips-elf/tlsdyn-o32-1.got,
	ld-mips-elf/tlsdyn-o32-2.d, ld-mips-elf/tlsdyn-o32-2.got,
	ld-mips-elf/tlsdyn-o32-3.d, ld-mips-elf/tlsdyn-o32-3.got,
	ld-mips-elf/tls-hidden3.d, ld-mips-elf/tls-hidden3.got: Update
	for new hash table order.
2013-02-11 18:09:24 +00:00
Richard Sandiford d720656991 bfd/
* elfxx-mips.c (mips_got_info): Remove bfd2got.
	(mips_elf_bfd2got_hash): Delete.
	(mips_elf_got_per_bfd_arg): Remove bfd2got.
	(mips_elf_replace_bfd_got, mips_elf_count_got_entries): New functions.
	(mips_elf_global_got_index, mips_elf_create_local_got_entry): Use
	g->next to test for the multigot case.  Use mips_elf_bfd_got rather
	than mips_elf_got_for_ibfd.
	(mips_elf_bfd2got_entry_hash, mips_elf_bfd2got_entry_eq)
	(mips_elf_got_for_ibfd, mips_elf_get_got_for_bfd): Delete.
	(mips_elf_make_got_per_bfd): Replace with...
	(mips_elf_add_got_entry): ...this new function.
	(mips_elf_make_got_pages_per_bfd): Replace with...
	(mips_elf_add_got_page_entry): ...this new function.
	(mips_elf_merge_got_with): Replace bfd2got argument with separate
	bfd and GOT arguments.  Use mips_elf_add_got_entry and
	mips_elf_add_got_page_entry instead of mips_elf_make_got_per_bfd
	and mips_elf_make_got_pages_per_bfd.  Use mips_elf_replace_bfd_got
	to set the BFD's GOT and free the old table.
	(mips_elf_merge_got): Replace bfd2got argument with separate
	bfd and GOT arguments.  Apply mips_elf_resolve_final_got_entries.
	Use mips_elf_count_got_entries to count the number of entries in
	each GOT.  Update the calls to mips_elf_merge_got_with.
	(mips_elf_adjust_gp): Use g->next to test for the multigot case.
	Use mips_elf_bfd_got rather than mips_elf_got_for_ibfd.
	(mips_elf_multi_got): Don't create the bfd2got hash table.
	Replace hash table traversal with a walk over the input bfds,
	updating the call to mips_elf_merge_got.  Use mips_elf_replace_bfd_got
	to set the output bfd's GOT.
	(mips_elf_lay_out_got): Rename "sub" to "ibfd".  Record that all
	bfds use the master GOT in the single-GOT case.
	(_bfd_mips_elf_finish_dynamic_sections): Use mips_elf_bfd_got
	rather than mips_elf_got_for_ibfd.

ld/testsuite/
	* ld-mips-elf/tls-hidden4.got, ld-mips-elf/tls-multi-got-1.d,
	ld-mips-elf/tls-multi-got-1.got: Update for changes in the order
	that symbols are added to per-bfd GOTs.
2013-02-11 18:06:10 +00:00
Richard Sandiford ee227692d7 bfd/
* elfxx-mips.c (mips_elf_obj_tdata): Add a got field.
	(mips_elf_bfd_got, mips_elf_record_got_entry): New functions.
	(mips_elf_record_global_got_symbol): Update the hash entry before
	adding the mips_got_entry.  Use mips_elf_record_got_entry to do
	the latter.
	(mips_elf_record_local_got_symbol): Use mips_elf_record_got_entry.
	(mips_elf_record_got_page_entry): Record the entry in both the
	master and bfd GOTs.
2013-02-11 18:01:58 +00:00