Commit Graph

3793 Commits

Author SHA1 Message Date
Nick Clifton 894891db7f * elflink.c (_bfd_elf_link_create_dynamic_sections): If the
backend does not provide a function for creating dynamic sections
	then fail.
	(bfd_elf_final_link): Issue a warning message if a dynamic section
	has the SHT_NOTE type.
	(bfd_elf_final_link): Do not look for dynamic strings in a section
	that does not have the SHT_STRTAB type or the name .dynstr.
	* elf32-arm.c (elf32_arm_finish_dynamic_sections): Fail if the got
	section is not in the output binary.
	* elf32-hppa.c (elf32_hppa_finish_dynamic_sections): Likewise.

	* ld-elf/elf.exp: Add test for linking a shared library with a
	broken linker script that marks dynamic sections as being notes.
	* ld-elf/note-3.s: New test source file.
	* ld-elf/note-3.t: New test linker script.
	* ld-elf/note-3.l: Expected output from the linker.
	* lib/ld-lib.exp (run_ld_link_tests): Improve description.
2011-06-10 14:04:25 +00:00
Nick Clifton ba85c43e2c PR ld/12845
* elf.c (_bfd_elf_init_private_section_data): Add an assertion
	that the output section has an allocated bfd_elf_section_data
	structure.
	* elfxx-mips.c (mips_elf_check_symbols): Do not create a stub for
	symbols in sections that have been removed by garbage collection.

	* emultempl/mipself.em (mips_add_stub_section): Do not add stubs
	for sections that have been removed by garbage collection.
2011-06-09 10:36:20 +00:00
H.J. Lu 56d4d7f261 Build x32 DSO from x86-64 object file only for native.
2011-06-08  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-x86-64/x86-64.exp: Build x32 DSO from x86-64 object file
	only for native.
2011-06-09 06:00:09 +00:00
H.J. Lu adc7571d31 Allow building x32 DSO from x86-64 object file.
bfd/

2011-06-08  H.J. Lu  <hongjiu.lu@intel.com>

	* elf64-x86-64.c (elf_x86_64_check_relocs): Allow R_X86_64_64
	relocations in SEC_DEBUGGING sections when building shared
	libraries.

ld/testsuite/

2011-06-08  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-x86-64/simple.c: New.
	* ld-x86-64/x86-64-x32.rd: Likewise.

	* ld-x86-64/x86-64.exp: Check building x32 DSO from x86-64
	object file.
2011-06-09 05:51:11 +00:00
H.J. Lu 2400775011 Check relocations in note sections for --gc-sections.
bfd/

2011-06-08  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12851
	* elflink.c (elf_gc_sweep): Don't check SHT_NOTE sections here.
	(bfd_elf_gc_sections): Also check SHT_NOTE sections.

ld/testsuite/

2011-06-08  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12851
	* ld-elf/pr12851.d: New.
	* ld-elf/pr12851.s: Likewise.
2011-06-09 04:52:15 +00:00
Nick Clifton ab3719da06 configure.tgt: Accept any V850 architecture. 2011-06-08 07:43:18 +00:00
H.J. Lu 83c5d36fc5 Add a testcase for warning on common symbol in archive.
2011-06-07  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-elf/elf.exp: Build symbol3.a and symbol3w.a.

	* ld-elf/symbol3.s: New.
	* ld-elf/symbol3w.s: Likewise.
	* ld-elf/warn3.d: Likewise.
2011-06-08 04:47:04 +00:00
Alan Modra 5b4c94ad8d * ldlang.c (lang_one_common): Handle warning symbols. 2011-06-07 23:58:30 +00:00
Alan Modra 8a1241ef4b Regenerate. 2011-06-06 14:51:42 +00:00
Nick Clifton bc77a04af7 * Makefile.am (ALL_EMULATION_SOURCES): Add eelf32am33lin.c
Add rule to build eelf32am33lin.c
	* Makefile.in: Regenerate.
2011-06-03 10:36:39 +00:00
Nathan Sidwell 26d97720ed gas/
* config/tc-arm.c (parse_address_main): Handle -0 offsets.
	(encode_arm_addr_mode_2): Set default sign of zero here ...
	(encode_arm_addr_mode_3): ... and here.
	(encode_arm_cp_address): ... and here.
	(md_apply_fix): Use default sign of zero here.

	gas/testsuite/
	* gas/arm/inst.d: Adjust for signed zero offsets.
	* gas/arm/ldst-offset0.d: New test.
	* gas/arm/ldst-offset0.s: New test.
	* gas/arm/offset-1.d: New test.
	* gas/arm/offset-1.s: New test.

	ld/testsuite/
	Adjust tests for zero offset formatting.
	* ld-arm/cortex-a8-fix-bcc-plt.d: Adjust.
	* ld-arm/farcall-arm-arm-pic-veneer.d: Adjust.
	* ld-arm/farcall-arm-thumb.d: Adjust.
	* ld-arm/farcall-group-size2.d: Adjust.
	* ld-arm/farcall-group.d: Adjust.
	* ld-arm/farcall-mix.d: Adjust.
	* ld-arm/farcall-mix2.d: Adjust.
	* ld-arm/farcall-mixed-lib-v4t.d: Adjust.
	* ld-arm/farcall-mixed-lib.d: Adjust.
	* ld-arm/farcall-thumb-arm-blx-pic-veneer.d: Adjust.
	* ld-arm/farcall-thumb-arm-pic-veneer.d: Adjust.
	* ld-arm/farcall-thumb-thumb.d: Adjust.
	* ld-arm/ifunc-10.dd: Adjust.
	* ld-arm/ifunc-3.dd: Adjust.
	* ld-arm/ifunc-4.dd: Adjust.
	* ld-arm/ifunc-5.dd: Adjust.
	* ld-arm/ifunc-6.dd: Adjust.
	* ld-arm/ifunc-7.dd: Adjust.
	* ld-arm/ifunc-8.dd: Adjust.
	* ld-arm/jump-reloc-veneers-long.d: Adjust.
	* ld-arm/tls-longplt-lib.d: Adjust.
	* ld-arm/tls-thumb1.d: Adjust.

	opcodes/
	* arm-dis.c (print_insn_coprocessor): Explicitly print #-0
	as address offset.
	(print_arm_address): Likewise. Elide positive #0 appropriately.
	(print_insn_arm): Likewise.
2011-06-02 15:32:10 +00:00
Nick Clifton cc643b88f1 Fix spelling mistakes. 2011-06-02 13:43:24 +00:00
Paul Brook 63e1a0fcba 2011-05-31 Paul Brook <paul@codesourcery.com>
bfd/
	* elf32-arm.c (elf32_arm_final_link_relocate): Only do bl conversion
	for known functions.
	(elf32_arm_swap_symbol_in): Only set ST_BRANCH_TO_ARM for function
	symbols.

	include/elf/
	* arm.h (arm_st_branch_type): Add ST_BRANCH_UNKNOWN.

	ld/testsuite/
	* ld-arm/cortex-a8-far.d: Adjust expected output.
	* ld-arm/arm-call1.s: Give function symbol correct type.
	* ld-arm/arm-call2.s: Ditto.
	* ld-arm/farcall-group4.s: Ditto.
	* ld-arm/arm-elf.exp (cortex-a8-far): Define far symbols with correct
	type via assembly file.
	* ld-arm/cortex-a8-far-3.s: New file.
	* ld-arm/abs-call-1.s: Add Thumb tests
2011-05-31 14:07:58 +00:00
Paul Brook 6e7ce2cdd3 2011-05-31 Paul Brook <paul@codesourcery.com>
Nathan Sidwell  <nathan@codesourcery.com>

	gas/
	* config/tc-arm.c (fix_new_arm): Create an absolute symbol for
	pc-relative fixes to constants.
	* config/tc-arm.h (TC_FORCE_RELOCATATION_ABS): Define.

	ld/testsuite/
	* ld-arm/abs-call-1.d: New.
	* ld-arm/abs-call-1.s: New.
	* ld-arm/arm-elf.exp: Add it.
2011-05-31 13:40:04 +00:00
Paul Brook 12352d3f85 2011-05-31 Paul Brook <paul@codesourcery.com>
bfd/
	* elf32-arm.c (arm_stub_is_thumb): Add
	arm_stub_long_branch_v4t_thumb_tls_pic.
	(elf32_arm_final_link_relocate): TLS stubs are always ARM.
	Handle Thumb stubs.

	ld/testsuite/
	* ld-arm/tls-longplt.d: Update expected output.
	* ld-arm/tls-thumb1.d: Ditto.
2011-05-31 13:37:27 +00:00
Alan Modra 04c932a298 PR 12763
missed from last commit
2011-05-27 12:47:12 +00:00
Nick Clifton f20db198c0 * scripttempl/v850.sc (_heap_start): Provide. 2011-05-27 10:47:46 +00:00
H.J. Lu 6769d5017f Handle R_X86_64_TPOFF64 in executable.
bfd/

2011-05-26  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12809
	* elf64-x86-64.c (elf_x86_64_relocate_section): Handle
	R_X86_64_TPOFF64 in executable.

ld/testsuite/

2011-05-26  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12809
	* ld-x86-64/tlsbin.s: Add a test for LE with large model.

	* ld-x86-64/tlsbin.dd: Updated.
	* ld-x86-64/tlsbin.rd: Likewise.
	* ld-x86-64/tlsbin.sd: Likewise.
	* ld-x86-64/tlsbin.td: Likewise.
	* ld-x86-64/tlsbindesc.dd: Likewise.
	* ld-x86-64/tlsbindesc.rd: Likewise.
	* ld-x86-64/tlsbindesc.sd: Likewise.
	* ld-x86-64/tlsbindesc.td: Likewise.
2011-05-26 13:22:04 +00:00
Hans-Peter Nilsson c4334bf97b * ld-cris/tls-e-tpoffcomm1.d: Adjust for second PR12763 change,
setting TLS file offset.
2011-05-24 00:06:17 +00:00
Nick Clifton 45394486ba * ld-elf/shared.exp: Revert previous delta. Do not build
libraries in a non-native environment.
2011-05-23 09:13:57 +00:00
Alan Modra 270396f296 * ldmisc.c (vfinfo): Add %H.
* ldmain.c (reloc_overflow): Use %H rather than %C.
	(reloc_dangerous, unattached_reloc): Likewise.
2011-05-23 06:13:35 +00:00
Alan Modra 6de6a7fe35 PR 12763
bfd/
	* elf.c (assign_file_positions_for_load_sections): Set sh_offset for
	.tbss, and page align same for all SHT_NOBITS sections.
ld/
	* ldlang.c (lang_output_section_find_by_flags): Match orphan .sdata2
	like sections to existing .sdata2, and similarly for orphan TLS
	sections.
	* emultempl/elf32.em (place_orphan): Exclude .tbss from orphan_bss.
2011-05-23 05:41:01 +00:00
Alan Modra 3bd61671c3 PR 12763
* ld-elf/binutils.exp: Don't run tdata3 for hppa64.
2011-05-23 05:29:38 +00:00
Hans-Peter Nilsson b71457c579 * ld-cris/tls-e-tpoffcomm1.d: Adjust for PR12763 change removing
empty program header.
2011-05-21 01:47:24 +00:00
Alan Modra 67e9eb74af PR 12763
* ld-elf/tdata3.s: New test.
	* ld-elf/tbss3.s: New test.
	* ld-elf/binutils.exp: Consolidate tbss and tdata tests.
2011-05-20 15:33:29 +00:00
Bernd Schmidt 4a73203297 ld/testsuite/
* ld-tic6x/pcr-reloc.d: New test.
	* ld-tic6x/pcr-reloc.s: New test.

	gas/testsuite/
	* gas/tic6x/pcr-relocs.d: New test.
	* gas/tic6x/pcr-relocs.s: New test.
	* gas/tic6x/pcr-relocs-undef.d: New test.
	* gas/tic6x/pcr-relocs-undef.s: New test.
	* gas/tic6x/reloc-bad-2.s: Update for pcr_offset.
	* gas/tic6x/reloc-bad-2.l: Update for pcr_offset.

	bfd/
	* elf32-tic6x.c (elf32_tic6x_howto_table): Add entries for
	R_C6000_PCR_H16 and R_C6000_PCR_L16.
	(elf32_tic6x_relocate_section): Handle them.

	gas/
	* config/tc-tic6x.c (tic6x_operators): Add "pcr_offset".
	(tic6x_parse_name): Handle it.
	(tic6x_fix_new_exp): Handle O_pcr_offset.
	(tic6x_fix_adjustable): Return 0 for the new relocs.
	(md_apply_fix): Handle them.
	(tc_gen_reloc): Likewise.
	* config/tc-tic6x.h (tic6x_fix_info): Add a fix_subsy member.
2011-05-20 10:10:00 +00:00
Nick Clifton dd98f8d276 PR ld/12761
* elflink.c (elf_link_add_object_symbols): Process .gnu.warning
	sections when building shared libraries.

	* lib/ld-lib.exp (run_cc_link_tests): Add an optional 8th
	parameter - an expected warning message from the linker.
	* ld-elf/shared.exp (build_tests): Expect a warning message when
	building the libbarw.so library.

	* ld-elf/shared.exp: Run library building tests even when not
	building a native toolchain.
2011-05-18 14:04:32 +00:00
Nick Clifton 84bff83f79 PR ld/12759
* emultempl/rxelf.em (ignore_lma): New variable.
	(rx_elf_create_output_section_statements): Pass the setiing of
	ignore_lma to bfd_elf32_rx_set_target_flags.
	(OPTION_IGNORE_LMA): Define.
	(OPTION_NO_IGNORE_LMA): Define.
	(PARSE_AND_LIST_LONGOPTS): Add ignore lma.
	(PARSE_AND_LIST_OPTIONS): Add ignore lma.
	(PARSE_AND_LIST_ARGS_CASES): Add ignore lma.

	* elf32-rx.c (ignore_lma): New variable.
	(bfd_elf32_rx_set_target_flags): Add ignore_lma parameter.
	(rx_modify_program_headers): Only copy the LMA into the VMA if
	ignore_lma is true.
2011-05-17 16:02:31 +00:00
Alan Modra 16d96b5b8f PR ld/12760
include/
	* bfdlink.h (struct bfd_link_callbacks <notice>): Add "flags" and
	"string" param.
bfd/
	* coff-aux.c (coff_m68k_aux_link_add_one_symbol): Adjust "notice" call.
	* elflink.c (elf_link_add_object_symbols): Likewise.
	* linker.c (_bfd_generic_link_add_one_symbol): Likewise.
ld/
	* ldmain.c (notice): Add "flags" and "string" param.
	* plugin.c (plugin_notice): Likewise.  Handle indirect, warning
	and constructor syms.
2011-05-17 13:02:18 +00:00
H.J. Lu e3b66208d1 Replace --private with --private-headers for objdump.
2011-05-16  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-scripts/phdrs.exp: Replace --private with
	--private-headers for objdump.
	* ld-scripts/phdrs2.exp: Likewise.
2011-05-16 13:47:28 +00:00
Nathan Sidwell f37a7048a8 * ldlang.c (print_assignment): Use the symbol's section if we
use its value.
	* ldexp.c (exp_fold_tree_1): Skip self-assignment.  Expand
	comment on copying symbol type.
2011-05-16 11:34:48 +00:00
Alan Modra cd6eee13df PR ld/12760
* plugin.c (plugin_notice): Set u.undef.abfd for symbols made
	undefweak.
2011-05-16 00:58:11 +00:00
Alan Modra 83e7bd17d6 * ldlang.c (lang_leave_output_section_statement): Don't copy
previous lma_region if given address.
2011-05-16 00:22:39 +00:00
Richard Sandiford 77c56f443d bfd/
* elfxx-mips.c (_bfd_mips_elf_check_relocs): Record both local and
	global GOT entries for GOT_PAGE relocations against global symbols.

ld/testsuite/
	* lib/ld-lib.exp (run_ld_link_tests): Simplify pass/fail logic.
	Fail if the link command fails and if no test rules are defined.
	* ld-mips-elf/reloc-6a.s, ld-mips-elf/reloc-6b.s: New tests.
	* ld-mips-elf/mips-elf.exp: Run them.
2011-05-15 18:52:01 +00:00
Bernd Schmidt 2a6163793f ld/
(eelf32_tic6x_linux_be.c, eelf32_tic6x_linux_le.c,
	eelf32_tic6x_elf_be.c, eelf32_tic6x_elf_le.c): New rules.
	* Makefile.am (ALL_EMULATIONS): Add these files.
	(eelf32_tic6x_be.c, eelf32_tic6x_le.c): Depend on tic6xdsbt.em.
	* Makefile.in: Regenerated.
	* emultempl/tic6xdsbt.em (is_tic6x_target): Allow more tic6x target
	vectors.
	* emulparams/elf32_tic6x_elf_be.sh: New file.
	* emulparams/elf32_tic6x_elf_le.sh: New file.
	* emulparams/elf32_tic6x_linux_be.sh: New file.
	* emulparams/elf32_tic6x_linux_le.sh: New file.
	* configure.tgt (tic6x-*-elf, tic6x-*-uclinux): New.
	(tic6x-*-*): Replaced by these.

	ld/testsuite/
	* ld-tic6x/dsbt.ld (OUTPUT_FORMAT): Add.
	* ld-tic6x/tic6x.exp: Add OSABI tests.

	bfd/
	* config.bfd (tic6x-*-elf, tic6x-*-uclinux): New.
	(tic6x-*-*): Replaced by these.
	* elf32-tic6x.c (elf32_tic6x_set_osabi): New static function.
	(elf32_tic6x_check_relocs): Create dynamic sections if -shared.
	(elf_backend_relocs_compatible, elf_backend_post_process_headers):
	Define.
	(elf32_bed, TARGET_LITTLE_SYM, TARGET_LITTLE_NAME, TARGET_BIG_SYM,
	TARGET_BIG_NAME, ELF_OSABI): Redefine twice, and include
	"elf32-target.h" two more times.
	* configure.in: Handle bfd_elf32_tic6x_linux_be_vec,
	bfd_elf32_tic6x_linux_le_vec, bfd_elf32_tic6x_elf_be_vec and
	bfd_elf32_tic6x_elf_le_vec.
	* configure: Regenerate.
2011-05-13 18:15:33 +00:00
Jan Beulich 3ac5406bdb bfd/
2011-05-13  Jan Beulich  <jbeulich@novell.com>

	* config.bfd: Add targets x86_64-*-pe and x86_64-*-pep.

ld/
2011-05-13  Jan Beulich  <jbeulich@novell.com>

	* configure.tgt: Add targets x86_64-*-pe and x86_64-*-pep.
2011-05-13 06:43:13 +00:00
Alan Modra c472114968 missed changelog from last commit 2011-05-13 04:39:08 +00:00
Alan Modra c9eaa05f39 * ld-elf/flags1.d: Don't xfail tic6x.
* ld-scripts/weak.exp: Correct comments.  Don't xfail sh-pe.  Remove
	redundant xfail.
	* ld-selective/sel-dump.exp: Don't xfail alpha.
	* ld-selective/selective.exp: Run for alpha.
	* ld-undefined/weak-undef.exp: Don't xfail hppa64.
2011-05-13 04:19:18 +00:00
Bernd Schmidt de1491f042 * config/default.exp (ld_assemble): Pass flags parameter to
default_ld_assemble.
	(ld_assemble_flags): New function.
	* ld-elf/frame.exp: Pass -mpic and -mpid flags to the assembler on
	tic6x.
	* ld-elf/exclude.exp: Likewise.
	* lib/ld-lib.exp (default_ld_assemble): Take extra argument in_flags
	and pass it to the assembler.
2011-05-12 10:00:06 +00:00
Richard Sandiford 250826bd54 ld/testsuite/
* ld-mips-elf/mips-elf.exp: Add missing $has_newabi tests.
2011-05-11 12:50:58 +00:00
H.J. Lu 31507b90da Remoe pr12730.cc/pr12730.out.
2011-05-09  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-elf/elf.exp (array_tests): Remove "pr12730".
	(array_tests_pie): Remove "PIE pr12730".
	(array_tests_static): Remove "static pr12730".

	* ld-elf/pr12730.cc: Removed.
	* ld-elf/pr12730.out: Likewise.
2011-05-09 14:36:14 +00:00
Paul Brook fbd9ad907d 2011-05-09 Paul Brook <paul@codesourcery.com>
bfd/
	* bfd-in.h (elf32_tic6x_fix_exidx_coverage): Add prototype.
	* bfd-in2.h: Regenerate.
	* elf32-tic6x.c: Include limits.h.
	(tic6x_unwind_edit_type, tic6x_unwind_table_edit,
	_tic6x_elf_section_data): New.
	(elf32_tic6x_section_data): Define.
	(elf32_tic6x_new_section_hook): Allocate target specific data.
	(elf32_tic6x_add_unwind_table_edit): New function.
	(get_tic6x_elf_section_data, elf32_tic6x_adjust_exidx_size,
	elf32_tic6x_insert_cantunwind_after, elf32_tic6x_add_low31,
	elf32_tic6x_copy_exidx_entry): New functions.
	(elf_backend_write_section): Define.

	ld/
	* emultempl/tic6xdsbt.em (merge_exidx_entries): New.
	(compare_output_sec_vma): New function.
	(gld${EMULATION_NAME}_after_allocation): New function.
	(OPTION_NO_MERGE_EXIDX_ENTRIES): Define.
	(PARSE_AND_LIST_OPTIONS): Add --no-merge-exidx-entries.
	(PARSE_AND_LIST_ARGS_CASES): Add OPTION_NO_MERGE_EXIDX_ENTRIES.
	(LDEMUL_AFTER_ALLOCATION): Set.
	* ld.texinfo: Document c6x --no-merge-exidx-entries.

	ld/testsuite/
	* ld-tic6x/discard-unwind.ld: New.
	* ld-tic6x/unwind.ld: New.
	* ld-tic6x/unwind-1.d: New test.
	* ld-tic6x/unwind-1.s: New test.
	* ld-tic6x/unwind-2.d: New test.
	* ld-tic6x/unwind-2.s: New test.
	* ld-tic6x/unwind-3.d: New test.
	* ld-tic6x/unwind-3.s: New test.
	* ld-tic6x/unwind-4.d: New test.
	* ld-tic6x/unwind-4.s: New test.
	* ld-tic6x/unwind-5.d: New test.
	* ld-tic6x/unwind-5.s: New test.
	* ld-tic6x/unwind-6.d: New test.
2011-05-09 13:23:27 +00:00
Dave Korn 730035f7af bfd/ChangeLog:
PR ld/12365
	* cofflink.c (bfd_coff_link_input_bfd): Check for and warn about
	references to symbols defined in discarded sections.

ld/ChangeLog:

	PR ld/12365
	* scripttempl/pe.sc (__rt_psrelocs_start): New symbol definition.
	(__rt_psrelocs_end): Likewise.
	(__rt_psrelocs_size): Likewise difference between the above.
	(__RUNTIME_PSEUDO_RELOC_LIST_END__): Move outside .rdata section
	immediately after end of pseudo-reloc data.
	(___RUNTIME_PSEUDO_RELOC_LIST_END___): Likewise.
	(__RUNTIME_PSEUDO_RELOC_LIST__): Move outside .rdata section and
	calculate backward from list end.
	(___RUNTIME_PSEUDO_RELOC_LIST___): Likewise.
	* scripttempl/pep.sc: Likewise.

ld/testsuite/ChangeLog:

	PR ld/12365
	* ld-plugin/plugin-7.d: Allow underscore in error message.
	* ld-plugin/plugin-8.d: Likewise.
2011-05-07 14:29:10 +00:00
H.J. Lu 310fd250b9 Reverse copy .ctors/.dtors sections if needed.
bfd/

2011-05-07  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12730
	* elf.c (_bfd_elf_section_offset): Check SEC_ELF_REVERSE_COPY.

	* elflink.c (elf_link_input_bfd): Reverse copy .ctors/.dtors
	sections if needed.

	* section.c (SEC_ELF_REVERSE_COPY): New.
	* bfd-in2.h: Regenerated.

ld/testsuite/

2011-05-07  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12730
	* ld-elf/elf.exp (array_tests): Add "pr12730".
	(array_tests_pie): New.
	(array_tests_static): Add -static for "static init array mixed".
	Add "static pr12730".  Run array_tests_pie for Linux.

	* ld-elf/init-mixed.c (ctor1007): Renamed to ...
	(ctor1007a): This.
	(ctor1007b): New.
	(ctors1007): Remove ctor1007.  Add ctor1007b and ctor1007a.
	(dtor1007): Renamed to ...
	(dtor1007a): This.
	(dtor1007b): New.
	(dtors1007): Remove dtor1007.  Add dtor1007b and dtor1007a.
	(ctor65535): Renamed to ...
	(ctor65535a): This.
	(ctor65535b): New.
	(ctors65535): Remove ctor65535.  Add ctor65535b and ctor65535a.
	(dtor65535): Renamed to ...
	(dtor65535a): This.
	(dtor65535b): New.
	(dtors65535): Remove dtor65535.  Add dtor65535b and dtor65535a.

	* ld-elf/pr12730.cc: New.
	* ld-elf/pr12730.out: Likewise.
2011-05-07 14:12:59 +00:00
Tristan Gingold 55221e4b5a 2011-05-06 Tristan Gingold <gingold@adacore.com>
* scripttempl/alphavms.sc (CODE): Add *$CODE*.
2011-05-06 10:44:31 +00:00
Richard Sandiford 7d24e6a65a bfd/
* elf32-arm.c (cortex_a8_erratum_scan): If the stub is a Thumb
	branch to a PLT entry, redirect it to the PLT's Thumb entry point.

ld/testsuite/
	* ld-arm/cortex-a8-fix-b-plt.s, ld-arm/cortex-a8-fix-b-plt.d,
	ld-arm/cortex-a8-fix-bcc-plt.s, ld-arm/cortex-a8-fix-bcc-plt.d,
	ld-arm/cortex-a8-fix-bl-plt.s, ld-arm/cortex-a8-fix-bl-plt.d,
	ld-arm/cortex-a8-fix-blx-plt.s, ld-arm/cortex-a8-fix-blx-plt.d,
	ld-arm/cortex-a8-fix-plt.ld: New tests.
	* ld-arm/arm-elf.exp: Run them.
2011-05-06 10:21:32 +00:00
Bernd Schmidt c6a8f6e0ed bfd/
* elf32-tic6x.c (elf32_tic6x_final_link): New function.
	(elf32_tic6x_merge_attributes): Do not warn for PID or PIC
	mismatch.  Choose the lower of the two values.
	(bfd_elf32_bfd_final_link): New macro.

ld/testsuite/
	* ld-tic6x/shared-nopic.d: New test.
	* ld-tic6x/shared-nopid.d: New test.
	* ld-tic6x/attr-pid-21.d: Don't expect a warning; check readelf
	output instead.
	* ld-tic6x/attr-pid-12.d: Likewise.
	* ld-tic6x/attr-pic-01.d: Likewise.
	* ld-tic6x/attr-pic-10.d: Likewise.
	* ld-tic6x/attr-pid-01.d: Likewise.
	* ld-tic6x/attr-pid-10.d: Likewise.
	* ld-tic6x/attr-pid-02.d: Likewise.
	* ld-tic6x/attr-pid-20.d: Likewise.
	* ld-tic6x/got-reloc-inrange.d: Pass -mpic and -mpid options to gas.
2011-05-05 16:05:19 +00:00
Tristan Gingold 45cfb56cf4 2011-05-04 Tristan Gingold <gingold@adacore.com>
* emultempl/generic.em (ld_${EMULATION_NAME}_emulation): Add
	LDEMUL_ADD_OPTIONS and LDEMUL_HANDLE_OPTION.
	* emultempl/vms.em (OPTION_IDENTIFICATION): New macro.
	(gld${EMULATION_NAME}_add_options): New function.
	(gld${EMULATION_NAME}_list_options): Ditto.
	(gld${EMULATION_NAME}_handle_option): Ditto.
	(LDEMUL_ADD_OPTIONS, LDEMUL_HANDLE_OPTION)
	(LDEMUL_LIST_OPTIONS): Define.
2011-05-04 08:31:04 +00:00
Alan Modra 2f65ac726a PR ld/12726
* ldexp.h (lang_phase_type): Add lang_assigning_phase_enum.
	* ldexp.c (exp_fold_tree_1): Correct assign to dot comment.  Don't
	assign to dot when lang_assigning_phase_enum.
	* ldlang.h (lang_do_assignments): Update prototype.
	* ldlang.c (lang_do_assignments): Add phase parameter.  Update all
	callers.
	* pe-dll.c (pe_dll_fill_sections, pe_exe_fill_sections): Update
	lang_do_assignments calls.
2011-05-03 14:56:14 +00:00
Paul Brook 2fbb87f627 2011-05-03 Paul Brook <paul@codesourcery.com>
bfd/
	* elf32-tic6x.c (elf32_tic6x_howto_table,
	elf32_tic6x_howto_table_rel, (elf32_tic6x_gc_sweep_hook,
	elf32_tic6x_relocate_section, elf32_tic6x_check_relocs):
	Add R_C6000_EHTYPE.

	gas/
	* config/tc-tic6x.c (s_ehtype): New function.
	(md_pseudo_table): Add "ehtype".
	(tic6x_fix_adjustable, md_apply_fix): BFD_RELOC_C6000_EHTYPE.
	* doc/c-tic6x.texi: Document .ehtype directive.

	ld/testsuite/
	* ld-tic6x/ehtype-reloc-1-rel.d: New test.
	* ld-tic6x/ehtype-reloc-1.d: New test.
	* ld-tic6x/ehtype-reloc-1.s: New test.
2011-05-03 11:17:22 +00:00
H.J. Lu 2abca860af Add testcases for PR ld/12718.
2011-05-01  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12718
	* ld-i386/i386.exp: Run pr12718.
	* ld-x86-64/x86-64.exp: Likewise.

	* ld-i386/pr12718.d: New.
	* ld-i386/pr12718.s: Likewise.
	* ld-x86-64/pr12718.d: Likewise.
	* ld-x86-64/pr12718.s: Likewise.
2011-05-01 13:38:22 +00:00
Alan Modra e0605dbe1c PR ld/12614
* emultempl/pe.em (_after_open): Correctly check whether symbol is
	in undef list.
2011-04-28 15:29:42 +00:00
Nick Clifton 72b016b4ac * dw2gencfi.c (dwcfi_seg_list): New struct.
(dwcfi_hash): New static hash variable.
	(get_debugseg_name): New.
	(alloc_debugseg_item): New.
	(make_debug_seg): New.
	(dwcfi_hash_insert): New.
	(dwcfi_hash_find): New.
	(dwcfi_hash_find_or_make): New.
	(cfi_insn_data): New member cur_seg.
	(cie_entry): Likewise.
	(fde_entry): New cseg and handled members.
	(alloc_fde_entry): Initialize cseg member.
	(alloc_cfi_insn_data): Initialize cur_seg member.
	(dot_cfi_sections): Compare for beginning of
	section names via strncmp.
	(get_cfi_seg): New.
	(cfi_finish): Treat link-once sections.
	(is_now_linkonce_segment): New local helper.
	(output_cie): Ignore cie entries not member of current
	segment.
	(output_fde): Likewise.
	(select_cie_for_fde): Likewise.
	(cfi_change_reg_numbers): Add new argument for current segment
	and ignore insn elements, if not part of current segment.
	* ehopt.c (get_cie_info): Use strncmp for
	section name matching.
	(heck_eh_frame): Likewise.

	* coffcode.h (sec_to_styp_flags): Allow linkonce for
	debugging sections.

	* scripttempl/pe.sc: Handle .eh_frame($|.)* sections.
	* scripttempl/pep.sc: Likewise.

	* ld-pe/pe.exp: Add cfi/cfi32 tests.
	* ld-pe/cfi.d: New.
	* ld-pe/cfi32.d: New.
	* ld-pe/cfia.s: New.
	* ld-pe/cfib.s: New.
2011-04-26 15:28:08 +00:00
Alan Modra 35ed3f940b PR ld/12365
PR ld/12696
include/
	* bfdlink.h (ENUM_BITFIELD): Define.
	(struct bfd_link_hash_entry): Make "type" a bitfield.  Add "non_ir_ref".
	(struct bfd_link_callbacks <notice>): Pass bfd_link_hash_entry pointer
	rather than "name".
bfd/
	* coff-aux.c (coff_m68k_aux_link_add_one_symbol): Update "notice" call.
	* linker.c (_bfd_link_hash_newfunc): Clear bitfields.
	(_bfd_generic_link_add_one_symbol): Update "notice" call.
	* elflink.c (_bfd_elf_merge_symbol): Don't skip weak redefs when
	it is a redef of an IR symbol in a real BFD.
ld/
	* ldmain.c (notice): Delete "name" param, add "h".
	* plugin.c (plugin_notice): Likewise.  Set non_ir_ref.  Handle
	redefinitions of IR symbols in real BFDs.
	(plugin_multiple_definition, plugin_multiple_common): Delete.
	(non_ironly_hash, init_non_ironly_hash): Delete.
	(is_visible_from_outside): Traverse entry_symbol chain.
	(get_symbols): Use non_ir_ref flag rather than hash lookup.
2011-04-24 10:02:14 +00:00
H.J. Lu aa71524235 Skip local IFUNC symbols when checking dynamic relocs in read-only sections.
bfd/

2011-04-21  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12694
	* elf32-i386.c (elf_i386_readonly_dynrelocs): Skip local IFUNC
	symbols.
	* elf64-x86-64.c (elf_x86_64_readonly_dynrelocs): Likewise.

ld/testsuite/

2011-04-21  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12694
	* ld-ifunc/ifunc-14-i386.d: New.
	* ld-ifunc/ifunc-14-x86-64.d: Likewise.
	* ld-ifunc/ifunc-14a.s: Likewise.
	* ld-ifunc/ifunc-14b.s: Likewise.
2011-04-21 22:25:39 +00:00
Tristan Gingold 9165b2bff2 2011-04-21 Tristan Gingold <gingold@adacore.com>
* scripttempl/alphavms.sc: Add dwarf2 embedding marks.
2011-04-21 12:22:25 +00:00
Tristan Gingold ced323bd49 2011-04-20 Tristan Gingold <gingold@adacore.com>
* emultempl/aix.em (_add_options): Ignore -bbigtoc switch.
2011-04-20 13:43:24 +00:00
Alan Modra 8ad17b3a2c bfd/
* hash.c (bfd_default_hash_table_size): Make it an unsigned long.
	(bfd_hash_table_init_n): Overflow checking.
	(bfd_hash_set_default_size): Return current size.  Take unsigned long
	arg.  Add 65537 to hash_size primes.
	* bfd-in.h (bfd_hash_set_default_size): Update prototype.
	* bfd-in2.h: Regenerate.
gas/
	* hash.c (set_gas_hash_table_size): Use bfd_hash_set_default_size.
	(hash_new_sized): New function, split out from..
	(hash_new): ..here.
ld/
	* ld.h (ld_config_type <hash_table_size>): Make it an unsigned long.
2011-04-20 12:52:16 +00:00
Alan Modra 02d002477b PR ld/12365
bfd/
	* elfcode.h (elf_slurp_symbol_table): Put common plugin IR symbols
	in their own common section.
	* elflink.c (elf_link_add_object_symbols): Likewise.
	* linker.c (generic_link_check_archive_element): Don't lose flags
	if common section is pre-existing.
	(_bfd_generic_link_add_one_symbol): Likewise.
ld/
	* ldfile.c (ldfile_try_open_bfd): Move code creating and switching
	to plugin IR BFD..
	* ldmain.c (add_archive_element): ..and similar code here..
	* plugin.c (plugin_maybe_claim): ..to here.  New function.
	(plugin_call_claim_file): Make static.
	(asymbol_from_plugin_symbol): Set ELF st_shndx for common syms.
	(plugin_multiple_common): New function.
	(plugin_call_all_symbols_read): Hook in plugin_multiple_common.
	* plugin.h (plugin_call_claim_file): Don't declare.
	(plugin_maybe_claim): Declare.
2011-04-20 00:22:08 +00:00
Alan Modra 24f58f47de PR ld/12365
include/
	* bfdlink.h (struct bfd_link_callbacks): Modify multiple_definition
	and multiple_common parameters to pass in a bfd_link_hash_entry
	pointer rather than name,bfd etc. found in the hash entry.
bfd/
	* elflink.c (_bfd_elf_merge_symbol): Update multiple_common calls.
	* linker.c (_bfd_generic_link_add_one_symbol): Likewise.  Call
	multiple_definition regardless of allow_multiple_definition.
	* simple.c (simple_dummy_multiple_definition): Update.
	* xcofflink.c (xcoff_link_add_symbols): Update multiple_definition
	calls.
ld/
	* ldmain.c (multiple_definition): Take a bfd_link_hash_entry
	pointer arg rather than "name", "obfd", "osec", "oval".  Add code
	removed from linker.c.  Hack around xcofflink.c oddity in
	passing NULL nbfd.
	(multiple_common): Similarly.
	* plugin.c (orig_allow_multiple_defs): Delete.
	(plugin_call_all_symbols_read): Don't twiddle allow_multiple_definition.
	(plugin_multiple_definition): Update.
2011-04-20 00:11:33 +00:00
H.J. Lu 948b3cc42f Remove the unused ld-plugin/plugin-ignore.d.
2011-04-19  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-plugin/plugin-ignore.d: Removed.
2011-04-19 17:06:21 +00:00
H.J. Lu 86942c28f6 Update expected LTO linker errors for GCC 4.6.
2011-04-18  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-plugin/plugin-7.d: Update expected LTO linker errors for
	GCC 4.6.
	* ld-plugin/plugin-8.d: Likewise.
2011-04-18 21:45:37 +00:00
Kai Tietz dc204beb8b 2011-04-18 Kai Tietz <ktietz@redhat.com>
* deffilep.y (def_aligncomm): Avoid duplets.
2011-04-18 15:40:27 +00:00
Kai Tietz bdca0ea17b 2011-04-18 Kai Tietz <ktietz@redhat.com>
* deffilep.y (def_pool_str): New type.
	(pool_strs): Local static.
	(def_pool_alloc): Local function.
	(def_pool_strdup): Likewise.
	(def_pool_free): Likewise.
	(opt_name): Replace xmalloc/xstrdup by
	def_pool_alloc/def_pool_strdup.
	(dot_name): Likewise.
	(anylang_id): Likewise.
	(def_lex): Likewise.
	(def_file_parse): Call def_pool_free on
	exit and cleanup directives elements.
	(def_file_add_directive): Call def_pool_free.
2011-04-18 15:38:03 +00:00
Paul Brook 6970a02804 2011-04-18 Paul Brook <paul@codesourcery.com>
ld/
	* emulparams/elf32_tic6x_le.sh: Define OTHER_READONLY_SECTIONS
	for unwinding tables.
2011-04-18 13:41:40 +00:00
Alan Modra 901f1d179d PR ld/12365
PR ld/12672
missing changelog entries
2011-04-17 23:18:24 +00:00
Alan Modra 9e2278f567 PR ld/12365
PR ld/12672
bfd/
	* bfd.c (BFD_PLUGIN): Define.
	(BFD_FLAGS_SAVED, BFD_FLAGS_FOR_BFD_USE_MASK): Add BFD_PLUGIN.
	* bfd-in2.h: Regenerate.
	* elflink.c (elf_link_output_extsym): Strip undefined plugin syms.
	* opncls.c (bfd_make_readable): Don't lose original bfd flags.
ld/
	* ldfile.c (ldfile_try_open_bfd): Don't attempt any plugin action
	when no_more_claiming.
	* ldmain.c (add_archive_element): Likewise.
	(multiple_definition): Remove plugin_multiple_definition call.
	(notice): Remove plugin_notice call.
	* ldlang.c (lang_list_insert_after, void lang_list_remove_tail): Move.
	Delete prototype.
	(plugin_insert): New static var.
	(open_input_bfds): Only rescan libs after plugin insert point.
	(lang_gc_sections): Omit plugin claimed files.
	(lang_process): Set plugin_insert.  Only rescan when plugin adds
	objects.
	* plugin.h (no_more_claiming): Declare.
	(plugin_notice, plugin_multiple_definition): Don't declare.
	* plugin.c: Formatting.
	(orig_notice_all, orig_allow_multiple_defs, orig_callbacks,
	plugin_callbacks): New static vars.
	(no_more_claiming): Make global.
	(plugin_cached_allow_multiple_defs): Delete.
	(plugin_get_ir_dummy_bfd): Set SEC_EXCLUDE on dummy .text section,
	use newer bfd_make_section variant.  Make COMMON section too.
	Error handling.  Correct setting of gp size.
	(asymbol_from_plugin_symbol): Properly cast last arg of concat.
	(message): Likewise for ACONCAT.
	(asymbol_from_plugin_symbol): Use our COMMON section.
	(get_symbols): When report_plugin_symbols, show visibility too.
	(init_non_ironly_hash): Move.  Don't test non_ironly_hash.
	(plugin_load_plugins): Save state of linker callbacks, set up to
	call plugin_notice instead.  Call init_non_ironly_hash here.
	(plugin_call_all_symbols_read): Set plugin_multiple_definition in
	plugin callbacks.
	(plugin_notice): Rewrite.
	(plugin_multiple_definition): Make static, call original callback.
ld/testsuite/
	* ld-plugin/plugin-7.d: Adjust for plugin changes.
	* ld-plugin/plugin-8.d: Likewise.
	* ld-plugin/plugin.exp: Pass --verbose=2 for visibility test, and
	compare ld output to..
	* ld-plugin/plugin-12.d: New.
2011-04-17 23:15:13 +00:00
Maxim Kuvyrkov 9c68f58e48 * ld-m68k/tls-gd-ie-1.d: Stabilize test.
* ld-m68k/tls-gd-3.[sd]: New test.
2011-04-15 09:58:23 +00:00
Alan Modra 486329aaad PR ld/12672
* ldlang.c (enum open_bfd_mode): New.
	(open_input_bfds): Replace "force" param with "mode".  Reload
	archives for rescan.  Update all callers.
	(lang_process): Make another open_input_bfds pass for plugins.
2011-04-15 03:47:30 +00:00
Kai Tietz db17156eaa 2011-04-13 Kai Tietz <ktietz@redhat.com>
PR binutils/12658
	* deffile.h (def_file_add_export): Add is_dup argument.
	(def_file_add_import): Likewise.
	* deffilep.y (are_names_equal): New helper.
	(cmp_export_elem): New helper.
	(find_export_in_list): Add search routine for exports.
	(def_file_add_export): Check for duplicates.
	(cmp_import_elem): New helper.
	(find_import_in_list): Add search routine for imports.
	(def_file_add_import): Check for duplicates.
	(def_exports): Handle duplicates.
	(def_imports): Likewise.
	* pe-dll.c (process_def_file_and_drectve): Likewise.
	(pe_implied_import_dll): Likewise.
2011-04-13 12:53:36 +00:00
Richard Henderson 6452a567da * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Do not
exclude empty .got sections.
2011-04-12 23:23:02 +00:00
Nick Clifton ed0d9c711c * scripttempl/elf.sc (.exception_ranges): Add new section. 2011-04-11 15:38:12 +00:00
Nick Clifton f64b2e8d60 PR 10549
* elf-bfd.h (has_ifunc_symbols): Renamed to has_gnu_symbols.
	(has_gnu_symbols): Renamed from has_ifunc_symbols.
	* elf.c (_bfd_elf_set_osabi): Use new has_gnu_symbols name.
	* elf32-arm.c (elf32_arm_add_symbol_hook): Set has_gnu_symbols
	also if STB_GNU_UNIQUE symbol binding was seen.
	* elf32-i386.c (elf_i386_add_symbol_hook): Likewise.
	* elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise.
	* elf32-sparc.c (elf32_sparc_add_symbol_hook): Likewise.
	* elf64-ppc.c (ppc64_elf_add_symbol_hook): Likewise.
	* elf64-sparc.c (elf64_sparc_add_symbol_hook): Likewise.
	* elf64-x86-64.c (elf_x86_64_add_symbol_hook): Likewise.

	* ld-unique: New directory.
	* ld-unique/unique.exp: New file: Run the UNIQUE tests.
	* ld-unique/unique.s: New test file.
	* ld-unique/unique_empty.s: Likewise.
	* ld-unique/unique_shared.s: Likewise.
2011-04-11 08:13:22 +00:00
Alan Modra 721da2d9f9 * ld-elf/eh-frame-hdr.d: xfail avr. 2011-04-11 05:12:08 +00:00
H.J. Lu 959b0961c9 Properly handle R_386_TLS_LDO_32 for PIE.
bfd/

2011-04-08  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12654
	* elf32-i386.c (elf_i386_relocate_section): Check !executable
	instead of shared for R_386_TLS_LDO_32.

ld/testsuite/

2011-04-08  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12654
	* ld-i386/i386.exp: Run tlspie2.

	* ld-i386/tlspie2.d: New.
	* ld-i386/tlspie2.s: Likewise.
2011-04-08 16:14:49 +00:00
Nick Clifton 0e9dfb4626 PR ld/12643
* configure.tgt: Add support for arm-*-gnueabihf targets.
2011-04-08 16:05:12 +00:00
Eric B. Weddington 80518809de 2011-04-07 Eric B. Weddington <eric.weddington@atmel.com>
* Makefile.in: Regenerate. Remove stray eavrtiny10 rules.
2011-04-07 13:39:00 +00:00
Joseph Myers 91db4c57cf * configure.tgt: Remove stray ;;. 2011-04-07 01:19:22 +00:00
Joseph Myers 8c5fc80011 bfd:
* config.bfd (thumb-*-oabi): Don't handle in list of obsolete
	targets.
	(strongarm*, thumb*, xscale*): Remove architectures.
	(strongarm-*-kaos*, thumb-*-coff, thumb-*-elf, thumb-epoc-pe*,
	thumb-*-pe*, strongarm-*-elf, strongarm-*-coff, xscale-*-elf,
	xscale-*-coff): Remove targets.

binutils:
	* configure.in (thumb-*-pe*): Remove.
	* configure: Regenerate.

binutils/testsuite:
	* binutils-all/objcopy.exp (*arm*-*-coff): Change to arm*-*-coff.
	(xscale-*-coff, thumb*-*-coff, thumb*-*-pe): Don't handle.

gas:
	* configure.tgt (strongarm*be, strongarm*b, strongarm*,
	xscale*be|xscale*b, xscale*): Remove architectures.
	(thumb-*-coff, thumb-*-rtems*, thumb-*-elf, thumb-epoc-pe,
	thumb-*-pe, xscale-*-coff, xscale-*-elf): Remove targets.

gas/testsuite:
	* gas/all/gas.exp (*arm*-*-coff): Change to arm*-*-coff.
	(thumb*-*-coff, thumb*-*-pe*): Don;t handle.
	* gas/arm/arm.exp (*arm*-*-*): Change to arm*-*-*.
	(*xscale*-*-*): Don't handle.
	* gas/cfi/cfi.exp (xscale*-*): Don't handle.
	* gas/elf/elf.exp (*arm*-*-*): Change to arm*-*-*.
	(xscale*-*-*): Don't handle.

ld:
	* configure.tgt (thumb-*-linux-* | thumb-*-uclinux*,
	strongarm-*-coff, strongarm-*-elf, strongarm-*-kaos*,
	thumb-*-coff, thumb-*-elf, thumb-epoc-pe, thumb-*-pe,
	xscale-*-coff, xscale-*-elf): Remove targets.

ld/testsuite:
	* ld-selective/selective.exp (xscale-*-*): Don't handle.
	* ld-srec/srec.exp (strongarm*-*-*, xscale*-*-*, thumb-*-*): Don't
	handle.
	(*arm*-*-*): Change to arm*-*-*.
	(strongarm*-*-coff, xscale*-*-coff, thumb-*-coff*, thumb-*-pe*,
	thumb-*-elf*, strongarm*-*-*, thumb-*-*): Remove xfails.
	* ld-undefined/undefined.exp (thumb*-*-pe*, thumb*-*-pe*): Remove
	commented-out xfails.
	(thumb-elf): Remove reference in comment.
	* lib/ld-lib.exp (strongarm*-*-*, xscale*-*-*, thumb-*-*): Don't
	handle.
2011-04-06 17:09:56 +00:00
H.J. Lu a3293649cd Add a testcase for PR ld/12627.
2011-04-04  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12627
	* ld-i386/i386.exp: Run pr12627.

	* ld-i386/pr12627.d: New.
	* ld-i386/pr12627.s: Likewise.
	* ld-i386/pr12627.t: Likewise.
2011-04-04 16:36:29 +00:00
H.J. Lu d02c4aae3d Fix elf_l1om linker scripts.
2011-03-31  H.J. Lu  <hongjiu.lu@intel.com>

	* configure.tgt: Add elf_l1om to targ_extra_libpath for
	 x86_64-*-linux-*.

	* emulparams/elf_l1om.sh: Remove duplicates.
2011-03-31 22:23:09 +00:00
Bernd Schmidt ac14530735 include/elf/
* tic6x.h (R_C6000_JUMP_SPLOT, R_C6000_EHTYPE,
	R_C6000_PCR_H16, R_C6000_PCR_L16): New relocs.
	(SHN_TIC6X_SCOMMON): Define.

bfd/
	* elf32-tic6x.h (struct elf32_tic6x_params): New.
	(elf32_tic6x_setup): Declare.
	* elf32-tic6x.c: Include <limits.h>.
	(ELF_DYNAMIC_LINKER, DEFAULT_STACK_SIZE, PLT_ENTRY_SIZE): Define.
	(struct elf32_tic6x_link_hash_table, struct elf32_link_hash_entry):
	New structures.
	(elf32_tic6x_link_hash_table, is_tic6x_elf): New macros.
	(tic6x_elf_scom_section, tic6x_elf_scom_symbol,
	tic6x_elf_scom_symbol_ptr): New static variables.
	(elf32_tic6x_howto_table, elf32_tic6x_howto_table_rel,
	elf32_tic6x_reloc_map): Add R_C6000_JUMP_SLOT, R_C6000_EHTYPE,
	R_C6000_PCR_H16 and R_C6000_PCR_L16.
	(elf32_tic6x_link_hash_newfunc, elf32_tic6x_link_hash_table_create,
	elf32_tic6x_link_hash_table_free, elf32_tic6x_setup,
	elf32_tic6x_using_dsbt, elf32_tic6x_install_rela,
	elf32_tic6x_create_dynamic_sections, elf32_tic6x_make_got_dynreloc,
	elf32_tic6x_finish_dynamic_symbol, elf32_tic6x_gc_sweep_hook,
	elf32_tic6x_adjust_dynamic_symbol): New static functions.
	(elf32_tic6x_relocate_section): For R_C6000_PCR_S21, convert branches
	to weak symbols as required by the ABI.
	Handle GOT and DSBT_INDEX relocs, and copy relocs to the output file
	as needed when generating DSBT output.
	(elf32_tic6x_check_relocs, elf32_tic6x_add_symbol_hook,
	elf32_tic6x_symbol_processing, elf32_tic6x_section_from_bfd_section,
	elf32_tic6x_allocate_dynrelocs, elf32_tic6x_size_dynamic_sections,
	elf32_tic6x_always_size_sections, elf32_tic6x_modify_program_headers,
	elf32_tic6x_finish_dynamic_sections, elf32_tic6x_plt_sym_val,
	elf32_tic6x_copy_private_data, elf32_tic6x_link_omit_section_dynsym):
	New static functions.
	(ELF_MAXPAGESIZE): Define to 0x1000.
	(bfd_elf32_bfd_copy_private_bfd_data,
	bfd_elf32_bfd_link_hash_table_create,
	bfd_elf32_bfd_link_hash_table_free, elf_backend_can_refcount,
	elf_backend_want_got_plt, elf_backend_want_dynbss,
	elf_backend_plt_readonly, elf_backend_got_header_size,
	elf_backend_gc_sweep_hook, elf_backend_modify_program_headers,
	elf_backend_create_dynamic_sections, elf_backend_adjust_dynamic_symbol,
	elf_backend_check_relocs, elf_backend_add_symbol_hook,
	elf_backend_symbol_processing, elf_backend_link_output_symbol_hook,
	elf_backend_section_from_bfd_section,
	elf_backend_finish_dynamic_symbol, elf_backend_always_size_sections,
	elf32_tic6x_size_dynamic_sections, elf_backend_finish_dynamic_sections,
	elf_backend_omit_section_dynsym, elf_backend_plt_sym_val): Define.

	* bfd/reloc.c (BFD_RELOC_C6000_JUMP_SLOT, BFD_RELOC_C6000_EHTYPE,
	BFD_RELOC_C6000_PCR_H16, BFD_RELOC_C6000_PCR_S16): Add.
	* bfd/bfd-in2.h: Regenerate.
	* bfd/libbfd.h: Regenerate.
	* config.bfd: Accept tic6x-*-* instead of tic6x-*-elf.

gas/
	* config/tc-tic6x.c (sbss_section, scom_section, scom_symbol): New
	static variables.
	(md_begin): Initialize them.
	(s_tic6x_scomm): New static function.
	(md_pseudo_table): Add "scomm".
	(tc_gen_reloc): Really undo all adjustments made by
	bfd_install_relocation.
	* doc/c-tic6x.texi: Document the .scomm directive.

gas/testsuite/
	* gas/tic6x/scomm-directive-1.s: New test.
	* gas/tic6x/scomm-directive-1.d: New test.
	* gas/tic6x/scomm-directive-2.s: New test.
	* gas/tic6x/scomm-directive-2.d: New test.
	* gas/tic6x/scomm-directive-3.s: New test.
	* gas/tic6x/scomm-directive-3.d: New test.
	* gas/tic6x/scomm-directive-4.s: New test.
	* gas/tic6x/scomm-directive-4.d: New test.
	* gas/tic6x/scomm-directive-5.s: New test.
	* gas/tic6x/scomm-directive-5.d: New test.
	* gas/tic6x/scomm-directive-6.s: New test.
	* gas/tic6x/scomm-directive-6.d: New test.
	* gas/tic6x/scomm-directive-7.s: New test.
	* gas/tic6x/scomm-directive-7.d: New test.
	* gas/tic6x/scomm-directive-8.s: New test.
	* gas/tic6x/scomm-directive-8.d: New test.

ld/
	* emulparams/elf32_tic6x_le.sh (BIG_OUTPUT_FORMAT, EXTRA_EM_FILE,
	GENERATE_SHLIB_SCRIPT): New defines.
	(TEXT_START_ADDR): Define differently depending on target.
	(.got): Redefine to include "*(.dsbt)".
	(SDATA_START_SYMBOLS): Remove, replace with
	(OTHER_GOT_SYMBOLS): New.
	(OTHER_BSS_SECTIONS): Define only for ELF targets.
	* emultempl/tic6xdsbt.em: New file.
	* gen-doc.texi: Set C6X.
	* ld.texinfo: Likewise.
	(Options specific to C6X uClinux targets): New section.

binutils/
	* readelf.c (get_symbol_index_type): Handle SCOM for TIC6X.
	(dump_relocations): Likewise.

binutils/testsuite/
	* lib/binutils-common.exp (is_elf_format): Accept tic6x*-*-uclinux*.

ld/testsuite/
	* ld-scripts/crossref.exp: Add CFLAGS for tic6x*-*-*.
	* ld-elf/sec-to-seg.exp: Remove tic6x from list of targets defining
	pagesize to 1.
	* ld-tic6x/tic6x.exp: Add support for DSBT shared library/executable
	linking tests.
	* ld-tic6x/dsbt.ld: New linker script.
	* ld-tic6x/dsbt-be.ld: New linker script.
	* ld-tic6x/dsbt-overflow.ld: New linker script.
	* ld-tic6x/dsbt-inrange.ld: New linker script.
	* ld-tic6x/shlib-1.s: New test.
	* ld-tic6x/shlib-2.s: New test.
	* ld-tic6x/shlib-app-1r.s: New test.
	* ld-tic6x/shlib-app-1.s: New test.
	* ld-tic6x/shlib-1.sd: New test.
	* ld-tic6x/shlib-1.dd: New test.
	* ld-tic6x/shlib-app-1.rd: New test.
	* ld-tic6x/shlib-app-1rb.rd: New test.
	* ld-tic6x/shlib-app-1.sd: New test.
	* ld-tic6x/static-app-1rb.od: New test.
	* ld-tic6x/shlib-app-1.dd: New test.
	* ld-tic6x/shlib-app-1rb.sd: New test.
	* ld-tic6x/static-app-1b.od: New test.
	* ld-tic6x/static-app-1r.od: New test.
	* ld-tic6x/shlib-1rb.rd: New test.
	* ld-tic6x/shlib-app-1rb.dd: New test.
	* ld-tic6x/shlib-1rb.sd: New test.
	* ld-tic6x/shlib-1rb.dd: New test.
	* ld-tic6x/shlib-app-1b.od: New test.
	* ld-tic6x/tic6x.exp: New test.
	* ld-tic6x/static-app-1rb.rd: New test.
	* ld-tic6x/shlib-app-1r.od: New test.
	* ld-tic6x/static-app-1.od: New test.
	* ld-tic6x/static-app-1b.rd: New test.
	* ld-tic6x/static-app-1r.rd: New test.
	* ld-tic6x/static-app-1rb.sd: New test.
	* ld-tic6x/static-app-1b.sd: New test.
	* ld-tic6x/static-app-1rb.dd: New test.
	* ld-tic6x/static-app-1r.sd: New test.
	* ld-tic6x/static-app-1b.dd: New test.
	* ld-tic6x/shlib-1b.rd: New test.
	* ld-tic6x/static-app-1r.dd: New test.
	* ld-tic6x/shlib-app-1b.rd: New test.
	* ld-tic6x/shlib-1r.rd: New test.
	* ld-tic6x/shlib-app-1r.rd: New test.
	* ld-tic6x/shlib-1b.sd: New test.
	* ld-tic6x/static-app-1.rd: New test.
	* ld-tic6x/shlib-app-1b.sd: New test.
	* ld-tic6x/shlib-1r.sd: New test.
	* ld-tic6x/shlib-1b.dd: New test.
	* ld-tic6x/shlib-app-1r.sd: New test.
	* ld-tic6x/shlib-app-1b.dd: New test.
	* ld-tic6x/shlib-1r.dd: New test.
	* ld-tic6x/static-app-1.sd: New test.
	* ld-tic6x/shlib-app-1r.dd: New test.
	* ld-tic6x/static-app-1.dd: New test.
	* ld-tic6x/shlib-noindex.rd: New test.
	* ld-tic6x/shlib-noindex.dd: New test.
	* ld-tic6x/shlib-noindex.sd: New test.
	* ld-tic6x/got-reloc-local-1.s: New test.
	* ld-tic6x/got-reloc-local-2.s: New test.
	* ld-tic6x/got-reloc-local-r.d: New test.
	* ld-tic6x/got-reloc-global.s: New test.
	* ld-tic6x/got-reloc-global-addend-1.d: New test.
	* ld-tic6x/got-reloc-global-addend-1.s: New test.
	* ld-tic6x/got-reloc-global-addend-2.d: New test.
	* ld-tic6x/got-reloc-inrange.d: New test.
	* ld-tic6x/got-reloc-overflow.d: New test.
	* ld-tic6x/got-reloc-global-addend-2.s: New test.
	* ld-tic6x/dsbt-index-error.d: New test.
	* ld-tic6x/dsbt-index.d: New test.
	* ld-tic6x/dsbt-index.s: New test.
	* ld-tic6x/shlib-app-1.od: New test.
	* ld-tic6x/shlib-app-1rb.od: New test.
	* ld-tic6x/shlib-1.rd: New test.
	* ld-tic6x/weak.d: New test.
	* ld-tic6x/weak-be.d: New test.
	* ld-tic6x/weak.s: New test.
 	* ld-tic6x/weak-data.d: New test.
	* ld-tic6x/common.d: New test.
	* ld-tic6x/common.ld: New test.
	* ld-tic6x/common.s: New test.
2011-03-31 08:58:28 +00:00
Richard Henderson 991cda6c97 * ld-elf/elf.exp: Force 32-bit start address for alpha.
* ld-elf/group8a.d: Don't disable for alpha.
        * ld-elf/group8b.d: Likewise.
        * ld-gc/start.s: Use .dc.a instead of .long.
2011-03-30 17:41:36 +00:00
Alan Modra c3a7b1206d PR ld/12613
* ldlex.l (lex_warn_invalid): Don't assume char is unsigned.
2011-03-29 02:52:36 +00:00
Nick Clifton 5b806d2793 Add support for DragonFlyBSD target. 2011-03-28 11:18:27 +00:00
Joseph Myers f31d24a0a1 * configure.in: Check for windows.h, not Windows.h.
* configure: Regenerate.
	* plugin.c: Include windows.h, not Windows.h.
2011-03-28 10:27:07 +00:00
Eric B. Weddington d0289b45c2 Regenerate Makefile.in. 2011-03-25 18:04:48 +00:00
Joseph Myers d436a15e02 * lexsup.c (parse_args): Only set report_plugin_symbols if plugins
are enabled.  Mark level as possibly unused.
2011-03-23 19:53:06 +00:00
Alan Modra 663a1470e1 bfd/
* elf32-ppc.c (ppc_elf_tls_optimize): Catch more cases where
	old-style __tls_get_addr calls without marker relocs don't match
	their arg setup insn one for one.  If such mismatches are found
	report the reloc and don't do any tls optimization.
	* elf64-ppc.c (ppc64_elf_tls_optimize): Likewise.
ld/testsuite/
	* ld-powerpc/tlsmark.s: Delete non-optimizable section.
	* ld-powerpc/tlsmark32.s: Likewise.
	* ld-powerpc/tlsmark.d: Adjust to suit.
	* ld-powerpc/tlsmark32.d: Likewise.
	* ld-powerpc/tlsopt1.d, * ld-powerpc/tlsopt1.s: New.
	* ld-powerpc/tlsopt2.d, * ld-powerpc/tlsopt2.s: New.
	* ld-powerpc/tlsopt3.d, * ld-powerpc/tlsopt3.s: New.
	* ld-powerpc/tlsopt4.d, * ld-powerpc/tlsopt4.s: New.
	* ld-powerpc/tlsopt1_32.d, * ld-powerpc/tlsopt1_32.s: New.
	* ld-powerpc/tlsopt2_32.d, * ld-powerpc/tlsopt2_32.s: New.
	* ld-powerpc/tlsopt3_32.d, * ld-powerpc/tlsopt3_32.s: New.
	* ld-powerpc/tlsopt4_32.d, * ld-powerpc/tlsopt4_32.s: New.
	* ld-powerpc/powerpc.exp: Run new tests.
2011-03-23 15:25:06 +00:00
Eric B. Weddington 8cc66334fa /bfd:
2011-03-22  Eric B. Weddington  <eric.weddington@atmel.com>

	* archures.c: Add AVR XMEGA architecture information.
	* cpu-avr.c (arch_info_struct): Likewise.
	* elf32-avr.c (bfd_elf_avr_final_write_processing): Likewise.
	(elf32_avr_object_p): Likewise.

/gas:
2011-03-22  Eric B. Weddington  <eric.weddington@atmel.com>

	* config/tc-avr.c (struct avr_opcodes_s): Add opcode field.
	(AVR_INSN): Change definition to match.
	(avr_opcodes): Likewise, change to match.
	(mcu_types): Add XMEGA architecture names and new XMEGA device names.
	(md_show_usage): Add XMEGA architecture names.
	(avr_operand): Add 'E' constraint for DES instruction of XMEGA devices.
	Add support for SPM Z+ instruction.
	* doc/c-avr.texi: Add documentation for XMEGA architectures and
	devices.

/include/opcode:
2011-03-22  Eric B. Weddington  <eric.weddington@atmel.com>

	* avr.h (AVR_ISA_SPMX,AVR_ISA_DES,AVR_ISA_M256,AVR_ISA_XMEGA):
	New instruction set flags.
	(AVR_INSN): Add new instructions for SPM Z+, DES for XMEGA.

/ld:
2011-03-22  Eric B. Weddington  <eric.weddington@atmel.com>

	* Makefile.am (ALL_EMULATION_SOURCES): Add AVR XMEGA architectures.
	(eavrxmega?.c): Likewise.
	* configure.tgt (targ_extra_emuls): Likewise.
	* emulparams/avrxmega1.sh: New file.
	* emulparams/avrxmega2.sh: Likewise.
	* emulparams/avrxmega3.sh: Likewise.
	* emulparams/avrxmega4.sh: Likewise.
	* emulparams/avrxmega5.sh: Likewise.
	* emulparams/avrxmega6.sh: Likewise.
	* emulparams/avrxmega7.sh: Likewise.
	* emultempl/avrelf.em (avr_elf_${EMULATION_NAME}_before_allocation):
	Add avrxmega6, avrxmega7 to list of architectures for no stubs.

/opcodes:
2011-03-22  Eric B. Weddington  <eric.weddington@atmel.com>

	* avr-dis.c (avr_operand): Add opcode_str parameter. Check for
	post-increment to support LPM Z+ instruction. Add support for 'E'
	constraint for DES instruction.
	(print_insn_avr): Adjust calls to avr_operand. Rename variable.
2011-03-22 18:10:48 +00:00
Eric B. Weddington ef844a53d2 2011-03-21 Eric B. Weddington <eric.weddington@atmel.com>
* scripttempl/avr.sc: Add fuse, lock, and signature memory regions.
2011-03-21 20:07:42 +00:00
Mike Frysinger e6961d10d8 ld: vers19 test: add -rpath-link
Using -Wl,-rpath,. isn't sufficient for cross-linkers to locate the
necessary libraries.  So throw in -Wl,-rpath-link,. to make it work.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-03-15 23:34:30 +00:00
Richard Sandiford 34e77a920a include/elf/
* arm.h (R_ARM_IRELATIVE): New relocation.

bfd/
	* reloc.c (BFD_RELOC_ARM_IRELATIVE): New relocation.
	* bfd-in2.h: Regenerate.
	* elf32-arm.c (elf32_arm_howto_table_2): Rename existing definition
	to elf32_arm_howto_table_3 and replace with a single R_ARM_IRELATIVE
	entry.
	(elf32_arm_howto_from_type): Update accordingly.
	(elf32_arm_reloc_map): Map BFD_RELOC_ARM_IRELATIVE to R_ARM_IRELATIVE.
	(elf32_arm_reloc_name_lookup): Handle elf32_arm_howto_table_3.
	(arm_plt_info): New structure, split out from elf32_arm_link_hash_entry
	with an extra noncall_refcount field.
	(arm_local_iplt_info): New structure.
	(elf_arm_obj_tdata): Add local_iplt.
	(elf32_arm_local_iplt): New accessor macro.
	(elf32_arm_link_hash_entry): Replace plt_thumb_refcount,
	plt_maybe_thumb_refcount and plt_got_offset with an arm_plt_info.
	Change tls_type to a bitfield and add is_iplt.
	(elf32_arm_link_hash_newfunc): Update accordingly.
	(elf32_arm_allocate_local_sym_info): New function.
	(elf32_arm_create_local_iplt): Likewise.
	(elf32_arm_get_plt_info): Likewise.
	(elf32_arm_plt_needs_thumb_stub_p): Likewise.
	(elf32_arm_get_local_dynreloc_list): Likewise.
	(create_ifunc_sections): Likewise.
	(elf32_arm_copy_indirect_symbol): Update after the changes to
	elf32_arm_link_hash_entry.  Assert the is_iplt has not yet been set.
	(arm_type_of_stub): Add an st_type argument.  Use elf32_arm_get_plt_info
	to get PLT information.  Assert that all STT_GNU_IFUNC references
	are turned into PLT references.
	(arm_build_one_stub): Pass the symbol type to
	elf32_arm_final_link_relocate.
	(elf32_arm_size_stubs): Pass the symbol type to arm_type_of_stub.
	(elf32_arm_allocate_irelocs): New function.
	(elf32_arm_add_dynreloc): In static objects, use .rel.iplt for
	all R_ARM_IRELATIVE.
	(elf32_arm_allocate_plt_entry): New function.
	(elf32_arm_populate_plt_entry): Likewise.
	(elf32_arm_final_link_relocate): Add an st_type parameter.
	Set srelgot to null for static objects.  Use separate variables
	to record which st_value and st_type should be used when generating
	a dynamic relocation.  Use elf32_arm_get_plt_info to find the
	symbol's PLT information, setting has_iplt_entry, splt,
	plt_offset and gotplt_offset accordingly.  Check whether
	STT_GNU_IFUNC symbols should resolve to an .iplt entry, and change
	the relocation target accordingly.  Broaden assert to include
	.iplts.  Don't set sreloc for static relocations.  Assert that
	we only generate dynamic R_ARM_RELATIVE relocations for R_ARM_ABS32
	and R_ARM_ABS32_NOI.  Generate R_ARM_IRELATIVE relocations instead
	of R_ARM_RELATIVE relocations if the target is an STT_GNU_IFUNC
	symbol.  Pass the symbol type to arm_type_of_stub.  Conditionally
	resolve GOT references to the .igot.plt entry.
	(elf32_arm_relocate_section): Update the call to
	elf32_arm_final_link_relocate.
	(elf32_arm_gc_sweep_hook): Use elf32_arm_get_plt_info to get PLT
	information.  Treat R_ARM_REL32 and R_ARM_REL32_NOI as call
	relocations in shared libraries and relocatable executables.
	Count non-call PLT references.  Use elf32_arm_get_local_dynreloc_list
	to get the list of dynamic relocations for a local symbol.
	(elf32_arm_check_relocs): Always create ifunc sections.  Set isym
	at the same time as setting h.  Use elf32_arm_allocate_local_sym_info
	to allocate local symbol information.  Treat R_ARM_REL32 and
	R_ARM_REL32_NOI as call relocations in shared libraries and
	relocatable executables.  Record PLT information for local
	STT_GNU_IFUNC functions as well as global functions.   Count
	non-call PLT references.  Use elf32_arm_get_local_dynreloc_list
	to get the list of dynamic relocations for a local symbol.
	(elf32_arm_adjust_dynamic_symbol): Handle STT_GNU_IFUNC symbols.
	Don't remove STT_GNU_IFUNC PLTs unless all references have been
	removed.  Update after the changes to elf32_arm_link_hash_entry.
	(allocate_dynrelocs_for_symbol): Decide whether STT_GNU_IFUNC PLT
	entries should live in .plt or .iplt.  Check whether the .igot.plt
	and .got entries can be combined.  Use elf32_arm_allocate_plt_entry
	to allocate .plt and .(i)got.plt entries.  Detect which .got
	entries will need R_ARM_IRELATIVE relocations and use
	elf32_arm_allocate_irelocs to allocate them.  Likewise other
	non-.got dynamic relocations.
	(elf32_arm_size_dynamic_sections): Allocate .iplt, .igot.plt
	and dynamic relocations for local STT_GNU_IFUNC symbols.
	Check whether the .igot.plt and .got entries can be combined.
	Detect which .got entries will need R_ARM_IRELATIVE relocations
	and use elf32_arm_allocate_irelocs to allocate them.  Use stashed
	section pointers intead of strcmp checks.  Handle iplt and igotplt.
	(elf32_arm_finish_dynamic_symbol): Use elf32_arm_populate_plt_entry
	to fill in .plt, .got.plt and .rel(a).plt entries.  Point
	STT_GNU_IFUNC symbols at an .iplt entry if non-call relocations
	resolve to it.
	(elf32_arm_output_plt_map_1): New function, split out from
	elf32_arm_output_plt_map.  Handle .iplt entries.  Use
	elf32_arm_plt_needs_thumb_stub_p.
	(elf32_arm_output_plt_map): Call it.
	(elf32_arm_output_arch_local_syms): Add mapping symbols for
	local .iplt entries.
	(elf32_arm_swap_symbol_in): Handle Thumb STT_GNU_IFUNC symbols.
	(elf32_arm_swap_symbol_out): Likewise.
	(elf32_arm_add_symbol_hook): New function.
	(elf_backend_add_symbol_hook): Define for all targets.

opcodes/
	* arm-dis.c (get_sym_code_type): Treat STT_GNU_IFUNCs as code.

gas/
	* config/tc-arm.c (md_pcrel_from_section): Use S_FORCE_RELOC to
	determine whether a relocation is needed.
	(md_apply_fix, arm_apply_sym_value): Likewise.

ld/testsuite/
	* ld-arm/ifunc-1.s, ld-arm/ifunc-1.dd, ld-arm/ifunc-1.gd,
	ld-arm/ifunc-1.rd, ld-arm/ifunc-2.s, ld-arm/ifunc-2.dd,
	ld-arm/ifunc-2.gd, ld-arm/ifunc-2.rd, ld-arm/ifunc-3.s,
	ld-arm/ifunc-3.dd, ld-arm/ifunc-3.gd, ld-arm/ifunc-3.rd,
	ld-arm/ifunc-4.s, ld-arm/ifunc-4.dd, ld-arm/ifunc-4.gd,
	ld-arm/ifunc-4.rd, ld-arm/ifunc-5.s, ld-arm/ifunc-5.dd,
	ld-arm/ifunc-5.gd, ld-arm/ifunc-5.rd, ld-arm/ifunc-6.s,
	ld-arm/ifunc-6.dd, ld-arm/ifunc-6.gd, ld-arm/ifunc-6.rd,
	ld-arm/ifunc-7.s, ld-arm/ifunc-7.dd, ld-arm/ifunc-7.gd,
	ld-arm/ifunc-7.rd, ld-arm/ifunc-8.s, ld-arm/ifunc-8.dd,
	ld-arm/ifunc-8.gd, ld-arm/ifunc-8.rd, ld-arm/ifunc-9.s,
	ld-arm/ifunc-9.dd, ld-arm/ifunc-9.gd, ld-arm/ifunc-9.rd,
	ld-arm/ifunc-10.s, ld-arm/ifunc-10.dd, ld-arm/ifunc-10.gd,
	ld-arm/ifunc-10.rd, ld-arm/ifunc-11.s, ld-arm/ifunc-11.dd,
	ld-arm/ifunc-11.gd, ld-arm/ifunc-11.rd, ld-arm/ifunc-12.s,
	ld-arm/ifunc-12.dd, ld-arm/ifunc-12.gd, ld-arm/ifunc-12.rd,
	ld-arm/ifunc-13.s, ld-arm/ifunc-13.dd, ld-arm/ifunc-13.gd,
	ld-arm/ifunc-13.rd, ld-arm/ifunc-14.s, ld-arm/ifunc-14.dd,
	ld-arm/ifunc-14.gd, ld-arm/ifunc-14.rd, ld-arm/ifunc-15.s,
	ld-arm/ifunc-15.dd, ld-arm/ifunc-15.gd, ld-arm/ifunc-15.rd,
	ld-arm/ifunc-16.s, ld-arm/ifunc-16.dd, ld-arm/ifunc-16.gd,
	ld-arm/ifunc-16.rd, ld-arm/ifunc-dynamic.ld,
	ld-arm/ifunc-static.ld: New tests.
	* ld-arm/farcall-group.d, ld-arm/farcall-group-size2.d,
	ld-arm/farcall-mixed-lib-v4t.d, ld-arm/farcall-mixed-lib.d: Update
	for new stub hashes.
	* ld-arm/arm-elf.exp: Run them.
2011-03-14 16:04:16 +00:00
Richard Sandiford 35fc36a8d6 include/elf/
* internal.h (elf_internal_sym): Add st_target_internal.
	* arm.h (arm_st_branch_type): New enum.
	(ARM_SYM_BRANCH_TYPE): New macro.

bfd/
	* elf-bfd.h (elf_link_hash_entry): Add target_internal.
	* elf.c (swap_out_syms): Set st_target_internal for each
	Elf_Internal_Sym.
	* elfcode.h (elf_swap_symbol_in): Likewise.
	* elf32-i370.c (i370_elf_finish_dynamic_sections): Likewise.
	* elf32-sh-symbian.c (sh_symbian_relocate_section): Likewise.
	* elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise.
	* elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Likewise.
	* elflink.c (elf_link_output_extsym): Likewise.
	(bfd_elf_final_link): Likewise.
	(elf_link_add_object_symbols): Copy st_target_internal
	to the hash table if we see a definition.
	(_bfd_elf_copy_link_hash_symbol_type): Copy target_internal.
	* elf32-arm.c (elf32_arm_stub_hash_entry): Replace st_type with
	a branch_type field.
	(a8_erratum_fix, a8_erratum_reloc): Likewise.
	(arm_type_of_stub): Replace actual_st_type with an
	actual_branch_type parameter.
	(arm_build_one_stub): Use branch types rather than st_types to
	determine the type of branch.
	(cortex_a8_erratum_scan): Likewise.
	(elf32_arm_size_stubs): Likewise.
	(bfd_elf32_arm_process_before_allocation): Likewise.
	(allocate_dynrelocs_for_symbol): Likewise.
	(elf32_arm_finish_dynamic_sections): Likewise.
	(elf32_arm_final_link_relocate): Replace sym_flags parameter with
	a branch_type parameter.
	(elf32_arm_relocate_section): Update call accordingly.
	(elf32_arm_adjust_dynamic_symbol): Don't check STT_ARM_TFUNC.
	(elf32_arm_output_map_sym): Initialize st_target_internal.
	(elf32_arm_output_stub_sym): Likewise.
	(elf32_arm_symbol_processing): Delete.
	(elf32_arm_swap_symbol_in): Convert STT_ARM_TFUNCs into STT_FUNCs.
	Use st_target_internal to record the branch type.
	(elf32_arm_swap_symbol_out): Use st_target_internal to test for
	Thumb functions.
	(elf32_arm_is_function_type): Delete.
	(elf_backend_symbol_processing): Likewise.
	(elf_backend_is_function_type): Likewise.

gas/
	* config/tc-arm.c (arm_adjust_symtab): Set the branch type
	for Thumb symbols.

ld/
	* emultempl/armelf.em (gld${EMULATION_NAME}_finish): Check
	eh->target_internal.

opcodes/
	* arm-dis.c (get_sym_code_type): Don't check for STT_ARM_TFUNC.
	Use branch types instead.
	(print_insn): Likewise.
2011-03-14 15:55:04 +00:00
Richard Sandiford cbc704f397 bfd/
* elf32-arm.c (elf32_arm_check_relocs): Always assign a dynobj.
	(elf32_arm_finish_dynamic_sections): Move sgot != NULL assertion
	into the PLT block.

ld/
	* emultempl/armelf.em (arm_elf_before_allocation): Check dynobj
	instead of dynamic_sections_created.
2011-03-14 15:53:58 +00:00
Richard Sandiford f6e32f6db5 bfd/
* elf32-arm.c (elf32_arm_check_relocs): Use call_reloc_p,
	may_need_local_target_p and may_become_dynamic_p to classify
	the relocation type.  Don't check info->symbolic or h->def_regular
	when deciding whether to record a potential dynamic reloc.
	Don't treat potential dynamic relocs as PLT references.
	(elf32_arm_gc_sweep_hook): Update to match.  Assert that we don't
	try to make the PLT reference count go negative.

ld/testsuite/
	* ld-arm/arm-lib-plt-2a.s, ld-arm/arm-lib-plt-2b.s,
	ld-arm/arm-lib-plt-2.dd, ld-arm/arm-lib-plt-2.rd: New tests.
	* ld-arm/arm-elf.exp: Run them.
2011-03-14 15:53:33 +00:00
Richard Sandiford b436d85411 bfd/
* elf32-arm.c (elf32_arm_final_link_relocate): Always fill in the
	GOT entry here, rather than leaving it to finish_dynamic_symbol.
	Only create a dynamic relocation for local references if
	info->shared.
	(allocate_dynrelocs_for_symbol): Update dynamic relocation
	allocation accordingly.
	(elf32_arm_finish_dynamic_symbol): Don't initialise the GOT entry here.

ld/testsuite/
	* ld-arm/exec-got-1a.s, ld-arm/exec-got-1b.s, ld-arm/exec-got-1.d,
	ld-arm/unresolved-1.s, ld-arm/unresolved-1.d,
	ld-arm/unresolved-1-dyn.d: New tests.
	* ld-arm/arm-elf.exp: Run them.
2011-03-14 15:52:53 +00:00
H.J. Lu 52bc799a91 Support TLS x32 GD->IE, GD->LE and LD->LE transitions.
bfd/

2011-03-12  H.J. Lu  <hongjiu.lu@intel.com>

	* elf64-x86-64.c (elf_x86_64_check_tls_transition): Supprt TLS
	x32 GD->IE and GD->LE transitions.
	(elf_x86_64_relocate_section): Supprt TLS x32 GD->IE, GD->LE
	and LD->LE transitions.

ld/testsuite/

2011-03-12  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-x86-64/tlsgd4.dd: New.
	* ld-x86-64/tlsgd4.s: Likewise.
	* ld-x86-64/tlsgd5.dd: Likewise.
	* ld-x86-64/tlsgd5a.s: Likewise.
	* ld-x86-64/tlsgd5b.s: Likewise.
	* ld-x86-64/tlsgd6.dd: Likewise.
	* ld-x86-64/tlsgd6a.s: Likewise.
	* ld-x86-64/tlsgd6b.s: Likewise.
	* ld-x86-64/tlsld2.dd: Likewise.
	* ld-x86-64/tlsld2.s: Likewise.

	* ld-x86-64/x86-64.exp (x86_64tests): Add tlsgd4, libtlsgd5.so,
	tlsgd5, libtlsgd6.so, tlsgd6 and tlsld2.
2011-03-12 14:38:31 +00:00
Dave Korn 10be1b6abe [PATCH] Respect symbol wrappers when computing symbol resolutions.
ld/ChangeLog:

2011-03-10  Dave Korn  <dave.korn.cygwin@gmail.com>

	* plugin.c (get_symbols): Use wrapped lookup for undefined symbols.
2011-03-10 10:27:50 +00:00
Dave Korn 422b6f1440 [PATCH] Fix issue from GCC PR47527: no ELF flags, EABI attribs, etc. in dummy IR BFD.
ld/ChangeLog:

2011-03-10  Dave Korn  <dave.korn.cygwin@gmail.com>

	* ldlang.c (lang_check): Don't run checks on dummy IR BFDs.
2011-03-10 10:26:26 +00:00
Dave Korn 8543fde54a [PATCH] Revise linker plugin API to better preserve link order.
ld/ChangeLog:

2011-03-10  Dave Korn  <dave.korn.cygwin@gmail.com>

	* ldlang.h (lang_input_statement_type): Add new 'claim_archive' flag,
	wrapping both it and 'claim' flag in #ifdef ENABLE_PLUGINS.
	* ldmain.c (add_archive_element): Set it if the member is claimed.
	* ldlang.c (new_afile): Initialise claim_archive and claimed members.
	(find_replacements_insert_point): New helper function.
	(lang_process): After adding and opening replacement files passed
	from plugin, splice them into correct place in statement list and
	file chains to preserve critical link order.
	(lang_list_insert_after): New helper function.
	(lang_list_remove_tail): Likewise.
2011-03-10 10:25:02 +00:00
Dave Korn cf4dc96f0f [PATCH] Do not use dummy bfd suffix for recognition, make it human-readable instead.
ld/ChangeLog:

2011-03-10  Dave Korn  <dave.korn.cygwin@gmail.com>

	* plugin.c (IRONLY_SUFFIX): Revise to nicely human-readable form.
	(IRONLY_SUFFIX_LEN): Delete.
	(plugin_get_ir_dummy_bfd): Don't append IRONLY_SUFFIX.
	(is_ir_dummy_bfd): Don't look for suffix; check claimed flag of
	enclosing lang input statement instead.
2011-03-10 10:22:24 +00:00
Dave Korn 4bf0cafb35 [PATCH] Fix PE-COFF bug in orphan section alignment handling.
ld/ChangeLog:

2011-03-10  Dave Korn  <dave.korn.cygwin@gmail.com>

	* emultempl/pe.em (gld_${EMULATION_NAME}_place_orphan): Preserve
	alignment of input sections when creating orphan output sections
	during relocatable link.
	* emultempl/pep.em (gld_${EMULATION_NAME}_place_orphan): Likewise.
2011-03-10 10:20:26 +00:00
H.J. Lu 1715a13cc2 Report plugin symbols for --verbose=N.
2011-03-04  H.J. Lu  <hongjiu.lu@intel.com>

	* ld.texinfo: Document --verbose[=NUMBER].

	* lexsup.c (ld_options): Update --verbose.
	(parse_args): Set report_plugin_symbols.

	* plugin.c (report_plugin_symbols): New.
	(get_symbols): Report plugin symbols if report_plugin_symbols
	is TRUE.

	* plugin.h (report_plugin_symbols): New.
2011-03-04 23:44:01 +00:00
H.J. Lu 4a4c5f250b Supprt TLS x32 IE->LE transition.
bfd/

2011-03-03  H.J. Lu  <hongjiu.lu@intel.com>

	* elf64-x86-64.c (elf_x86_64_check_tls_transition): Supprt TLS
	x32 IE->LE transition.
	(elf_x86_64_relocate_section): Likewise.

ld/testsuite/

2011-03-03  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-x86-64/tlsie4.dd: New.
	* ld-x86-64/tlsie4.s: Likewise.

	* ld-x86-64/x86-64.exp (x86_64tests): Add tlsie4.
2011-03-03 22:11:33 +00:00
H.J. Lu f4c37f5655 Don't use filename_cmp in plugin test DSO.
2011-03-01  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12529
	* testplug.c: Don't include "filenames.h".
	(onclaim_file): Don't use filename_cmp.
2011-03-01 22:55:35 +00:00
Kai Tietz 426278217b 2011-02-28 Kai Tietz <kai.tietz@onevision.com>
* emultempl/beos.em (sort_by_file_name): Use filename_(n)cmp.
	* emultempl/elf32.em (gld${EMULATION_NAME}_vercheck):
	Likewise.
	(gld${EMULATION_NAME}_stat_needed): Likewise.
	(gld${EMULATION_NAME}_check_needed): Likewise.
	* emultempl/pe.em (gld_${EMULATION_NAME}_after_open): Likewise.
	(gld_${EMULATION_NAME}_unrecognized_file): Likewise.
	* emultempl/pep.em (gld_${EMULATION_NAME}_after_open): Likewise.
	(gld_${EMULATION_NAME}_unrecognized_file): Likewise.
	* ldfile.c (ldfile_open_file): Likewise.
	* ldlang.c (wild_sort): Likewise.
	(lookup_name): Likewise.
	(check_excluded_libs): Likewise.
	* ldmisc.c (vfinfo): Likewise.
	* pe-dll.c (libnamencmp): Likewise.
	(auto_export): Likewise.
	(pe_dll_generate_implib): Likewise.
	* testplug.c (onclaim_file): Likewise.
2011-02-28 18:34:52 +00:00
H.J. Lu 174b85fcf1 Add entry_symbol chain into non_ironly_hash.
2011-02-24  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12507
	* plugin.c (get_symbols): Don't check entry symbol here.
	(init_non_ironly_hash): Add entry_symbol chain into
	non_ironly_hash.
2011-02-26 04:38:34 +00:00
H.J. Lu 6ee6cf6ac1 Add a testcase for PR ld/12516.
2011-02-25  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12516
	* ld-elf/dynamic1.d: New.
	* ld-elf/dynamic1.ld: Likewise.
	* ld-elf/dynamic1.s: Likewise.
2011-02-25 15:53:24 +00:00
Alan Modra e1e9003466 PR gas/12519
* config/obj-elf.c (elf_frob_symbol): Properly handle size expression.
	* ld-mn10300/i135409-3.s: Correct .size label reference.
	* ld-sh/sh64/stolib.s: Likewise.
2011-02-25 13:45:54 +00:00
H.J. Lu 8ff09c128e Don't mark entry symbol IR only.
2011-02-24  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12507
	* plugin.c (get_symbols): Don't mark entry symbol IR only.
2011-02-24 22:58:05 +00:00
H.J. Lu 3b8d4c366a Don't include <exception_defines.h>
2011-02-23  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-elf/new.cc: Don't include <exception_defines.h>.
2011-02-23 22:37:48 +00:00
Dave Anglin ae97b9228d PR ld/12376
emulparams/hppalinux.sh (DATA_ADDR): Define.
	(SHLIB_DATA_ADDR): Likewise.
2011-02-18 18:20:29 +00:00
H.J. Lu 73f2a3d2e9 Change x32 LIBPATH_SUFFIX to x32.
2011-02-16  H.J. Lu  <hongjiu.lu@intel.com>

	* emulparams/elf32_x86_64.sh (LIBPATH_SUFFIX): Changed to
	x32 for x32.
2011-02-16 19:14:41 +00:00
Kai Tietz fd11958c53 2011-02-15 Kai Tietz <kai.tietz@onevision.com>
* pe-dll.c (process_def_file_and_drectve): Don't strip
        leading underscore from symbol by calling bfd_find_version_for_sym.
2011-02-15 16:15:55 +00:00
Mike Frysinger 93252b1cf4 bfd/ld: handle ABI prefixes in version scripts
The default language in version scripts is supposed to be C, but no
symbol demangling is performed on the symbols by default.  This makes
targets with a symbol prefix to fail with most version scripts out
there.  So strip away this prefix by default.

This fixes many tests (real world and ld's testsuite) for Blackfin
targets and doesn't seem to cause regressions for x86_64.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-02-14 17:03:45 +00:00
Alan Modra 498cd2a0fd * ldmain.c (remove_output): Rename to..
(ld_cleanup): ..this. Call bfd_cache_close_all and plugin_call_cleanup.
	(main): Adjust.
	* plugin.c (plugin_call_cleanup): Make global.
	(plugin_load_plugins): Don't register plugin_call_cleanup with xatexit.
	* plugin.h (plugin_call_cleanup): Declare.
2011-02-14 09:53:15 +00:00
Ralf Wildenhues 822ce8ee21 Remove freebsd1 from libtool.m4 macros and config.rpath.
/:
	Import from Libtool and gnulib:

	2011-01-27  Gerald Pfeifer  <gerald@pfeifer.com>

	Prepare for supporting FreeBSD 10.
	* config.rpath: Remove handling of freebsd1* which soon would
	match FreeBSD 10.0.

	2011-01-20  Gerald Pfeifer  <gerald@pfeifer.com>  (tiny change)

	Remove support for FreeBSD 1.x.
	* libtool.m4 (_LT_LINKER_SHLIBS)
	(_LT_SYS_DYNAMIC_LINKER): Remove handling of freebsd1* which
	soon would incorrectly match FreeBSD 10.0.

bfd/:
	* configure: Regenerate.

gas/:
	* configure: Regenerate.

ld/:
	* configure: Regenerate.

opcodes/:
	* configure: Regenerate.

binutils/:
	* configure: Regenerate.

gprof/:
	* configure: Regenerate.
2011-02-13 21:00:14 +00:00
Alan Modra dc56ba2d58 remove accidental SANE_EXPR change 2011-02-10 08:35:26 +00:00
Alan Modra 09b910c68c * scripttempl/armbpabi.sc: Revert 2010-11-02 H.J. Lu.
* scripttempl/avr.sc: Likewise.
	* scripttempl/elf32cr16.sc: Likewise.
	* scripttempl/elf32crx.sc: Likewise.
	* scripttempl/elf32msp430.sc: Likewise.
	* scripttempl/elf32msp430_3.sc: Likewise.
	* scripttempl/elf32sh-symbian.sc: Likewise.
	* scripttempl/elf64hppa.sc: Likewise.
	* scripttempl/elf_chaos.sc: Likewise.
	* scripttempl/elfd10v.sc: Likewise.
	* scripttempl/elfd30v.sc: Likewise.
	* scripttempl/elfi370.sc: Likewise.
	* scripttempl/elfm68hc11.sc: Likewise.
	* scripttempl/elfm68hc12.sc: Likewise.
	* scripttempl/elfxtensa.sc: Likewise.
	* scripttempl/ip2k.sc: Likewise.
	* scripttempl/iq2000.sc: Likewise.
	* scripttempl/mep.sc: Likewise.
	* scripttempl/mmo.sc: Likewise.
	* scripttempl/v850.sc: Likewise.
	* scripttempl/xstormy16.sc: Likewise.
	* scripttempl/elf.sc: Revert 2010-10-29  H.J. Lu.
2011-02-10 08:18:58 +00:00
Alan Modra ea6c5ce90d * ld-scripts/defined.exp: Don't run defined5 for AOUT.
* ld-scripts/defined5.s: Use .text for "defined" section.
	* ld-scripts/defined5.t: Adjust.
2011-02-10 08:04:22 +00:00
Alan Modra 6092a2bf7b * ld-gc/start.d: Exclude frv-*-linux*.
* ld-misc/defsym1.d: Likewise.
2011-02-10 07:24:06 +00:00
Alan Modra 2893311c83 * ld-elfvsb/elfvsb.exp: Don't run any non-PIC tests on powerpc*-linux.
* ld-gc/gc.exp: Ensure powerpc64 test continues to fail.
	* ld-srec/srec.exp: Don't edit toc on powerpc64.
2011-02-09 08:18:54 +00:00
Alan Modra 6a2bb08055 * ld-scripts/sane1.d, * ld-scripts/sane1.t: New test.
* ld-scripts/expr.exp: Run it.
2011-01-23 03:29:30 +00:00
H.J. Lu 3cb622973f Add AC_PROG_CXX.
2011-01-22  H.J. Lu  <hongjiu.lu@intel.com>

	* Makefile.am (CXX): Removed.

	* configure.in: Add AC_PROG_CXX.

	* Makefile.in: Regenerated.
	* configure: Likewise.
2011-01-22 19:25:37 +00:00
Richard Sandiford ed88c97ee7 bfd/
* elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Ignore
	common sections too.

ld/
	* plugin.c (plugin_get_ir_dummy_bfd): Copy across the bfd's
	private data and GP size.
2011-01-22 10:16:29 +00:00
Alan Modra 9bc8bb33fe * ldexp.c (fold_binary): Set result section for arithmetic and
logical operations to NULL when both operands are in same section.
	* ld.texinfo (Expression Section): Describe this.
2011-01-21 13:18:19 +00:00
H.J. Lu 1a0c107f58 Undo Solaris damages in elf64-x86-64.c.
bfd/

2011-01-18  H.J. Lu  <hongjiu.lu@intel.com>

	* elf64-x86-64.c (elf_backend_static_tls_alignment): Undefine
	after Solaris target.
	(elf_backend_want_plt_sym): Redefine to 0 after Solaris target.

ld/testsuite/

2011-01-18  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-x86-64/ilp32-4.d: Updated.
2011-01-18 20:41:09 +00:00
Richard Sandiford da17376b70 bfd/
* elf32-arm.c (elf32_arm_check_relocs): Check needs_plt rather than
	h->needs_plt when deciding whether to record a possible dynamic reloc.

ld/testsuite/
	* ld-arm/arm-rel32.s, ld-arm/arm-rel32.d: New testcase.
	* ld-arm/arm-elf.exp: Run it.
2011-01-17 16:36:43 +00:00
Richard Sandiford 1e81e12b2c bfd/
* elf32-arm.c (elf32_arm_gc_sweep_hook): Remove all registered
	dynamic relocs for the removed section.

ld/testsuite/
	* ld-arm/gc-thumb-lib.s, ld-arm/gc-thumb.s,
	ld-arm/gc-thumb.d: New test.
	* ld-arm/arm-elf.exp: Run it.
2011-01-17 16:36:15 +00:00
H.J. Lu 9d53781512 Replace n32 with x32. 2011-01-15 00:38:35 +00:00
H.J. Lu 570561f71a Rename --n32 to --x32.
gas/

2011-01-14  H.J. Lu  <hongjiu.lu@intel.com>

	* config/tc-i386.c (OPTION_N32): Renamed to ...
	(OPTION_X32): This.
	(md_longopts): Replace n32 with x32.
	(md_parse_option): Updated.
	(md_show_usage): Likewise.

	* doc/c-i386.texi: Replace n32 with x32.

gas/testsuite/

2011-01-14  H.J. Lu  <hongjiu.lu@intel.com>

	* gas/i386/ilp32/cfi/ilp32.exp: Replace --n32 with --x32.
	* gas/i386/ilp32/elf/ilp32.exp: Likewise.
	* gas/i386/ilp32/ilp32.exp: Likewise.
	* gas/i386/ilp32/lns/ilp32.exp: Likewise.

ld/testsuite/

2011-01-14  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-x86-64/ilp32-1.d: Replace --n32 with --x32.
	* ld-x86-64/ilp32-2.d: Likewise.
	* ld-x86-64/ilp32-3.d: Likewise.
	* ld-x86-64/ilp32-4.d: Likewise.
	* ld-x86-64/ilp32-5.d: Likewise.
	* ld-x86-64/x86-64.exp: Likewise.
2011-01-14 23:07:11 +00:00
H.J. Lu 248775ba37 Handle R_X86_64_32 like R_X86_64_64 for ILP32.
bfd/

2011-01-14  H.J. Lu  <hongjiu.lu@intel.com>

	* elf64-x86-64.c (elf_x86_64_link_hash_table): Add pointer_r_type.
	(elf_x86_64_link_hash_table_create): Set pointer_r_type.
	(elf_x86_64_check_relocs): Handle R_X86_64_32 like R_X86_64_64
	for ILP32.  Remove ABI_64_P PIC check for R_X86_64_8,
	R_X86_64_16, R_X86_64_32 and R_X86_64_32S.
	(elf_x86_64_relocate_section):  Handle R_X86_64_32 like R_X86_64_64
	for ILP32.

ld/testsuite/

2011-01-14  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-x86-64/ilp32-5.d: New.
	* ld-x86-64/ilp32-5.s: Likewise.

	* ld-x86-64/x86-64.exp: Run ilp32-5.
2011-01-14 22:48:12 +00:00
Alan Modra e922bcabdf * ldmain.c (main): Flush stdout before and stderr after printing
message.
	* ldmisc.c (einfo): Similarly.
	* plugin.c (message): Likewise.
	* emultempl/ppc64elf.em: Likewise.
	* emultempl/xtensaelf.em: Likewise.
	* emulparams/elf32mcore.sh: Use einfo rather than printf.
	* emultempl/beos.em: Likewise.
	* emultempl/pe.em: Likewise.
	* emultempl/pep.em: Likewise.
2011-01-14 12:37:17 +00:00
H.J. Lu 82e96e07e5 Fix x86-64 ILP32 shared library.
bfd/

2011-01-13  H.J. Lu  <hongjiu.lu@intel.com>

	* elf64-x86-64.c (elf_x86_64_link_hash_table): Remove
	swap_reloca_out.
	(elf_x86_64_link_hash_table_create): Don't set swap_reloca_out.
	(elf_x86_64_check_relocs): Align relocation section to 4 byte
	for 32bit.
	(elf_x86_64_gc_sweep_hook): Replace ELF64_ST_TYPE with
	ELF_ST_TYPE.
	(elf_x86_64_finish_dynamic_symbol): Updated.
	(elf_x86_64_finish_dynamic_sections): Don't use
	Elf64_External_Dyn, bfd_elf64_swap_dyn_in, nor
	bfd_elf64_swap_dyn_out.

ld/testsuite/

2011-01-13  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-x86-64/ilp32-4.d: New.

	* ld-x86-64/x86-64.exp: Run ilp32-4.
2011-01-14 04:24:00 +00:00
Alan Modra 175b7cd42c * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Don't
attempt to put non-alloc orphans before debug sections, just place
	them after .comment.
2011-01-14 02:27:41 +00:00
Alan Modra a05e447ffb PR ld/12339
* ldlang.c (sort_def_symbol): Handle bfd_link_hash_warning symbols.
2011-01-14 02:18:22 +00:00
Alan Modra 3ed41d5946 * Makefile.am: Sort emulation rules.
(eelf32am33lin.c): Delete.
	(ALL_EMULATION_SOURCES): Sort, add missing entries.
	(ALL_64_EMULATION_SOURCES): Likewise.
	* Makefile.in: Regenerate.
2011-01-14 02:03:42 +00:00
H.J. Lu 75e68ef97a Add a testcase for PR ld/12356.
2011-01-13  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12356
	* ld-scripts/defined.exp: Run defined5.

	* ld-scripts/defined5.d: New.
	* ld-scripts/defined5.s: Likewise.
	* ld-scripts/defined5.t: Likewise.
2011-01-13 17:07:52 +00:00
H.J. Lu e235872c41 Add xfail and notarget.
2011-01-13  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-scripts/defined4.d: Xfail rs6000-*-aix*.  Skip mips*-*-*
	and mmix-*-*.

	* ld-scripts/expr2.d: Xfail rs6000-*-aix* and arm-*-*aout.
2011-01-13 15:23:59 +00:00
Alan Modra 729c05fc7c Update copyright dates. 2011-01-13 13:34:54 +00:00
Alan Modra 01554a74b5 PR ld/12356
* ld.texinfo (Miscellaneous Commands): Describe LD_FEATURE.
	(Expression Section): Update.
	* ld.h (ld_config_type): Add sane_expr.
	* ldgram.y (ifile_p1): Add LD_FEATURE.
	* ldlex.l (LD_FEATYRE): New.
	* ldemul.c (after_parse_default): Delete code handling ld_compatibility.
	* ldexp.h (struct ldexp_control): Delete uses_defined.
	* ldexp.c: Remove all uses of uses_defined.
	(fold_name): Test config.sane_expr rather than ld_compatibility.
	(exp_fold_tree_1): Likewise.  Adjust handling of assignments
	during first phase.
	* ldlang.h (ld_compatibility): Delete.
	(lang_ld_feature): Declare.
	* ldlang.c (ld_compatibility): Delete.
	(open_input_bfds): Only handle assignments for --defsym.
	(lang_ld_feature): New function.
2011-01-13 13:29:55 +00:00
Alan Modra 2e57b2afce PR ld/12356
* ldexp.h (exp_assop): Delete.
	(exp_assign, exp_defsym): Declare.
	* ldexp.c (exp_assop): Make static, handle all assignment variations.
	(exp_assign, exp_defsym): New functions.
	(exp_provide): Use exp_assop.
	* ldgram.y (defsym_expr): Use exp_defsym.
	* ldctor.c, * ldgram.y, * ldlang.c, * mri.c, * emultempl/beos.em,
	* emultempl/pe.em, * emultempl/pep.em, * emultempl/spuelf.em,
	* emultempl/xtensaelf.em: Update exp_assop -> exp_assign.
2011-01-13 13:06:22 +00:00
Alan Modra ea7c2e6c9b PR ld/12380
* ldexp.h (enum phase_enum): Comment.  Add exp_dataseg_done.
	* ldexp.c (fold_unary <DATA_SEGMENT_END>): Rearrange code.  Test
	for exp_dataseg_done rather than expld.phase == lang_final_phase_enum
	to detect when we've finished sizing sections.
	(fold_binary <DATA_SEGMENT_ALIGN>): Likewise.
	(fold_binary <DATA_SEGMENT_RELRO_END>): Likewise.  Also test
	that we are not inside an output section statement.
	* ldlang.c (lang_size_sections): Set exp_dataseg_done on exit if
	not exp_dataseg_relro_adjust or exp_dataseg_adjust.  Don't set
	lang_final_phase_enum here.
	(lang_process): Set lang_final_phase_enum here.
2011-01-12 12:07:19 +00:00
H.J. Lu 9d573aae1f Remove the extra `.'. 2011-01-10 15:03:15 +00:00
H.J. Lu eda17dc18d Add a test for linker ASSERT.
2011-01-10  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-scripts/assert.exp: Run assert2.

	* ld-scripts/assert2.d: New.
	* ld-scripts/assert2.t: Likewise.
2011-01-10 14:37:40 +00:00
Nick Clifton f74656046a * po/da.po: Updated Danish translation. 2011-01-10 13:51:10 +00:00
H.J. Lu 1e91580429 Remove startup_file from ldlang.c.
2011-01-10  H.J. Lu  <hongjiu.lu@intel.com>

	* ldlang.c (startup_file): Removed.
	(lang_startup): Updated.
2011-01-10 13:13:32 +00:00
Nathan Sidwell 0855e32bf5 bfd/
* reloc.c (BFD_RELOC_ARM_TLS_GOTDESC, BFD_RELOC_ARM_TLS_CALL,
	BFD_RELOC_ARM_THM_TLS_CALL, BFD_RELOC_ARM_TLS_DESCSEQ,
	BFD_RELOC_ARM_THM_TLS_DESCSEQ, BFD_RELOC_ARM_TLS_DESC): New
	relocations.
	* libbfd.h: Rebuilt.
	* bfd-in2.h: Rebuilt.
	* elf32-arm.c (elf32_arm_howto_table_1): Add new relocations.
	(elf32_arm_reloc_map): Likewise.
	(tls_trampoline, dl_tlsdesc_lazy_trampoline): New PLT templates.
	(elf32_arm_stub_long_branch_any_tls_pic,
	elf32_arm_stub_long_branch_v4t_thumb_tls_pic): New stub templates.
	(DEF_STUBS): Add new stubs.
	(struct_elf_arm_obj_data): Add local_tlsdesc_gotent field.
	(elf32_arm_local_tlsdesc_gotent): New.
	(GOT_TLS_GDESC): New mask.
	(GOT_TLS_GD_ANY): Define.
	(struct elf32_arm_link_hash_entry): Add tlsdesc_got field.
	(elf32_arm_compute_jump_table_size): New.
	(struct elf32_arm_link_hash_table): Add next_tls_desc_index,
	num_tls_desc, dt_tlsdesc_plt, dt_tlsdesc_got, tls_trampoline,
	sgotplt_jump_table_size fields.
	(elf32_arm_link_hash_newfunc): Initialize tlsdesc_got field.
	(elf32_arm_link_hash_table_create): Initialize new fields.
	(arm_type_of_stub): Check TLS desc relocs too.
	(elf32_arm_stub_name): TLS desc relocs can be shared.
	(elf32_arm_tls_transition): Determine relaxation.
	(arm_stub_required_alignment): Add tls stubs.
	(elf32_arm_size_stubs): Likewise.
	(elf32_arm_tls_relax): Perform TLS relaxing.
	(elf32_arm_final_link_relocate): Process TLS DESC relocations.
	(IS_ARM_TLS_GNU_RELOC): New.
	(IS_ARM_TLS_RELOC): Use it.
	(elf32_arm_relocate_section): Perform TLS relaxing.
	(elf32_arm_check_relocs): Anticipate TLS relaxing, process tls
	desc relocations.
	(allocate_dynrelocs): Allocate tls desc relcoations.
	(elf32_arm_output_arch_local_syms): Emit tls trampoline mapping
	symbols.
	(elf32_arm_size_dynamic_sections): Allocate tls trampolines and
	got slots.
	(elf32_arm_always_size_sections): New. Create _TLS_MODULE_BASE
	symbol.
	(elf32_arm_finish_dynamic_symbol): Adjust.
	(arm_put_trampoline): New.
	(elf32_arm_finish_dynamic_sections): Emit new dynamic tags and tls
	trampolines.
	(elf_backend_always_size_sections): Define.

	include/elf/
	* arm.h (R_ARM_TLS_DESC, R_ARM_TLS_GOTDESC, R_ARM_TLS_CALL,
	R_ARM_TLS_DESCSEQ, T_ARM_THM_TLS_CALL, R_ARM_THM_TLS_DESCSEQ): New
	relocations.

	gas/
	* doc/c-arm.texi: Document TLSDESC and TLSCALL relocations, and
	.tlsdescseq directive.
	* config/tc-arm.c (arm_typed_reg_parse): Check for potential reloc
	following a symbol.
	(s_arm_tls_descseq): New directive.
	(md_pseudo_table): Add it.
	(encode_branch): Allow TLS_CALL relocs too.
	(do_t_blx, do_t_branch23): Use encode_branch.
	(reloc_names): Add tlsdesc and tlscall.
	(md_apply_fix): Process tls desc relocations.
	(tc_gen_reloc): Likewise.
	(arm_fix_adjustable): Likewise.

	gas/testsuite/
	* gas/arm/tls.s: Add tlsdesc tests.
	* gas/arm/tls.d: Adjust.

	ld/testsuite/
	* ld-arm/arm-elf.exp: Added tests for new TLS handling
	relocations.
	* ld-arm/tls-descrelax-be32.d: New.
	* ld-arm/tls-descrelax-be32.s: New.
	* ld-arm/tls-descrelax-be8.d: New.
	* ld-arm/tls-descrelax-be8.s: New.
	* ld-arm/tls-descrelax-v7.d: New.
	* ld-arm/tls-descrelax-v7.s: New.
	* ld-arm/tls-descrelax.d: New.
	* ld-arm/tls-descrelax.s: New.
	* ld-arm/tls-descseq.d: New.
	* ld-arm/tls-descseq.r: New.
	* ld-arm/tls-descseq.s: New.
	* ld-arm/tls-gdesc-got.d: New.
	* ld-arm/tls-gdesc-got.s: New.
	* ld-arm/tls-gdesc-nlazy.g: New.
	* ld-arm/tls-gdesc-nlazy.s: New.
	* ld-arm/tls-gdesc.d: New.
	* ld-arm/tls-gdesc.r: New.
	* ld-arm/tls-gdesc.s: New.
	* ld-arm/tls-gdierelax.d: New.
	* ld-arm/tls-gdierelax.s: New.
	* ld-arm/tls-gdierelax2.d: New.
	* ld-arm/tls-gdierelax2.s: New.
	* ld-arm/tls-gdlerelax.d: New.
	* ld-arm/tls-gdlerelax.s: New.
	* ld-arm/tls-lib-loc.d: New.
	* ld-arm/tls-lib-loc.r: New.
	* ld-arm/tls-lib-loc.s: New.
	* ld-arm/tls-longplt-lib.d: New.
	* ld-arm/tls-longplt-lib.s: New.
	* ld-arm/tls-longplt.d: New.
	* ld-arm/tls-longplt.s: New.
	* ld-arm/tls-mixed.r: New.
	* ld-arm/tls-mixed.s: New.
	* ld-arm/tls-thumb1.d: New.
	* ld-arm/tls-thumb1.s: New.
	* ld-arm/arm-elf.exp: New.
2011-01-10 08:40:19 +00:00
Nick Clifton bd53e8b7ee * ld-misc/defsym1.d: Add a -e linker command line option.
* ld-misc/dummy.s: Remove text.
2011-01-08 09:52:57 +00:00