Commit Graph

1900 Commits

Author SHA1 Message Date
Cary Coutant 4d625b70fc Refactor gold to enable support for MIPS-64 relocation format.
For MIPS-64, the r_info field in the relocation format is
replaced by several individual fields, including r_sym and
r_type. To enable support for this format, I've refactored
target-independent code to remove almost all uses of the r_info
field. (I've left alone a couple of routines used only for
incremental linking, which I can update if/when the MIPS target
adds support for incremental linking.)

For routines that are already templated on a Classify_reloc class
(namely, gc_process_relocs, relocate_section, and
relocate_relocs), I've extended the Classify_reloc interface to
include sh_type (which no longer needs to be a separate template
parameter) as well as get_r_sym() and get_r_type() methods for
extracting the r_sym and r_type fields. For
scan_relocatable_relocs, I've extended the
Default_scan_relocatable_relocs class by converting it to a class
template with Classify_reloc as a template parameter. For the
remaining routines that need to access r_sym, I've added a
virtual Target::get_r_sym() method with an override for the MIPS
target.

In elfcpp, I've added Mips64_rel, etc., accessor classes and
corresponding internal data structures. The MIPS target uses
these new classes within its own Mips_classify_reloc class.
The Mips64_ accessor classes also expose the r_ssym, r_type2,
and r_type3 fields from the relocation.

These changes should be functionally the same for all but the
MIPS target.

elfcpp/
	* elfcpp.h (Mips64_rel, Mips64_rel_write): New classes.
	(Mips64_rela, Mips64_rela_write): New classes.
	* elfcpp_internal.h (Mips64_rel_data, Mips64_rela_data): New structs.

gold/
	* gc.h (get_embedded_addend_size): Remove sh_type parameter.
	(gc_process_relocs): Remove sh_type template parameter.
	Use Classify_reloc to access r_sym, r_type, and r_addend fields.
	* object.h (Sized_relobj_file::split_stack_adjust): Add target
	parameter.
	(Sized_relobj_file::split_stack_adjust_reltype): Likewise.
	* reloc-types.h (Reloc_types::copy_reloc_addend): (SHT_REL and SHT_RELA
	specializations) Remove.
	* reloc.cc (Emit_relocs_strategy): Rename and move to target-reloc.h.
	(Sized_relobj_file::emit_relocs_scan): Call Target::emit_relocs_scan().
	(Sized_relobj_file::emit_relocs_scan_reltype): Remove.
	(Sized_relobj_file::split_stack_adjust): Add target parameter.
	Adjust all callers.
	(Sized_relobj_file::split_stack_adjust_reltype): Likewise. Call
	Target::get_r_sym() to get r_sym field from relocations.
	(Track_relocs::next_symndx): Call Target::get_r_sym().
	* target-reloc.h (scan_relocs): Remove sh_type template parameter;
	add Classify_reloc template parameter.  Use for accessing r_sym and
	r_type.
	(relocate_section): Likewise.
	(Default_classify_reloc): New class (renamed and moved from reloc.cc).
	(Default_scan_relocatable_relocs): Remove sh_type template parameter.
	(Default_scan_relocatable_relocs::Reltype): New typedef.
	(Default_scan_relocatable_relocs::reloc_size): New const.
	(Default_scan_relocatable_relocs::sh_type): New const.
	(Default_scan_relocatable_relocs::get_r_sym): New method.
	(Default_scan_relocatable_relocs::get_r_type): New method.
	(Default_emit_relocs_strategy): New class.
	(scan_relocatable_relocs): Replace sh_type template parameter with
	Scan_relocatable_relocs class.  Use it to access r_sym and r_type
	fields.
	(relocate_relocs): Replace sh_type template parameter with
	Classify_reloc class.  Use it to access r_sym and r_type fields.
	* target.h (Target::is_call_to_non_split): Replace r_type parameter
	with pointer to relocation. Adjust all callers.
	(Target::do_is_call_to_non_split): Likewise.
	(Target::emit_relocs_scan): New virtual method.
	(Sized_target::get_r_sym): New virtual method.
	* target.cc (Target::do_is_call_to_non_split): Replace r_type parameter
	with pointer to relocation.

	* aarch64.cc (Target_aarch64::emit_relocs_scan): New method.
	(Target_aarch64::Relocatable_size_for_reloc): Remove.
	(Target_aarch64::gc_process_relocs): Use Default_classify_reloc.
	(Target_aarch64::scan_relocs): Likewise.
	(Target_aarch64::relocate_section): Likewise.
	(Target_aarch64::Relocatable_size_for_reloc::get_size_for_reloc):
	Remove.
	(Target_aarch64::scan_relocatable_relocs): Use Default_classify_reloc.
	(Target_aarch64::relocate_relocs): Use Default_classify_reloc.
	* arm.cc (Target_arm::Arm_scan_relocatable_relocs): Remove sh_type
	template parameter.
	(Target_arm::emit_relocs_scan): New method.
	(Target_arm::Relocatable_size_for_reloc): Replace with...
	(Target_arm::Classify_reloc): ...this.
	(Target_arm::gc_process_relocs): Use Classify_reloc.
	(Target_arm::scan_relocs): Likewise.
	(Target_arm::relocate_section): Likewise.
	(Target_arm::scan_relocatable_relocs): Likewise.
	(Target_arm::relocate_relocs): Likewise.
	* i386.cc (Target_i386::emit_relocs_scan): New method.
	(Target_i386::Relocatable_size_for_reloc): Replace with...
	(Target_i386::Classify_reloc): ...this.
	(Target_i386::gc_process_relocs): Use Classify_reloc.
	(Target_i386::scan_relocs): Likewise.
	(Target_i386::relocate_section): Likewise.
	(Target_i386::scan_relocatable_relocs): Likewise.
	(Target_i386::relocate_relocs): Likewise.
	* mips.cc (Mips_scan_relocatable_relocs): Remove sh_type template
	parameter.
	(Mips_reloc_types): New class template.
	(Mips_classify_reloc): New class template.
	(Target_mips::Reltype): New typedef.
	(Target_mips::Relatype): New typedef.
	(Target_mips::emit_relocs_scan): New method.
	(Target_mips::get_r_sym): New method.
	(Target_mips::Relocatable_size_for_reloc): Replace with
	Mips_classify_reloc.
	(Target_mips::copy_reloc): Use Mips_classify_reloc.
	(Target_mips::gc_process_relocs): Likewise.
	(Target_mips::scan_relocs): Likewise.
	(Target_mips::relocate_section): Likewise.
	(Target_mips::scan_relocatable_relocs): Likewise.
	(Target_mips::relocate_relocs): Likewise.
	(mips_get_size_for_reloc): New function, factored out from
	Relocatable_size_for_reloc::get_size_for_reloc.
	(Target_mips::Scan::local): Use Mips_classify_reloc.
	(Target_mips::Scan::global): Likewise.
	(Target_mips::Relocate::relocate): Likewise.
	* powerpc.cc (Target_powerpc::emit_relocs_scan): New method.
	(Target_powerpc::Relocatable_size_for_reloc): Remove.
	(Target_powerpc::gc_process_relocs): Use Default_classify_reloc.
	(Target_powerpc::scan_relocs): Likewise.
	(Target_powerpc::relocate_section): Likewise.
	(Powerpc_scan_relocatable_reloc): Convert to class template.
	(Powerpc_scan_relocatable_reloc::Reltype): New typedef.
	(Powerpc_scan_relocatable_reloc::reloc_size): New const.
	(Powerpc_scan_relocatable_reloc::sh_type): New const.
	(Powerpc_scan_relocatable_reloc::get_r_sym): New method.
	(Powerpc_scan_relocatable_reloc::get_r_type): New method.
	(Target_powerpc::scan_relocatable_relocs): Use
	Powerpc_scan_relocatable_reloc.
	(Target_powerpc::relocate_relocs): Use Default_classify_reloc.
	* s390.cc (Target_s390::emit_relocs_scan): New method.
	(Target_s390::Relocatable_size_for_reloc): Remove.
	(Target_s390::gc_process_relocs): Use Default_classify_reloc.
	(Target_s390::scan_relocs): Likewise.
	(Target_s390::relocate_section): Likewise.
	(Target_s390::Relocatable_size_for_reloc::get_size_for_reloc):
	Remove.
	(Target_s390::scan_relocatable_relocs): Use Default_classify_reloc.
	(Target_s390::relocate_relocs): Use Default_classify_reloc.
	* sparc.cc (Target_sparc::emit_relocs_scan): New method.
	(Target_sparc::Relocatable_size_for_reloc): Remove.
	(Target_sparc::gc_process_relocs): Use Default_classify_reloc.
	(Target_sparc::scan_relocs): Likewise.
	(Target_sparc::relocate_section): Likewise.
	(Target_sparc::Relocatable_size_for_reloc::get_size_for_reloc):
	Remove.
	(Target_sparc::scan_relocatable_relocs): Use Default_classify_reloc.
	(Target_sparc::relocate_relocs): Use Default_classify_reloc.
	* tilegx.cc (Target_tilegx::emit_relocs_scan): New method.
	(Target_tilegx::Relocatable_size_for_reloc): Remove.
	(Target_tilegx::gc_process_relocs): Use Default_classify_reloc.
	(Target_tilegx::scan_relocs): Likewise.
	(Target_tilegx::relocate_section): Likewise.
	(Target_tilegx::Relocatable_size_for_reloc::get_size_for_reloc):
	Remove.
	(Target_tilegx::scan_relocatable_relocs): Use Default_classify_reloc.
	(Target_tilegx::relocate_relocs): Use Default_classify_reloc.
	* x86_64.cc (Target_x86_64::emit_relocs_scan): New method.
	(Target_x86_64::Relocatable_size_for_reloc): Remove.
	(Target_x86_64::gc_process_relocs): Use Default_classify_reloc.
	(Target_x86_64::scan_relocs): Likewise.
	(Target_x86_64::relocate_section): Likewise.
	(Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
	Remove.
	(Target_x86_64::scan_relocatable_relocs): Use Default_classify_reloc.
	(Target_x86_64::relocate_relocs): Use Default_classify_reloc.

	* testsuite/testfile.cc (Target_test::emit_relocs_scan): New method.
2016-01-11 18:51:18 -08:00
Alan Modra 6f2750feaf Copyright update for binutils 2016-01-01 23:00:01 +10:30
Alan Modra 3499769a6a New 2016 binutils ChangeLog files
Note that this does not create bfd/doc/ChangeLog, */testsuite/ChangeLog
and include/*/ChangeLog files.
2016-01-01 22:59:42 +10:30
Alan Modra 4120fa118f binutils ChangeLog rotation 2016-01-01 22:59:17 +10:30
Alan Modra 331e61312e Fix assorted ChangeLog errors 2015-12-30 11:44:35 +10:30
Peter Collingbourne ce3e49806d Implement --long-plt flag (ARM only).
gold/
    PR gold/18780
    * arm.cc (Target_arm::do_make_data_plt): Choose PLT generator based
    on value of --long-plt flag.
    (Output_data_plt_arm_standard::do_get_plt_entry_size): Moved to
    Output_data_plt_arm_short.
    (Output_data_plt_arm_standard::do_fill_plt_entry): Likewise.
    (Output_data_plt_arm_standard::plt_entry): Likewise.
    (Output_data_plt_arm_standard::do_fill_first_plt_entry): Fix
    variable reference.
    (Output_data_plt_arm_short): New class.
    (Output_data_plt_arm_short::do_fill_plt_entry): Error out on too large
    PLT offsets instead of asserting.
    (Output_data_plt_arm_long): New class.
    * options.h (General_options): Define --long-plt flag.
2015-12-17 16:52:12 -08:00
Roland McGrath 95c29a83eb PR gold/17473: Fix gold build with system C++ headers that use <ctype.h>.
gold/
	PR gold/17473
	* binary.cc: Move #include "safe-ctype.h" to be last #include.
2015-12-16 16:35:27 -08:00
Cary Coutant 39040bb911 Remove const from return type of get_output_view.
gold/
	* object.h (Object::get_output_view): remove const from return type.
	(Object::do_get_output_view): Likewise.
	(Sized_relobj_file::do_get_output_view): Likewise.
	* reloc.cc (Sized_relobj_file::do_get_output_view): Likewise.
2015-12-13 14:04:24 -08:00
Cary Coutant 6e0813d359 Pass relocations to Target::do_calls_non_split.
gold/
	* target.h (Target::calls_non_split): Add prelocs, reloc_count
	parameters.
	(Target::do_calls_non_split): Likewise.
	* target.cc (Target::do_calls_non_split): Likewise.
	* reloc.cc (Sized_relobj_file::split_stack_adjust_reltype): Adjust
	call to Target::calls_non_split.

	* i386.cc (Target_i386::do_calls_non_split): Add prelocs, reloc_count
	parameters.
	* powerpc.cc (Target_powerpc::do_calls_non_split): Likewise.
	* x86_64.cc (Target_x86_64::do_calls_non_split): Likewise.
2015-12-11 14:23:59 -08:00
Cary Coutant 6b2353a53a Make output views accessible to Target during do_relocate().
gold/
	* object.cc (Sized_relobj_file::Sized_relobj_file): Initialize
	output_views_.
	* object.h (Object::get_output_view): New function.
	(Object::do_get_output_view): New function.
	(Sized_relobj_file::do_get_output_view): New function.
	(Sized_relobj_file::output_views_): New data member.
	* reloc.cc: (Sized_relobj_file::do_relocate): Store pointer to
	output views in class object.
	(Sized_relobj_file::do_get_output_view): New function.
2015-12-11 14:23:58 -08:00
H.J. Lu bebf4942b0 ld -r doesn't need plugin for slim lto object
Plugin isn't required on slim lto object for relocatable link.

	PR ld/19317
	* symtab.cc (Symbol_table::add_from_relobj): Don't complain
	plugin needed to handle slim lto object for relocatable link.
2015-12-10 11:29:03 -08:00
Alan Modra dcfc7dd477 [GOLD] PowerPC style fix
* powerpc.cc (Target_powerpc::Relocate::relocate): New constant
	d_offset.  Use throughout.
	(Target_powerpc::relocate_relocs): Likewise.
2015-12-09 10:36:44 +10:30
Alan Modra e3a7574e2e [GOLD] Edit PowerPC64 ELFv2 function entry code
In an fixed position executable, the entry code does not need to be
PIC and can thus lose a dependency on r12.

	* powerpc.cc (Target_powerpc::Relocate::relocate): Edit ELFv2
	entry code.
	(Target_powerpc::relocate_relocs): Edit relocs to suit.
2015-12-09 10:36:43 +10:30
Alan Modra 91a65d2fe8 [GOLD] Relocate::relocate() params
Some linker code editing needs to change multiple insns.  In some
cases multiple relocations are involved and it is not sufficient to
make the changes independently as relocations are processed, because
doing so might lead to a partial edit.  So in order to safely edit we
need all the relocations available in relocate().  Also, to emit
edited relocs corresponding to the edited code sequence we need some
way to pass information from relocate() to relocate_relocs(),
particularly if the edit depends on insns.  We can't modify input
relocs in relocate() as they are mmapped PROT_READ, nor it is
particularly clean to write relocs to the output at that stage.  So
add a Relocatable_relocs* field to relinfo to mark edited relocs.

Given that relocate is passed the raw reloc pointer, it makes sense to
remove the rel/rela parameter and r_type too.  However, that means the
mips relocate() needs to know whether SHT_REL or SHT_RELA relocs are
being processed.  So add a rel_type for mips, which also has the
benefit of removing relocate() overloading there.

This patch adds the infrastructure without making use of it.

Note that relinfo->rr will be NULL if not outputting relocations.

	* object.h (struct Relocate_info): Add "rr".
	* reloc.h (Relocatable_relocs::set_strategy): New accessor.
	* reloc.cc (Sized_relobj_file::do_relocate_sections): Init
	relinfo.rr for relocate_section and relocate_relocs.
	* powerpc.cc (relocate): Add rel_type and preloc parameters.
	Delete rela and r_type params, instead recalculate these from
	preloc.
	(relocate_relocs): Delete Relocatable_relocs* param, instead
	use relinfo->rr.
	* aarch64.cc: Likewise.
	* arm.cc: Likewise.
	* i386.cc: Likewise.
	* mips.cc: Likewise.
	* s390.cc: Likewise.
	* sparc.cc: Likewise.
	* target.h: Likewise.
	* tilegx.cc: Likewise.
	* x86_64.cc: Likewise.
	* testsuite/testfile.cc: Likewise.
	* target-reloc.h (relocate_section): Adjust to suit.
	(apply_relocation, relocate_relocs): Likewise.
2015-12-09 10:36:43 +10:30
Alan Modra 549dba7104 [GOLD] R_PPC64_ENTRY support
elfcpp/
	* powerpc.h (R_PPC64_ENTRY): Define.
gold/
	* powerpc.cc (add_2_2_12, ld_2_12, lis_2): Define.
	(Target_powerpc::Scan::local, global): Handle R_PPC64_ENTRY.
	(Target_powerpc::Relocate::relocate): Edit code at R_PPC64_ENTRY.
2015-12-07 13:17:00 +10:30
Vladimir Radosavljevic 7ef8ae7c5f Take addend into account when making GOT entries for local symbols.
gold/
	* object.cc (Sized_relobj::do_for_all_local_got_entries): Use
	Local_got_entry_key for searching in local_got_offsets_.
	* object.h (class Local_got_entry_key): New class.
	(Relobj::local_has_got_offset): New overloaded method.
	(Relobj::local_got_offset): Likewise.
	(Relobj::set_local_got_offset): Likewise.
	(Relobj::do_local_has_got_offset): Add addend argument.
	(Relobj::do_local_got_offset): Likewise.
	(Relobj::do_set_local_got_offset): Likewise.
	(Sized_relobj::do_local_has_got_offset): Add addend argument, and use
	Local_got_entry_key for searching through local_got_offsets_.
	(Sized_relobj::do_local_got_offset): Likewise.
	(Sized_relobj::do_set_local_got_offset): Likewise.
	(Sized_relobj::Local_got_offsets): Change type of the key from
	unsigned int to Local_got_entry_key, and add hash and equal_to.
	* output.cc (Got_entry::write): Take addend into account for
	calculating value of the local symbol for GOT.
	(Output_data_got::add_local): New definition of overloaded method.
	(Output_data_got::add_local_with_rel): Likewise.
	(Output_data_got::add_local_pair_with_rel): Likewise.
	* output.h (Output_data_got::add_local): New declaration of overloaded
	method.
2015-12-03 15:29:17 -08:00
Cary Coutant 74b03b9133 Adjust local symbol value in relocatable link to be relative to section.
gold/
	PR gold/19291
	* object.cc (Sized_relobj_file::write_local_symbols): If relocatable,
	subtract section address from symbol value.
2015-11-25 08:50:41 -08:00
Alan Modra 751e4d66b4 [GOLD] Align PowerPC64 GOT
As done in a27e685f for bfd ld.

	* powerpc.cc (Output_data_got_powerpc::Output_data_got_powerpc): Align
	to 256 byte boundary.
2015-11-25 15:06:12 +10:30
Alan Modra 32d849b35d [GOLD] PowerPC TOC16 and GOT16 relocs are relative
* powerpc.cc (Target_powerpc::Scan::get_reference_flags): Correct
	GOT16 and TOC16 relocs to RELATIVE_REF.
2015-11-19 17:01:04 +10:30
Cary Coutant db1ff0288b Fix problem where bss symbols for copy relocations are marked local.
gold/
	PR gold/19244
	PR gold/18548
	* symtab.cc (Symbol_table::do_define_in_output_data): Check for forced
	local symbols only for predefined symbols.
2015-11-14 11:04:01 -08:00
Peter Bergner a680de9a98 Add assembler, disassembler and linker support for power9.
include/opcode/
	* ppc.h (PPC_OPCODE_POWER9): New define.
	(PPC_OPCODE_VSX3): Likewise.

opcodes/
	* ppc-dis.c (ppc_opts): Add "power9" and "pwr9" entries.
	Add PPC_OPCODE_VSX3 to the vsx entry.
	(powerpc_init_dialect): Set default dialect to power9.
        * ppc-opc.c (insert_dcmxs, extract_dcmxs, insert_dxd, extract_dxd,
        insert_dxdn, extract_dxdn, insert_l0, extract_l0, insert_l1,
        extract_l1 insert_xtq6, extract_xtq6): New static functions.
        (insert_esync): Test for illegal L operand value.
	(DCMX, DCMXS, DXD, NDXD, L0, L1, RC, FC, UIM6, X_R, RIC, PRS, XSQ6,
	XTQ6, LRAND, IMM8, DQX, DQX_MASK, DX, DX_MASK, VXVAPS_MASK, VXVA,XVA,
	XX2VA, XVARC, XBF_MASK, XX2UIM4_MASK, XX2BFD_MASK, XX2DCMXS_MASK,
	XVA_MASK, XRLA_MASK, XBFRARB_MASK, XLRAND_MASK, POWER9, PPCVEC3,
	PPCVSX3): New defines.
	(powerpc_opcodes) <ps_cmpu0, ps_cmpo0, ps_cmpu1, ps_cmpo1, fcmpu,
	fcmpo, ftdiv, ftsqrt>: Use XBF_MASK.
	<mcrxr>: Use XBFRARB_MASK.
	<addpcis, bcdcfn., bcdcfsq., bcdcfz., bcdcpsgn., bcdctn., bcdctsq.,
	bcdctz., bcds., bcdsetsgn., bcdsr., bcdtrunc., bcdus., bcdutrunc.,
	cmpeqb, cmprb, cnttzd, cnttzd., cnttzw, cnttzw., copy, copy_first,
	cp_abort, darn, dtstsfi, dtstsfiq, extswsli, extswsli., ldat, ldmx,
	lwat, lxsd, lxsibzx, lxsihzx, lxssp, lxv, lxvb16x, lxvh8x, lxvl, lxvll,
	lxvwsx, lxvx, maddhd, maddhdu, maddld, mcrxrx, mfvsrld, modsd, modsw,
	modud, moduw, msgsync, mtvsrdd, mtvsrws, paste, paste., paste_last,
	rmieg, setb, slbieg, slbsync, stdat, stop, stwat, stxsd, stxsibx,
	stxsihx, stxssp, stxv, stxvb16x, stxvh8x, stxvl, stxvll, stxvx,
	subpcis, urfid, vbpermd, vclzlsbb, vcmpneb, vcmpneb., vcmpneh,
	vcmpneh., vcmpnew, vcmpnew., vcmpnezb, vcmpnezb., vcmpnezh, vcmpnezh.,
	vcmpnezw, vcmpnezw., vctzb, vctzd, vctzh, vctzlsbb, vctzw, vextractd,
	vextractub, vextractuh, vextractuw, vextsb2d, vextsb2w, vextsh2d,
	vextsh2w, vextsw2d, vextublx, vextubrx, vextuhlx, vextuhrx, vextuwlx,
	vextuwrx, vinsertb, vinsertd, vinserth, vinsertw, vmul10cuq,
	vmul10ecuq, vmul10euq, vmul10uq, vnegd, vnegw, vpermr, vprtybd,
	vprtybq, vprtybw, vrldmi, vrldnm, vrlwmi, vrlwnm, vslv, vsrv, wait,
	xsabsqp, xsaddqp, xsaddqpo, xscmpeqdp, xscmpexpdp, xscmpexpqp,
	xscmpgedp, xscmpgtdp, xscmpnedp, xscmpoqp, xscmpuqp, xscpsgnqp,
	xscvdphp, xscvdpqp, xscvhpdp, xscvqpdp, xscvqpdpo, xscvqpsdz,
	xscvqpswz, xscvqpudz, xscvqpuwz, xscvsdqp, xscvudqp, xsdivqp,
	xsdivqpo, xsiexpdp, xsiexpqp, xsmaddqp, xsmaddqpo, xsmaxcdp,
	xsmaxjdp, xsmincdp, xsminjdp, xsmsubqp, xsmsubqpo, xsmulqp, xsmulqpo,
	xsnabsqp, xsnegqp, xsnmaddqp, xsnmaddqpo, xsnmsubqp, xsnmsubqpo,
	xsrqpi, xsrqpix, xsrqpxp, xssqrtqp, xssqrtqpo, xssubqp, xssubqpo,
	xststdcdp, xststdcqp, xststdcsp, xsxexpdp, xsxexpqp, xsxsigdp,
	xsxsigqp, xvcmpnedp, xvcmpnedp., xvcmpnesp, xvcmpnesp., xvcvhpsp,
	xvcvsphp, xviexpdp, xviexpsp, xvtstdcdp, xvtstdcsp, xvxexpdp,
	xvxexpsp, xvxsigdp, xvxsigsp, xxbrd, xxbrh, xxbrq, xxbrw, xxextractuw,
	xxinsertw, xxperm, xxpermr, xxspltib>: New instructions.
	<doze, nap, sleep, rvwinkle, waitasec, lxvx, stxvx>: Disable on POWER9.
	<tlbiel, tlbie, sync, slbmfev, slbmfee>: Add additional operands.

include/elf/
	* ppc.h (R_PPC_REL16DX_HA): New reloction.
	* ppc64.h (R_PPC64_REL16DX_HA): Likewise.

bfd/
	* elf32-ppc.c (ppc_elf_howto_raw): Add R_PPC_REL16DX_HA.
	(ppc_elf_reloc_type_lookup): Handle R_PPC_REL16DX_HA.
	(ppc_elf_addr16_ha_reloc): Likewise.
	(ppc_elf_check_relocs): Likewise.
	(ppc_elf_relocate_section): Likewise.
	(is_insn_dq_form): Handle lxv and stxv instructions.
	* elf64-ppc.c (ppc64_elf_howto_raw): Add R_PPC64_REL16DX_HA.
	(ppc64_elf_reloc_type_lookup): Handle R_PPC64_REL16DX_HA.
	(ppc64_elf_ha_reloc): Likewise.
	(ppc64_elf_check_relocs): Likewise.
	(ppc64_elf_relocate_section): Likewise.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Likewise.
	* reloc.c (BFD_RELOC_PPC_REL16DX_HA): New.

elfcpp/
	* powerpc.h (R_POWERPC_REL16DX_HA): Define.

gas/
	* doc/as.texinfo (Target PowerPC): Document -mpower9 and -mpwr9.
	* doc/c-ppc.texi (PowerPC-Opts):  Likewise.
	* config/tc-ppc.c (md_show_usage): Likewise.
	(md_assemble): Handle BFD_RELOC_PPC_REL16DX_HA.
	(md_apply_fix): Likewise.
	(ppc_handle_align): Handle power9's group ending nop.

gas/testsuite/
	* gas/ppc/altivec3.s: New test.
	* gas/ppc/altivec3.d: Likewise.
	* gas/ppc/vsx3.s: Likewise.
	* gas/ppc/vsx3.d: Likewise.
	* gas/ppc/power9.s: Likewise.
	* gas/ppc/power9.d: Likewise.
	* gas/ppc/ppc.exp: Run them.
	* gas/ppc/power8.s <lxvx, lxvd2x, stxvx, stxvd2x>: Add new tests.
	* gas/ppc/power8.d: Likewise.
	* gas/ppc/vsx.s: <lxvx, stxvx>: Rename invalid mnemonics ...
	<lxvd2x, stxvd2x>: ...to this.
	* gas/ppc/vsx.d: Likewise.

gold/
	* gold/powerpc.cc (Powerpc_relocate_functions::addr16_dq): New function.
	(Powerpc_relocate_functions::addr16dx_ha): Likewise.
	(Target_powerpc::Scan::local): Handle R_POWERPC_REL16DX_HA.
	(Target_powerpc::Scan::global): Likewise.
	(Target_powerpc::Relocate::relocate): Likewise.

ld/testsuite/
	* ld-powerpc/addpcis.d: New test.
	* ld-powerpc/addpcis.s: New test.
	* ld-powerpc/powerpc.exp: Run it.
2015-11-11 19:52:52 -06:00
Vladimir Radosavljevic cc203475bd Recognize .pdr debug sections.
gold/
	* layout.h (Layout::is_debug_info_section): Recognize .pdr debug
	sections.
2015-11-09 10:46:43 -08:00
Cary Coutant 859d79870d Remove unnecessary target dependencies on relocation format.
2015-11-09  Cary Coutant  <ccoutant@gmail.com>
	    Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>

gold/
	* copy-relocs.h (Copy_relocs::copy_reloc): Replace reloc parameter
	with type, offset, addend.
	(Copy_relocs::save): Likewise.
	* copy-relocs.cc (Copy_relocs::copy_reloc): Likewise.
	(Copy_relocs::save): Likewise.
	* aarch64.cc (Target_aarch64::copy_reloc): Pass r_type, r_offset,
	and r_addend to Copy_relocs::copy_reloc.
	* arm.cc (Target_arm::copy_reloc): Likewise.
	* i386.cc (Target_i386::copy_reloc): Likewise.
	* mips.cc (Target_mips::copy_reloc): Likewise.
	* powerpc.cc (Target_powerpc::copy_reloc): Likewise.
	* s390.cc (Target_s390::copy_reloc): Likewise.
	* sparc.cc (Target_sparc::copy_reloc): Likewise.
	* tilegx.cc (Target_tilegx::copy_reloc): Likewise.
	* x86_64.cc (Target_x86_64::copy_reloc): Likewise.
2015-11-09 10:33:37 -08:00
Cary Coutant 96f9814df2 Revert patch for PR 19119, which led to PR 19172 and 19197.
Gold does not support all the emulations that Gnu ld does, and supports
only one spelling per target. The -m option is used only in the rare case
where there are no ELF input files, and we produce an empty output file.
In those cases, users are expected to supply a -m option naming one of
the supported emulations. In the many cases where a build script provides
an unnecessary -m option naming an emulation that gold does not support,
we will simply ignore the option, as we did before the reverted patch.

gold/
	PR gold/19119
	PR gold/19172
	PR gold/19197
	Revert commit 6457197210144f50a696097c0d308d81d46d5510:

	2015-10-16  H.J. Lu  <hongjiu.lu@intel.com>

		* options.h (General_options): Remove "obsolete" from -m.
		* parameters.cc (set_parameters_target): Check if input target
		is compatible with output emulation set by "-m emulation".
2015-11-05 12:59:19 -08:00
Cary Coutant 0eccf19f96 Add aarch64-specific --no-apply-dynamic-relocs option.
With --no-apply-dynamic-relocs on aarch64 targets, gold will not apply
link-time values for absolute relocations that become dynamic relocations.
This provides a workaround for broken Android dynamic linkers that use
the link-time value as an extra addend to the relocation.

gold/
	PR gold/19163
	* aarch64.cc (Target_aarch64::Relocate::relocate): Don't apply
	certain relocations if --no-apply-dynamic-relocs is set.
	* options.h (--apply-dynamic-relocs): New aarch64-specific option.
2015-11-05 12:24:14 -08:00
Alan Modra c1e7d6a827 [GOLD] Regenerate POTFILES.in to add s390.cc
* po/POTFILES.in: Regenerate.
2015-11-03 22:51:30 +10:30
Nick Clifton 26f187cd16 Updated (simplified) Chinese translations for ld, bfd, binutils and gold.
* po/zh_CN.po: Updated (simplified) Chinese translation.
2015-10-30 12:50:27 +00:00
H.J. Lu 41e83f2b16 Make GOT entry size target-dependent
The GOT entry size is target-dependent.  This patch adds a got_entry_size
function to Sized_target class so that a target can provide a value
different from default.

	PR gold/19184
	* incremental.cc (Got_plt_view_info): Add got_entry_size.
	(Local_got_offset_visitor::visit): Replace got_entry_size_
	with info_.got_entry_size.
	(Local_got_offset_visitor::got_entry_size_): Removed.
	(Global_got_offset_visitor::visit): Replace got_entry_size_
	with info_.got_entry_size.
	(Global_got_offset_visitor::got_entry_size_): Removed.
	(Output_section_incremental_inputs::write_got_plt): Initialize
	view_info.got_entry_size.
	* target.h (Sized_target::got_entry_size): New virtual function.
	* x86_64.cc (Target_x86_64::got_entry_size): New function.
2015-10-29 09:26:41 -07:00
Marcin Kościelnicki 238830c697 Add __attribute__((__aligned__(1))) to unaligned symbols from scripts (for s390).
gold/
	* testsuite/binary_test.cc: Add __attribute__((aligned(1))).
	* testsuite/script_test_12a.c: Likewise.
	* testsuite/script_test_1a.cc: Likewise.
	* testsuite/script_test_2.cc: Likewise.
2015-10-28 16:49:13 -07:00
Marcin Kościelnicki bd890911da Make debug_msg.sh more open-minded about line numbers (needed for s390).
gold/
	* testsuite/debug_msg.sh: Accept more fuzz in line numbers.
2015-10-28 16:48:46 -07:00
Marcin Kościelnicki a817ff49c3 Fix empty string alignment in .rodata.str*
gold/
	PR gold/18959
	* stringpool.cc (Stringpool_template::new_key_offset): Align all
	strings, even zero-length.
	(Stringpool_template::set_string_offsets):
2015-10-28 16:48:16 -07:00
Marcin Kościelnicki e79a4bad70 Add s390 backend.
elfcpp/
	* s390.h: New file.

gold/
	* s390.cc: New file.
	* Makefile.am (TARGETSOURCES): Add s390.cc.
	(ALL_TARGETOBJS): Add s390.o.
	* Makefile.in: Regenerate.
	* configure.ac: Add s390 support.
	* configure: Regenerate.
	* configure.tgt: Add s390-*-* and s390x-*-*.
	* testsuite/icf_safe_test.sh (arch_specific_safe_fold): Add s390
	support.
2015-10-28 16:47:27 -07:00
Marcin Kościelnicki 6f97897dbe Add 64-bit archive support.
gold/
	* archive.cc (Archive::sym64name): New const.
	(Archive::setup): Add support for SYM64 armap.
	(Archive::read_armap): Likewise.
	(Archive::interpret_header): Likewise.
	(Archive::const_iterator::read_next_header): Likewise.
	* archive.h (Archive::sym64name): New const.
	(Archive::read_armap): Add mapsize template parameter.
2015-10-28 16:46:07 -07:00
Marcin Kościelnicki 8d9743bd43 Support 64-bit entry size in SHT_HASH (for s390).
gold/
	* dynobj.cc (Dynobj::create_elf_hash_table): Create hash table with
	target-specific entry size.
	(Dynobj::sized_create_elf_hash_table): Add size template parameter.
	* dynobj.h (Dynobj::sized_create_elf_hash_table): Likewise.
	* layout.cc (Layout::create_dynamic_symtab): Set entsize to
	hash_entry_size.
	* target.h (Target::hash_entry_size): New method.
	(Target::Target_info::hash_entry_size): New data member.

	* aarch64.cc (Target_aarch64::aarch64_info): Add hash_entry_size.
	* arm.cc (Target_arm::arm_info): Likewise.
	(Target_arm_nacl::arm_nacl_info): Likewise.
	* i386.cc (Target_i386::i386_info): Likewise.
	(Target_i386_nacl::i386_nacl_info): Likewise.
	(Target_iamcu::iamcu_info): Likewise.
	* mips.cc (Target_mips::mips_info): Likewise.
	(Target_mips_nacl::mips_nacl_info): Likewise.
	* powerpc.cc (Target_powerpc::powerpc_info): Likewise.
	* sparc.cc (Target_sparc::sparc_info): Likewise.
	* tilegx.cc (Target_tilegx::tilegx_info): Likewise.
	* x86_64.cc (Target_x86_64::x86_64_info): Likewise.
	(Target_x86_64_nacl::x86_64_nacl_info): Likewise.
	* testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2015-10-28 16:45:37 -07:00
H.J. Lu 3043c1aba1 Check R_386_GOT32/R_386_GOT32X without base register
The R_386_GOT32 and R_386_GOT32X relocations may be used without base
register:

	movl	bar@GOT, %eax

Its calculation is G + A, instead of G + A - GOT, and it can only used
to generate non-PIC executable.  Include the .got.plt section address
for R_386_GOT32 and R_386_GOT32X relocations without base register.
Don't allow R_386_GOT32 and R_386_GOT32X relocations without base
register when making a PIC output.

	PR gold/19177
	* i386.cc (Target_i386::Relocate::relocate): Check R_386_GOT32
	and R_386_GOT32X relocations without base register.
2015-10-28 09:15:40 -07:00
Han Shen 4d2f5d5824 Patch for PR gold/19042 - unsupported reloc 311/312.
gold/

	* aarch64.cc (Target_aarch64::Scan::local): Add support for
	reloc 311/312.
2015-10-27 15:22:41 -07:00
H.J. Lu 2891b49104 Gold: Don't fail on R_X86_64_[REX_]GOTPCRELX relocations
This patch updates gold to treat the R_X86_64_GOTPCRELX and
R_X86_64_REX_GOTPCRELX relocations proposed in

https://groups.google.com/forum/#!topic/x86-64-abi/n9AWHogmVY0

the same as R_X86_64_GOTPCREL.  FIXME: Gold should perform the
transformations as suggested.

elfcpp/

	* x86_64.h (R_X86_64_GOTPCRELX): New.
	(R_X86_64_REX_GOTPCRELX): Likewise.

gold/

	* x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
	Treat R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX the same
	as R_X86_64_GOTPCREL.
	(Target_x86_64<size>::Scan::local): Likewise.
	(Target_x86_64<size>::Scan::possible_function_pointer_reloc):
	Likewise.
	(Target_x86_64<size>::Scan::global): Likewise.
	(Target_x86_64<size>::Relocate::relocate): Likewise.
	(Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
	Likewise.
2015-10-22 04:56:57 -07:00
H.J. Lu 493d4b48de Gold: Don't fail on R_386_GOT32X relocation
This patch updates gold to treat the R_386_GOT32X relocation proposed in

https://groups.google.com/forum/#!topic/ia32-abi/GbJJskkid4I

the same as R_386_GOT32.  FIXME: Gold should perform the transformations
as suggested.

elfcpp/

	* i386.h (R_386_GOT32X): New.

gold/

	* i386.cc (Target_i386::Scan::get_reference_flags(): Treat
	R_386_GOT32X the same as R_386_GOT32.
	(Target_i386::Scan::local): Likewise.
	(Target_i386::Scan::possible_function_pointer_reloc): Likewise.
	(Target_i386::Scan::global): Likewise.
	(Target_i386::Relocate::relocate): Likewise.
	(Target_i386::Relocatable_size_for_reloc::get_size_for_reloc):
	Likewise.
2015-10-22 04:56:49 -07:00
H.J. Lu 0fd153457c Feed right input object to x86_64_mov_to_lea1[12]
x86_64_mov_to_lea1.o is a 64-bit x86-64 object and x86_64_mov_to_lea2.o
is a 32-bit x86-64 object.  x86_64_mov_to_lea11 should use
x86_64_mov_to_lea2.o and x86_64_mov_to_lea12 should use
x86_64_mov_to_lea1.o.

	* testsuite/Makefile.am (x86_64_mov_to_lea11): Replace
	x86_64_mov_to_lea1.o with x86_64_mov_to_lea2.o.
	(x86_64_mov_to_lea12): Replace x86_64_mov_to_lea2.o with
	x86_64_mov_to_lea1.o.
	* testsuite/Makefile.in: Regenerated.
2015-10-20 10:46:47 -07:00
H.J. Lu 6457197210 Don't ignore "-m emulation" command line option
Gold shouldn't ignore "-m emulation" command line option, which may
lead to incorrect output.

	PR gold/19119
	* options.h (General_options): Remove "obsolete" from -m.
	* parameters.cc (set_parameters_target): Check if input target
	is compatible with output emulation set by "-m emulation".
2015-10-16 08:05:09 -07:00
H.J. Lu 01f573ad8a Add EM_IAMCU support to gold
elfcpp/

	PR gold/19118
	* elfcpp.h (EM): Add EM_IAMCU.

gold/

	PR gold/19118
	* i386.cc (Target_iamcu): New class.
	(Target_selector_iamcu): Likewise.
	(Target_iamcu::iamcu_info): New variable.
	(target_selector_iamcu): Likewise.
2015-10-13 09:02:41 -07:00
Andreas Schwab 3b0357dada gold: fix ABI pagesize for aarch64
* aarch64.cc (aarch64_info): Set abi_pagesize to 64K.
2015-10-07 10:57:37 +02:00
Cary Coutant 9eacb935ac Fix bug when applying R_SPARC_GOTDATA_OP* relocations to local symbols.
When applying a GOTDATA_OP* relocation to a local symbol, the addend
is being applied after getting the value of the symbol. When the
relocation refers to a merge section, however, the addend must be
provided when computing the symbol value, since the contents of
the section may have been rearranged.

gold/
	PR gold/18855
	* sparc.cc (Sparc_relocate_functions::gdop_hix22): Remove addend
	parameter.
	(Sparc_relocate_functions::gdop_lox10): Likewise.
	(Target_sparc::Relocate::relocate): Use addend when computing
	symbol value for R_SPARC_GOTDATA_OP*.
2015-10-06 14:44:10 -07:00
Cary Coutant 3d4fde6974 Fix internal error caused by IFUNC patch.
The previous commit to fix PR gold/18886 converted STT_IFUNC
to STT_FUNC when resolving to a symbol defined in a shared library.
This leads to an internal error if the shared library symbol is
seen first, as we do not convert the symbol at all.

We need to override the STT_IFUNC in add_from_dynobj() instead of
in override_base().

gold/
	PR gold/18930
	PR gold/18886
	* resolve.cc (Symbol::override_base): Don't convert IFUNC symbols here.
	* symtab.cc (Symbol_table::add_from_dynobj): Convert them here instead.
2015-09-07 09:44:11 -07:00
H.J. Lu 358de98820 Turn IFUNC symbols from shared libraries into normal FUNC symbols
Turn IFUNC symbols from shared libraries into normal FUNC symbols when
we are resolving symbol references, instead of when we are writing out
the symbol table.

	PR gold/18886
	* resolve.cc (Symbol::override_base): Turn IFUNC symbols from
	shared libraries into normal FUNC symbols.
	* symtab.cc (Symbol_table::sized_write_symbol): Assert IFUNC
	symbols aren't from shared libraries.
2015-09-02 04:17:43 -07:00
Alan Modra d49044c753 [GOLD] ppc64 out-of-line register save/restore functions
Gold version of a4b6fadd.  Don't emit long branch or plt branch stubs
to save/restore functions.  Copy them instead.

	PR 18878
	* powerpc.cc (Target_powerpc): Add savres_section_ and accessor.
	(Target_powerpc::Branch_info::make_stub): Determine whether long
	branch stub is for save/restore function.
	(Branch_stub_ent): Add save_res_, and extra parm to constructor.
	(Stub_table): Add need_save_res_.
	(Stub_table:clear_stubs): Clear need_save_res_.
	(Stub_table:set_address_and_size): Add save/restore section size.
	(Stub_table::add_long_branch_entry): Add save_res param.  Set
	need_save_res_, but don't add space for save/restore stubs.
	(Stub_table::find_long_branch_entry): Return offset to local copy
	of save/restore func.
	(Stub_table::do_write): Don't output save/restore stubs.  Instead
	copy the save/restore functions.
	(Output_data_save_res:contents): New accessor.
	(Target_powerpc::define_save_restore_funcs): Set savres_section_.
2015-09-02 16:07:02 +09:30
Cary Coutant 7c61d651fd Fix problem where script specified both address and region for a section.
If a script specifies both address and region for an output section
declaration, gold ignores the region specification. This can lead to
bogus "moves backward" errors. This patch fixes gold so that if a
section specifies both address and region, it will place the section
at the specified address in the region, and update the location counter
within the region.

gold/
	PR gold/18847
	* script-sections.cc (Memory_region::set_address): New method.
	(Script_sections::find_memory_region): Add explicit_only parameter.
	(Output_section_definition::set_section_addresses): Handle case where
	script specifies both address and vma region.
	* script-sections.h (Script_sections::find_memory_region): Add
	explicit_only parameter.
2015-08-26 00:03:04 -07:00
Cary Coutant 4bfacfd359 Fix --no-as-needed when shared library is listed twice on the command line.
When a shared library is listed twice on the command line, the linker
ignores the second mention. If the first mention is in the scope of
an --as-needed option, and the second one is under the scope of a
--no-as-needed option, the --no-as-needed should take effect, but
doesn't.  This patch keeps track of the objects we've already seen,
and updates the --as-needed flag so that if a shared object is ever
seen with --no-as-needed, it will be marked as such.

gold/
	PR gold/18859
	* object.cc (Input_objects::add_object): Store objects in a map,
	indexed by soname; update as-needed flag when necessary.
	* object.h (Object::clear_as_needed): New method.
	(Input_objects::so_names_): Change from set to map.
2015-08-25 18:39:20 -07:00
Cary Coutant 1757d35c8a Fix internal error in gold when script uses section address in assignment.
When processing assignment expressions in a linker script, gold processes
absolute assignments early, but when one of those assignments involves the
address of a section that has not yet been finalized, we get an internal
error in address. This patch fixes the problem by gracefully returning
from expression evaluation even if the address is not yet valid, and
deferring the assignment in such a case.

gold/
	PR gold/14746
	* expression.cc (Expression::Expression_eval_info): Add
	is_valid_pointer field.
	(Expression::eval_maybe_dot): Add is_valid_pointer parameter.
	Adjust all callers.
	(Addr_expression::value_from_output_section): Check whether address
	is valid.
	* script.cc (Symbol_assignment::set_if_absolute): Defer assignment
	if evaluation failed due to address that is not yet valid.
	* script.h: (Expression::eval_maybe_dot): Add is_valid_pointer
	parameter.
2015-08-25 18:11:19 -07:00
Cary Coutant 3ac0a36c29 Fix regression introduced by fix for PR 18703.
When a user object overrides a versioned definition in a shared object,
it's possible to trigger an internal error because the versioned
definition we saw didn't override the unversioned definition. This
was introduced by the fix for PR 18703. This patch fixes the problem
by reordering the tests so that we do not check ret->is_default()
until we're confident that the symbol is in fact versioned.

gold/
	PR gold/18866
	PR gold/18703
	* symtab.cc (Symbol_table): Reorder conditions to avoid internal error.
2015-08-25 17:53:53 -07:00
Alan Modra 9215b98bb2 gold --emit-relocs
A symbol value in an ELF final linked binary is absolute, in contrast
to a relocatable object file where the value is section relative.  For
--emit-relocs it is therefore incorrect to use the value of a section
symbol as the addend when adjusting relocs against input section
symbols to output section symbols.

	PR gold/18846
	* target-reloc.h (relocate_relocs <RELOC_ADJUST_FOR_SECTION_RELA>):
	Subtract os->address() from addend.
	* powerpc.cc (relocate_relocs): Likewise.
2015-08-20 12:02:45 +09:30
Cary Coutant b45e00b3ed Fix symbol versioning problems in PR 18703.
If a symbol is defined with ".symver foo,foo@VER", the assembler
creates two symbols in the object: one unversioned, and one with
the (non-default) version "VER". If foo is listed in a version
script, gold would then make the first of those symbols the
default version, and would ignore the second symbol as a
duplicate, without making it a non-default version. While this is
arguably reasonable behavior, it doesn't match Gnu ld behavior,
so this patch fixes that by allowing the second definition to
override the first by resetting the "default version" indication.

Several test cases from the Gnu ld testsuite also exposed another
related problem, where a symbol defined with ".symver foo,foo@",
placed into a shared library, is not handled properly by gold.
This patch also fixes that case, binding the symbol to the base
version.

gold/
	PR gold/18703
	* dynobj.cc (Versions::record_version): Handle symbol defined with
	base version.
	(Versions::symbol_section_contents): Likewise.
	* symtab.h (Symbol::set_is_not_default): New class method.
	(Symbol_table::resolve): Add is_default_version parameter.
	(Symbol_table::should_override): Likewise.
	* resolve.cc (Symbol_table::resolve): Add is_default_version parameter,
	and pass to should_override. Adjust all callers and explicit
	instantiations.
	(Symbol_table::should_override): Add is_default_value parameter;
	allow default version in a dynamic object to override existing
	definition from same object.
	* symtab.cc (Symbol_table::add_from_object): Handle case where same
	symbol is defined as unversioned and non-default version in the same
	object.
	* testsuite/Makefile.am (ver_test_13): New test case.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/ver_test_4.cc: Add test for symbol with base version.
	* testsuite/ver_test_4.sh: Likewise.
	* testsuite/ver_test_13.c: New source file.
	* testsuite/ver_test_13.script: New version script.
	* testsuite/ver_test_13.sh: New test case.
2015-08-18 19:24:41 -07:00
Simon Dardis 40fc1451c6 [MIPS] Map 'move' to 'or'.
The MIPS assembly idiom 'move' now maps to the 'or' machine instruction. This
change affects microMIPS, MIPS32, MIPS64.

2015-08-12  Simon Dardis  <simon.dardis@imgtec.com>

opcodes/

	* micromips-opc.c (micromips_opcodes): Re-order table so that move
	based on 'or' is first.
	* mips-opc.c (mips_builtin_opcodes): Ditto.

bfd/

	* elfxx-mips.c (STUB_MOVE): Change to use 'or' only.
	(mips_o32_exec_plt0_entry, mips_n32_exec_plt0_entry,
	mips_n64_exec_plt0_entry, micromips_insn32_o32_exec_plt0_entry):
	Update to use 'or' instead of 'addu/daddu'.
	(_bfd_mips_elf_finish_dynamic_symbol): Update usage of STUB_MOVE.
	(move_insns_32): Reorder table.

gas/

	* config/tc-mips.c (move_register): Change to use 'or' only.
	(s_cpload, s_cpsetup, s_cprestore, s_cpreturn): Update to
	use or for move.

gas/testsuite/

	* gas/mips/elf-rel23.d: Update test.
	* gas/mips/elf-rel23.d: Ditto.
	* gas/mips/elf-rel23a.d: Ditto.
	* gas/mips/elf-rel23b.d: Ditto.
	* gas/mips/elf_e_flags1.d: Ditto.
	* gas/mips/elf_e_flags2.d: Ditto.
	* gas/mips/elf_e_flags3.d: Ditto.
	* gas/mips/elf_e_flags4.d: Ditto.
	* gas/mips/loc-swap-dis.d: Ditto.
	* gas/mips/micromips-insn32.d: Ditto.
	* gas/mips/micromips-noinsn32.d: Ditto.
	* gas/mips/micromips-trap.d: Ditto.
	* gas/mips/micromips.d: Ditto.
	* gas/mips/mips-abi32-pic.d: Ditto.
	* gas/mips/mips-abi32.d: Ditto.
	* gas/mips/mips-gp32-fp32-pic.d: Ditto.
	* gas/mips/mips-gp32-fp32.d: Ditto.
	* gas/mips/mips-gp32-fp64-pic.d: Ditto.
	* gas/mips/mips-gp32-fp64.d: Ditto.
	* gas/mips/mips-gp64-fp32-pic.d: Ditto.
	* gas/mips/mips-gp64-fp32.d: Ditto.
	* gas/mips/mips-gp64-fp64-pic.d: Ditto.
	* gas/mips/mips-gp64-fp64.d: Ditto.
	* gas/mips/mipsr6@loc-swap-dis.d: Ditto.
	* gas/mips/tls-o32.d: Ditto.
	* gas/mips/uld2-eb.d: Ditto.
	* gas/mips/uld2-el.d: Ditto.
	* gas/mips/ulw2-eb-ilocks.d: Ditto.
	* gas/mips/ulw2-eb.d: Ditto.
	* gas/mips/ulw2-el-ilocks.d: Ditto.
	* gas/mips/ulw2-el.d: Ditto.
	* gas/mips/move.d: New test.
	* gas/mips/move.s: Ditto.
	* gas/mips/micromips32-move.d: Ditto.
	* gas/mips/micromips32-move.s: Ditto.
	* gas/mips/mips.exp: Run the new tests.

gold/

	* mips.cc (plt0_entry_o32, plt0_entry_n32, plt0_entry_n64,
	lazy_stub_normal_1, lazy_stub_normal_1_n64,
	lazy_stub_normal_2, lazy_stub_normal_2_n64, lazy_stub_big,
	lazy_stub_big_n64, lazy_stub_micromips32_normal_1_n64,
	lazy_stub_micromips32_normal_2_n64, lazy_stub_micromips32_big,
	lazy_stub_micromips32_big_n64): Update to use 'or' for move instead
	of 'addu/daddu'.

ld/testsuite/

	* ld-mips-elf/compressed-plt-1-n32-mips16.od: Update test.
	* ld-mips-elf/compressed-plt-1-n32-umips.od: Ditto.
	* ld-mips-elf/compressed-plt-1-o32-mips16-got.od: Ditto.
	* ld-mips-elf/compressed-plt-1-o32-mips16-only.od: Ditto.
	* ld-mips-elf/compressed-plt-1-o32-mips16-word.od: Ditto.
	* ld-mips-elf/compressed-plt-1-o32-mips16.od: Ditto.
	* ld-mips-elf/compressed-plt-1-o32-se.od: Ditto.
	* ld-mips-elf/compressed-plt-1-o32-umips-got.od: Ditto.
	* ld-mips-elf/compressed-plt-1-o32-umips-word.od: Ditto.
	* ld-mips-elf/compressed-plt-1-o32-umips.od: Ditto.
	* ld-mips-elf/jalx-2.dd: Ditto.
	* ld-mips-elf/mips16-pic-3.dd: Ditto.
	* ld-mips-elf/pic-and-nonpic-3a.dd: Ditto.
	* ld-mips-elf/pic-and-nonpic-3b.dd: Ditto.
	* ld-mips-elf/pic-and-nonpic-5b.dd: Ditto.
	* ld-mips-elf/pic-and-nonpic-6-n32.dd: Ditto.
	* ld-mips-elf/pic-and-nonpic-6-o32.dd: Ditto.
	* ld-mips-elf/stub-dynsym-1-10000.d: Ditto.
	* ld-mips-elf/stub-dynsym-1-2fe80.d: Ditto.
	* ld-mips-elf/stub-dynsym-1-7fff.d: Ditto.
	* ld-mips-elf/stub-dynsym-1-8000.d: Ditto.
	* ld-mips-elf/stub-dynsym-1-fff0.d: Ditto.
	* ld-mips-elf/tlsbin-o32.d: Ditto.
	* ld-mips-elf/tlsdyn-o32-1.d: Ditto.
	* ld-mips-elf/tlsdyn-o32-2.d: Ditto.
	* ld-mips-elf/tlsdyn-o32-3.d: Ditto.
	* ld-mips-elf/tlsdyn-o32.d: Ditto.
	* ld-mips-elf/tlslib-o32.d: Ditto.
2015-08-12 17:10:22 +01:00
H.J. Lu 37a42ee9ad Regenerate configure files
bfd/

	* configure: Regenerated.

binutils/

	* configure: Regenerated.

gas/

	* configure: Regenerated.

gold/

	* configure: Regenerated.

gprof/

	* configure: Regenerated.

ld/

	* configure: Regenerated.

opcodes/

	* configure: Regenerated.
2015-07-27 07:56:32 -07:00
Doug Kwan ab3b14b04b Make arm_unaligned_reloc test less sensitive to disassembler output format. 2015-07-26 00:54:26 -07:00
H.J. Lu 72f4393d8c Remove leading/trailing white spaces in ChangeLog 2015-07-24 04:16:47 -07:00
Han Shen cdb061674c 2015-07-23 Ian Coolidge <icoolidge@google.com>
Plumb --pic-veneer option for gold.

gold/ChangeLog:
	* arm.cc (Reloc_stub::stub_type_for_reloc): Plumb to stub generation.
	* options.h (General_options): Add --pic-veneer option.
2015-07-23 15:56:33 -07:00
H.J. Lu 5b2af7dd40 Don't compare symbol addresses directly
GCC 5 will fold symbol address comparison, assuming each symbol has a
different address, which leads to abort.  We should use separate
functions to compare symbol address.

	PR gold/18663
	* testsuite/Makefile.am (script_test_1_SOURCES): Set to
	script_test_1a.cc script_test_1b.cc.
	(script_test_11_r.o): Replace script_test_11.o with
	script_test_11a.o script_test_11b.o.
	(script_test_11.o): Removed.
	(script_test_11a.o): New.
	(script_test_11b.o): Likewise.
	* testsuite/Makefile.in: Regenerated.
	* testsuite/script_test_1.h: New file.
	* testsuite/script_test_1b.cc: Likewise.
	* testsuite/script_test_11.h: Likewise.
	* testsuite/script_test_11b.c: Likewise.
	* testsuite/script_test_1.cc: Renamed to ...
	* testsuite/script_test_1a.cc: This.
	Include "script_test_1.h".
	(main): Call check_int and check_ptr.
	* testsuite/script_test_11.c: Renamed to ...
	* testsuite/script_test_11a.c: This.
	Include "script_test_11.h".
	(main): Call ptr_equal.
2015-07-22 03:38:00 -07:00
H.J. Lu cd78ea777c Mark global with hidden attribute
GCC 5 will generate a relocation for protected symbol:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248

when compiling for a shared library.  It is undefined to access protected
symbol in IFUNC selector function inside a shared library.

	PR gold/18628
	* testsuite/ifuncdep2.c (global): Change protected to hidden.
	* testsuite/ifuncmod1.c (global): Likewise.
	* testsuite/ifuncmod5.c (global): Likewise.
2015-07-22 03:37:50 -07:00
Alan Modra f945ba50bb GOLD aarch64 warning fix
aarch64.cc:2026:50: error: integer overflow in expression [-Werror=overflow]
       Insntype adr_insn = adrp_insn & ((1 << 31) - 1);

	* aarch64.cc (try_fix_erratum_843419_optimized): Warning fix.
2015-07-22 10:29:12 +09:30
Cary Coutant 5417c94d1a Fix problem where __start_ and __stop_ section symbols do not honor version script.
When creating the special __start_ and __stop_ section symbols, gold
does not check the version script to see if they should be local
instead of global.

2015-07-21  Cary Coutant  <ccoutant@gmail.com>

gold/
	PR gold/18548
	* symtab.cc (Symbol_table::do_define_in_output_data): Check for
	forced local symbol even when oldsym != NULL.
	(Symbol_table::do_define_in_output_segment): Likewise.
	(Symbol_table::do_define_as_constant): Likewise.
2015-07-21 16:10:05 -07:00
Cary Coutant b8c6c5ef99 Fix typo in PR number.
Fix internal error when linking an archive library with no preceding objects.

    gold/
	PR gold/18698
	* archive.cc (Library_base::should_include_member): Don't use entry
	point for relocatable links, or if target is not yet valid.
	* parameters.cc (Parameters::entry): Check target_valid().
2015-07-21 12:50:45 -07:00
Cary Coutant cb5cf5e26e Fix internal error when linking an archive library with no preceding objects.
gold/
	PR gold/18696
	* archive.cc (Library_base::should_include_member): Don't use entry
	point for relocatable links, or if target is not yet valid.
	* parameters.cc (Parameters::entry): Check target_valid().
2015-07-21 12:42:07 -07:00
Han Shen 0ef3814fe1 Optimize erratum 843419 fix.
gold/ChangeLog:
	* aarch64.cc (AArch64_insn_utilities::is_adr): New method.
	(AArch64_insn_utilities::aarch64_adr_encode_imm): New method.
	(AArch64_insn_utilities::aarch64_adrp_decode_imm): New method.
	(E843419_stub): New sub-class of Erratum_stub.
	(AArch64_relobj::try_fix_erratum_843419_optimized): New method.
	(AArch64_relobj::section_needs_reloc_stub_scanning): Try optimized fix.
	(AArch64_relobj::create_erratum_stub): Add 1 argument.
	(Target_aarch64::scan_erratum_843419_span): Pass in adrp insn offset.
2015-07-20 13:20:46 -07:00
H.J. Lu 45972d0074 Update testsuite/pr18689.sh for older GCC
Older GCC, like 4.2, generates .debug_macinfo section instead of
.debug_macro section.  This patch updates testsuite/pr18689.sh to
support it.
2015-07-20 12:20:46 -07:00
Han Shen 2bca03770d Properly set arm-specific elf flags wrt hardfp.
gold/ChangeLog:
	* arm.cc (Target_arm::do_adjust_elf_header): Set flags into view.
2015-07-20 11:50:10 -07:00
H.J. Lu f54f5e31ce Clear SHF_COMPRESSED flag bit from input to output
For relocatable link, we should clear the SHF_COMPRESSED flag bit from
input group section.

	PR gold/18689
	* layout.cc (Layout::layout): Clear the SHF_COMPRESSED flag bit
	from input group section for relocatable link.
	* testsuite/Makefile.am (check_SCRIPTS): Add pr18689.sh.
	(check_DATA): Add pr18689.stdout.
	(MOSTLYCLEANFILES): Add pr18689a.o pr18689b.o.
	(pr18689.stdout): New rule.
	(pr18689a.o): Likewise.
	(pr18689b.o): Likewise.
	(pr18689.o): Likewise.
	* testsuite/pr18689.c: New file.
	* testsuite/pr18689.sh: Likewise.
	* testsuite/Makefile.in: Regenerated.
2015-07-20 10:14:35 -07:00
Yiran Wang c20ceeb226 Remove warning about references from shared objects to hidden symbols.
gold/
	PR gold/15574
	* resolve.cc (Symbol_table): Remove warning about references
	from shared objects to hidden symbols.
	* testsuite/Makefile.am (hidden_test): Add hidden_test.syms.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/hidden_test.sh: Check dynamic symbol table; update
	expected error messages.
2015-07-20 09:19:02 -07:00
H.J. Lu 19a7fe52ae Make default compression gABI compliant
All programs in binutils+gdb git repo now support gABI compression
with the SHF_COMPRESSED bit.  This patch makes the zlib-gabi option
as compression default for gas, gold, ld and objcopy, instead of the
zlib-gnu option whose outputs are incompatible with gABI.

binutils/

	* objcopy.c (copy_file): Set BFD_COMPRESS_GABI if not
	zlib-gnu.
	* doc/binutils.texi: Change --compress-debug-sections and
	--compress-debug-sections=zlib to zlib-gabi.

binutils/testsuite/

	* binutils-all/compress.exp: Update.

gas/

	* as.c (parse_args): Make --compress-debug-sections and
	--compress-debug-sections=zlib the same as
	--compress-debug-sections=zlib-gabi.
	* doc/as.texinfo: Change --compress-debug-sections and
	--compress-debug-sections=zlib to zlib-gabi.

gold/

	* compressed_output.cc (Output_compressed_section::set_final_data_size):
	Make --compress-debug-sections=zlib the same as
	--compress-debug-sections=zlib-gabi.
	* testsuite/Makefile.am (flagstest_compress_debug_sections.check):
	Expect ".debug_.*" with the SHF_COMPRESSED bit, instead of
	".zdebug_".
	* testsuite/Makefile.in: Regenerated.

ld/

	* emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Make
	--compress-debug-sections=zlib the same as
	--compress-debug-sections=zlib-gabi.
	* ld.texinfo: Change --compress-debug-sections=zlib to zlib-gabi.

ld/testsuite/

	* ld-elf/zlibbegin.rS: Updated to .debug_.* with the
	SHF_COMPRESSED bit.
	* ld-elf/zlibnormal.rS: Likewise.
2015-07-14 10:26:23 -07:00
H.J. Lu fb8b9dbc14 Extend --compress-debug-sections in gold
This patch extends --compress-debug-sections= with [zlib-gnu|zlib-gabi]
in gold.

	PR gold/18322
	* compressed_output.cc (zlib_compress): Add argument for
	compression header size.  Set header size to compression header
	size if it isn't 0.  Don't write out the zlib header here.
	(Output_compressed_section::set_final_data_size): Support
	zlib-gnu and zlib-gabi compressions.  Pass compression header
	size to zlib_compress and write out compression header.  Set
	the SHF_COMPRESSED bit for zlib-gabi compression.  Otherwise
	clear the SHF_COMPRESSED bit
	* options.h (compress_debug_sections): Add zlib-gnu and
	zlib-gabi.
	* output.h (Output_section::set_flags): New.
	* testsuite/Makefile.am (check_PROGRAMS): Add
	flagstest_compress_debug_sections_none,
	flagstest_compress_debug_sections_gnu and
	flagstest_compress_debug_sections_gabi.
	(check_DATA): Add flagstest_compress_debug_sections_none.stdout.
	flagstest_compress_debug_sections.stdout,
	flagstest_compress_debug_sections.cmp,
	flagstest_compress_debug_sections.check,
	flagstest_compress_debug_sections_gnu.stdout,
	flagstest_compress_debug_sections_gnu.cmp,
	flagstest_compress_debug_sections_gnu.check,
	flagstest_compress_debug_sections_gabi.stdout,
	flagstest_compress_debug_sections_gabi.cmp and
	flagstest_compress_debug_sections_gabi.check.
	(flagstest_compress_debug_sections_none): New.
	(flagstest_compress_debug_sections_none.stdout): Likewise.
	(flagstest_compress_debug_sections.stdout): Likewise.
	(flagstest_compress_debug_sections.check): Likewise.
	(flagstest_compress_debug_sections.cmp): Likewise.
	(flagstest_compress_debug_sections_gnu): Likewise.
	(flagstest_compress_debug_sections_gnu.stdout): Likewise.
	(flagstest_compress_debug_sections_gnu.check): Likewise.
	(flagstest_compress_debug_sections_gnu.cmp): Likewise.
	(flagstest_compress_debug_sections_gabi): Likewise.
	(flagstest_compress_debug_sections_gabi.stdout): Likewise.
	(flagstest_compress_debug_sections_gnu.check): Likewise.
	(flagstest_compress_debug_sections_gnu.cmp): Likewise.
	* testsuite/Makefile.in: Regenerated.
2015-07-12 10:56:58 -07:00
H.J. Lu 480586639d Add SHF_COMPRESSED section decompression to gold
This patch adds SHF_COMPRESSED section decompression to gold.

	PR gold/18321
	* compressed_output.h (decompress_input_section): Add arguments
	for ELF class, big endian and sh_flags.
	* compressed_output.cc (decompress_input_section): Likewise.
	Support the SHF_COMPRESSED section.
	* dynobj.h (Dynobj): Add elfsize and is_big_endian member
	functions.
	* plugin.h (Pluginobj): Likewise.
	* layout.cc (Layout::get_output_section_flags): Also clear the
	SHF_COMPRESSED bit.
	* object.h (Compressed_section_info): Add flag to store sh_flags.
	(Object): Add pure virtual elfsize and is_big_endian member
	functions.
	* object.cc (need_decompressed_section): Don't skip the ".zdebug"
	prefix here.
	(build_compressed_section_map): Check SHF_COMPRESSED for
	uncompressed size.  Store sh_flags in Compressed_section_info.
	Pass size, big_endian and sh_flags to decompress_input_section.
	Skip the ".debug"/".zdebug" prefix when passing section name to
	need_decompressed_section.
	(Sized_relobj_file<size, big_endian>::do_find_special_section):
	Don't check ".zdebug_*" sections.
	(Object::decompressed_section_contents): Pass ELF class, big
	endian and sh_flags to decompress_input_section.
	* reloc.cc (Sized_relobj_file<size, big_endian>::write_sections):
	Likewise.
	* testsuite/Makefile.am (check_DATA): Add
	debug_msg_cdebug_gabi.err and gdb_index_test_2_gabi.stdout.
	(MOSTLYCLEANFILES): Add debug_msg_cdebug_gabi.err and
	gdb_index_test_2_gabi.stdout.
	(debug_msg_cdebug_gabi.o): New.
	(odr_violation1_cdebug_gabi.o): Likewise.
	(odr_violation2_cdebug_gabi.o): Likewise.
	(debug_msg_cdebug_gabi.err): Likewise.
	(check_SCRIPTS): Add gdb_index_test_2_gabi.sh.
	(gdb_index_test_cdebug_gabi.o): Likewise.
	(gdb_index_test_2_gabi): Likewise.
	(gdb_index_test_2_gabi.stdout): Likewise.
	* testsuite/gdb_index_test_2_gabi.sh: New file.
	* testsuite/Makefile.in: Regenerated.
2015-07-12 10:50:40 -07:00
Han Shen 73854cdd43 Use "gold_info" instead of "gold_warning" for erratum fix.
gold/ChangeLog:

	* aarch64.cc (Target_aarch64::scan_erratum_843419_span): Use 'gold_info'.
	(Target_aarch64::scan_erratum_835769_span): USe 'gold_info'.
2015-07-09 17:13:34 -07:00
Han Shen 61163dfaae Drop 'missing mapping symbols' warning for arm and aarch64.
The psABI (AAELF) says this about mapping symbols:

    4.6.5.1 Section-relative mapping symbols

    Mapping symbols defined in a section define a sequence of
    half-open address intervals that cover the address range of the
    section. Each interval starts at the address defined by the
    mapping symbol, and continues up to, but not including, the
    address defined by the next (in address order) mapping symbol or
    the end of the section. A section must have a mapping symbol
    defined at the beginning of the section; however, if the section
    contains only data then the mapping symbol may be omitted.

That makes it pretty clear that, in the absence of a mapping symbol,
the entire section can be treated as data.

gold/ChangeLog:
	* aarch64.cc (AArch64_relobj::scan_errata): Drop missing symbol warning.
	* arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Drop missing
	symbol warning.
2015-07-09 15:43:15 -07:00
Han Shen b91deca94e Make gold aarch64 accept long form of mapping symbols.
2015-07-07  Han Shen  <shenhan@google.com>

gold/ChangeLog:
	2015-07-06 Han Shen  <shenhan@google.com>
	* aarch64.cc (AArch64_relobj::do_count_local_symbols): Make legal
	of mapping symbols.
2015-07-07 16:40:13 -07:00
Doug Kwan 15162befa3 Align text section ends so that stub tables appears at expected addresses. 2015-07-06 15:02:40 -07:00
Han Shen 56b06706eb Patch for gold internal error while fixing erratum 843419.
The crash reason is that the insn to be moved to stub may be a
relocation spot, so instead of placing the origin insn (that is insn
before-relocation) to the stub, I have to place the relocated one.
Note the relocation involved is non-pc-relative, so it is safe to move
the relocated insn.

gold/ChangeLog:
2015-06-29  Han Shen  <shenhan@google.com>

    * AArch64.cc (Erratum_stub::Insn_utilities): New typedef.
    (Erratum_stub::update_erratum_insn): New method.
    (Stub_table::relocate_stubs): Modified to place relocated insn.
    (AArch64_relobj::fix_errata): Modified gold_assert.
2015-06-29 17:03:02 -07:00
Han Shen 2f0c79aa61 [gold][aarch64] Fix erratum 835769.
gold/ChangeLog:

	* aarch64.cc (AArch64_insn_utilities::BYTES_PER_INSN): Move
	defintion outside class definition.
	(AArch64_insn_utilities::AARCH64_ZR): New static constant.
	(AArch64_insn_utilities::aarch64_op31): New member.
	(AArch64_insn_utilities::aarch64_ra): New member.
	(AArch64_insn_utilities::aarch64_mac): New member.
	(AArch64_insn_utilities::aarch64_mlxl): New member.
	(ST_E_835769): New global enum member.
	(Stub_table::relocate_stubs): Add 835769 handler.
	(Stub_template_repertoire::Stub_template_repertoire): Install new
	stub type.
	(AArch64_relobj::scan_errata): This func is renamed from
	scan_erratum_843419.
	(AArch64_relobj::do_count_local_symbols): Add 835769 handler.
	(AArch64_relobj::do_relocate_sections): Add 835769 handler.
	(AArch64_relobj::scan_sections_for_stubs): Add 835769 handler.
	(Target_aarch64::scan_erratum_835769_span): New method.
	(Target_aarch64::create_erratum_stub): New method.
	(Target_aarch64::is_erratum_835769_sequence): New method.
	(Target_aarch64::scan_erratum_843419_sequence): Move part of the
	code into create_erratum_stub.
	* options.h (fix_cortex_a53_835769): New option.
2015-06-12 14:34:14 -07:00
Cary Coutant 5d7908e088 Fix gold build error at -O0.
In aarch64.cc, Erratum_stub::STUB_ADDR_ALIGN and Reloc_stub::STUB_ADDR_ALIGN
are declared as static const int, and initialized in the class body. These
values are referenced from outside the class body, and with no optimization,
the references go unresolved.

gold/
	* aarch64.cc (Erratum_stub::STUB_ADDR_ALIGN): Move initialization
	outside class body.
	(Reloc_stub::STUB_ADDR_ALIGN): Likewise.
2015-06-11 13:21:11 -07:00
Cary Coutant dd68f8fa8e Fix bug where SECTIONS clause does not handle compressed debug sections.
When laying out .debug_* sections, we translate the names of compressed
debug sections that start with ".zdebug", but when processing input
section specs in a linker script, we do not handle the translation there.
This results in an internal error as reported in PR 17731.

gold/
	PR gold/17731
	* layout.cc (corresponding_uncompressed_section_name): New function.
	(Layout::choose_output_section): Call it.
	* layout.h (corresponding_uncompressed_section_name): New function.
	* script-sections.cc (Input_section_info::set_section_name): Check
	for compressed debug section (.zdebug style).
2015-06-11 13:21:10 -07:00
Jing Yu a3a0c39166 Fix broken gold/testsuite/script_test_12 in some setup.
This patch adds -O0 to gold script_test_12 test, hoping that compiler
won't change the order of globel variables that the test assumes.

Changelog:
	testsuite/Makefile.am: Add -O0 to compile script_test_12 test.
	testsuite/Makefile.in: Regenerate.
2015-06-11 12:52:07 -07:00
Davide Italiano 970cdef261 [GOLD] Fix handling of __start/__stop symbols
If the section contains 'Q' in the name, is_cident() returns false,
__start and __stop symbols for the section are not generated..

	* gold.h (is_cident): Correct typo.
2015-06-11 14:36:05 +09:30
Han Shen a48d0c12f8 Patch for erratum-843419 (2 of 2 - fix erratum occurrences).
Now fixing for 843419 is fully functional.

The first part of the erratum fix CL is here -
https://sourceware.org/ml/binutils/2015-04/msg00229.html

gold/ChangeLog
2015-06-10  Han Shen  <shenhan@google.com>

    * aarch64.cc(global enum): New constants representing stub types.
    (Stub_template): New POD struct.
    (Stub_template_repertoire): New class.
    (Stub_base): New class.
    (Erratum_stub): New class.
    (Reloc_stub): Refactored to be a subclass of Stub_base.
    (Reloc_stub::Stub_type): Removed.
    (Reloc_stub::offset): Moved to Stub_base.
    (Reloc_stub::set_offset): Moved to Stub_base.
    (Reloc_stub::destination_address): Moved to Stub_base.
    (Reloc_stub::set_destination_address): Moved to Stub_base.
    (Reloc_stub::reset_destination_address): Moved to Stub_base.
    (Reloc_stub::stub_type): Renamed and moved to Stub_base.
    (Reloc_stub::stub_size): Renamed and moved to Stub_base.
    (Reloc_stub::stub_insns): Renamed and moved to Stub_base.
    (Reloc_stub::write): Moved to Stub_base.
    (Reloc_stub::invalid_offset): Moved to Stub_base.
    (Reloc_stub::invalid_address): Moved to Stub_base.
    (Reloc_stub::stub_type_): Renamed and moved to Stub_base.
    (Reloc_stub::stub_insns_): Moved to Stub_base.
    (Reloc_stub::offset_): Moved to Stub_base.
    (Reloc_stub::destination_address_): Moved to Stub_base.
    (Stub_table::The_aarch64_relobj): New typedef.
    (Stub_table::The_erratum_stub): New typedef.
    (Stub_table::The_erratum_stub_less): New typedef.
    (Stub_table::The_erratum_stub_set): New typedef.
    (Stub_table::The_erratum_stub_set_iter): New typedef.
    (Stub_table::empty): Added emptiness testing for erratum stubs.
    (Stub_table::add_erratum_stub): New method to add an erratum stub.
    (Stub_table::find_erratum_stub): New method.
    (Stub_table::find_erratum_stubs_for_input_section): New method.
    (Stub_table::erratum_stub_address): New method.
    (Stub_table::update_date_size_changed_p): Modified to handle erratum stubs.
    (Stub_table::do_addralign): Modified to handle erratum stubs.
    (Stub_table::erratum_stubs_): New member.
    (Stub_table::erratum_stub_size_): New member.
    (Stub_table::relocate_stubs): Modified to handle erratum stubs.
    (Stub_table::do_write): Modified to handle erratum stubs.
    (AArch64_relobj::The_erratum_stub): New typedef.
    (AArch64_relobj::Erratum_stub_set_iter): New typedef.
    (AArch64_relobj::fix_errata): New method.
    (Target_aarch64::The_reloc_stub_type): Removed.
    (Target_aarch64::The_erratum_stub): New typede.
    (AArch64_relocate_functions::construct_b): New method.
2015-06-10 10:02:15 -07:00
Nick Clifton 1e1b2efc46 Update French Translations for LD and GOLD.
ld	* po/fr.po: Updated French Translation.
gold	* po/fr.po: New French Translation.
2015-06-08 15:04:17 +01:00
Cary Coutant b8cf50755b Fix incorrect handling of STT_COMMON symbols in shared libraries.
The gABI allows STT_COMMON symbols to appear in executables and shared
objects, so that the dynamic loader can resolve commons across modules.
When reading a shared object, however, an STT_COMMON symbol should be
treated as a regular definition at link time.

In a relocatable object, the gABI requires that any STT_COMMON symbols
must also be defined in the special SHN_COMMON section (which we extend
to include target-specific small and large common sections). Thus,
there is no need for gold to treat STT_COMMON symbols as common unless
the st_shndx field is also set to a common section.

gold/
	PR gold/18288
	* resolve.cc (symbol_to_bits): Remove type parameter; adjust all
	callers. Don't use STT_COMMON to check for common symbols.
	(Symbol_table::resolve): Warn if relocatable object has STT_COMMON
	symbol that's not in a common section.
	* symtab.h (Symbol::is_common): Don't use STT_COMMON to check for
	common symbols.
2015-06-07 14:03:52 -07:00
Cary Coutant bdd2d2b7e6 Add diststuff target to Makefile.
gold/
	PR gold/18200
	* Makefile.am (diststuff): Add target.
	* Makefile.in: Regenerate.
2015-06-04 22:58:39 -07:00
Cary Coutant cd3c333f43 Change default to discard temporary local symbols in merge sections.
Add --discard-none to keep all local symbols.

gold/
	PR gold/17498
	* object.cc (Sized_relobj_file::do_count_local_symbols): Discard
	temporary locals in merge sections.
	* options.cc (General_options::parse_discard_all): New method.
	(General_options::parse_discard_locals): New method.
	(General_options::parse_discard_none): New method.
	(General_options::General_options): Initialize discard_locals_.
	* options.h (--discard-all): Convert to special option.
	(--discard-locals): Likewise.
	(--discard-none): New option.
	(General_options::discard_all): New method.
	(General_options::discard_locals): New method.
	(General_options::discard_sec_merge): New method.
	(General_options::Discard_locals): New enum.
	(General_options::discard_locals_): New data member.
2015-06-04 20:58:08 -07:00
Cary Coutant 8086551f52 Fix SIZEOF_HEADERS in gold.
Gold undercounts the number of program headers it's going to add when
initially evaluating the SIZEOF_HEADERS expression. As a result, scripts
that use it end up skipping a page unnecessarily when the starting address
is too low. The undercounting is because it doesn't count the PT_INTERP
segment.

Then, when finalizing symbols, gold overcounts the program headers: all
segments have already been created, but we still count the headers we
expected to add from the script.

This patch fixes both problems.

gold/
	* script-sections.cc (Script_sections::Script_sections): Initialize
	segments_created_.
	(Script_sections::create_note_and_tls_segments): Set flag when
	segments are created.
	(Script_sections::expected_segment_count): Count PT_INTERP.
	(Script_sections::attach_sections_using_phdrs_clause): Set flag when
	segments are created.
	* script-sections.h (Script_sections::segments_created_): New data
	member.
2015-06-03 20:30:11 -07:00
Cary Coutant 374082dfab Fix gold to group sections correctly via linker script.
In PR 15370, it is noted that gold does not distinguish between
"*(.foo .bar)" and "*(.foo) *(.bar)" in linker scripts. In both
cases, gold groups all .foo sections together, followed by all
.bar sections, whereas in the first case, it should collect all
.foo and .bar sections in the order seen.

If you add sort specs, the Gnu linker has some bizarre corner
cases that I do not try to replicate. In particular,
"*(SORT_BY_NAME(.foo) SORT_BY_NAME(.bar))" does the same thing
as "*(.foo) *(.bar)". But if you apply a sort spec
to just one of several patterns, say, "*(SORT_BY_NAME(.foo) .bar)",
the Gnu linker will collect any .bar section it sees before the
first .foo, then all .foo sections, then all remaining .bar
sections. With this patch, if any of the input patterns have a
sort spec, gold will group them all as it did before; e.g.,
all .foo sections followed by all .bar sections.

2015-06-03  Cary Coutant  <ccoutant@gmail.com>

gold/
	PR gold/15370
	* script-sections.cc
	(Output_section_element_input::set_section_addresses): When there
	are several patterns with no sort spec, put all sections in the same
	bin.
	* testsuite/Makefile.am (script_test_12): New testcase.
	(script_test_12i): New testcase.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/script_test_12.t: New test linker script.
	* testsuite/script_test_12i.t: New test linker script.
	* testsuite/script_test_12a.c: New test source file.
	* testsuite/script_test_12b.c: New test source file.
2015-06-03 19:37:49 -07:00
Cary Coutant 775ed62ec5 Fix Sniff_file to get an aligned view.
gold/
	* nacl.h (Sniff_file): Switch parameters to get_view to get an
	aligned view.
2015-06-02 14:13:32 -07:00
Cary Coutant 9c7fe3c5c2 PR 17819: Fix --build-id=tree when using --compress-debug-sections.
When --build-id=tree is selected, gold would schedule a set of
tasks to run to compute md5 hashes in parallel on chunks of the
file. The scheduling was done before the
Write_after_input_sections_task ran, so if we are compressing
debug sections, the output file will change size and be remapped
to a new address, sometimes causing the build id computation to
crash, but even when it doesn't crash, it wouldn't include the
debug information in the hash computation.

This patch delays the scheduling of the md5 tasks until after
Write_after_input_sections_task.

gold/
        PR gold/17819
        * gold.cc (queue_final_tasks): When --build-id=tree, queue a
        separate task to schedule the build id computation.
        * layout.cc (Hash_task::Hash_task): Remove build_id_blocker,
        add Output_file and offset.
        (Hash_task::run): Get and release the input views.
        (Hash_task::is_runnable): Always return NULL (always runnable).
        (Layout::queue_build_id_tasks): Remove.
        (Layout::write_build_id): Add array_of_hashes and size_of_hashes
        parameters; use them instead of class members.
        (Build_id_task_runner::run): New function.
        (Close_task_runner::run): Pass array_of_hashes and size_of_hashes
        to write_build_id.
        * layout.h (Layout::queue_build_id_tasks): Remove.
        (Layout::write_build_id): Add array_of_hashes and size_of_hashes
        parameters.
        (Layout::array_of_hashes_): Remove.
        (Layout::size_of_array_of_hashes_): Remove.
        (Layout::input_view_): Remove.
        (Build_id_task_runner): New class.
        (Close_task_runner::Close_task_runner): Add array_of_hashes and
        size_of_hashes parameters.
        (Close_task_runner::array_of_hashes_): New data member.
        (Close_task_runner::size_of_hashes_): New data member.
        * testsuite/Makefile.am
        (flagstest_compress_debug_sections_and_build_id_tree): New test.
        * testsuite/Makefile.in: Regenerate.
2015-06-02 09:46:10 -07:00
Rafael Ávila de Espíndola 400f89447b Use a std::vector instead of a std::map to hold Input_merge_map.
A std::map is hardly the best data structure for a small map from small
integers.
2015-06-01 22:47:20 -04:00
Alan Modra bbec1a5db7 [GOLD] Add PowerPC64 -fsplit-stack support
PowerPC64 ELFv1 requires a tweak to find_functions in order to return
code addresses, rather than OPD entry addresses.

	* reloc.cc (Sized_relobj_file::find_functions): Use function_location.
	* powerpc.cc (Target_powerpc::do_calls_non_split): New function.
	(addi_12_1, addis_2_12, addis_12_1, cmpld_7_12_0): New constants.
	(lis_0): Rename from lis_0_0.
2015-05-16 22:49:57 +09:30
Cary Coutant efc6fa128f Change Section_id type to use Relobj* instead of Object*.
2015-04-29  Cary Coutant  <cary@google.com>
	    Rafael Ávila de Espíndola <rafael.espindola@gmail.com>

gold/
	* gc.h (Garbage_collection::is_section_garbage): Change Object*
	to Relobj*.
	(Garbage_collection::add_reference): Likewise.
	(Garbage_collection::gc_process_relocs): Likewise. Don't push
	object/shndx pair onto *secvec for dynamic objects. Don't follow
	relocations pointing to dynamic objects for GC.
	* icf.cc (Icf::find_identical_sections): Change Object* to Relobj*.
	(Icf::unfold_section): Likewise.
	(Icf::is_section_folded): Likewise.
	(Icf::get_folded_section): Likewise.
	* icf.h: (Icf::get_folded_section): Likewise.
	(Icf::unfold_section): Likewise.
	(Icf::is_section_folded): Likewise.
	(Icf::section_has_function_pointers): Likewise.
	(Icf::set_section_has_function_pointers): Likewise.
	* object.h (Section_id): Likewise.
	(Const_section_id): Likewise.
	* output.cc (Output_section::update_section_layout): Likewise.
	* output.h: (Output_section_lookup_maps::find_relaxed_input_section):
	Likewise.
	* plugin.cc (update_section_order): Likewise.
	(unique_segment_for_sections): Likewise.
	* powerpc.cc (Powerpc_relobj::add_reference): Likewise.
	(Target_powerpc::do_gc_add_reference): Likewise.
	(Target_powerpc::gc_process_relocs): Likewise.
	(Target_powerpc::do_gc_add_reference): Likewise.
	* symtab.cc (Symbol_table::is_section_folded): Likewise.
	(Symbol_table::gc_mark_symbol): Likewise.
	* symtab.h: (Symbol_table::is_section_folded): Likewise.
	* target.h: (Sized_target::gc_add_reference): Likewise.
	(Sized_target::do_gc_add_reference): Likewise.
2015-05-02 08:43:27 -07:00
Nick Clifton f9d3ecaa78 Updated translations for various binutils components.
gold	* po/fi.po: Updated Finnish translation.

opcodes	* po/fr.po: Updated French translation.

gprof	* po/da.po: Update Danish translation.
2015-04-29 16:26:14 +01:00
Alan Modra faa2211d4d Tidy PowerPC gold find_global_entry uses
Completely removing the assert probably wasn't the best idea, so
reinstate it for allocated sections.  Also cope with debug info
potentially referring to a missing plt call stub.

And a tidy.  find_global_entry now returns an Address, so make temps
holding the return value of type Address, and compare against
invalid_address.

	* powerpc.cc (Target_powerpc::do_dynsym_value): Use Address rather
	than unsigned int for find_global_entry result temp.  Compare
	against invalid_address.
	(Target_powerpc::do_plt_address_for_global): Likewise.
	(Target_powerpc::Relocate::relocate): Likewise.  Don't assert
	on plt call stub existence for debug info.  Do assert for plt
	and global entry stub existence if an alloc section.
2015-04-28 16:55:38 +09:30
Alan Modra 6ec65f28db PowerPC gold assertion on missing global entry stub
Global entry stubs are used on ELFv2 to provide addresses for
functions not defined in a non-PIC executable but whose address is
taken, in much the same way as PLT stub code is used on other
targets to provide function addresses.  We don't want to insert a
global entry stub just because (bogus) debug info refers to the
address of a non-local function, but we also don't want gold to die.

	* powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert
	on missing global entry stub due to bogus debug info.
2015-04-28 13:38:56 +09:30
Han Shen 7a2a1c7935 [gold] Rename '--fix-cortex-a53' to '--fix-cortex-a53-843419'.
Keep gold consistent with bfd erratum-fixing option names, so as to
ease life in Makefile/scripts.

gold/

	* options.h (--fix-cortex-a53-843419): Rename option.
	* aarch64.cc (AArch64_relobj::do_count_local_symbols): Use renamed
	option.
	(AArch64_relobj::scan_sections_for_stubs): Use renamed option.
2015-04-27 15:49:41 -07:00
Rafael Ávila de Espíndola cfbf0e3c5b If a range is missing, assume the input address is mapped.
When Output_section::is_input_address_mapped is called we have entries for
all dropped ranges, but not for all ranges.
2015-04-27 14:35:17 -04:00
Sriraman Tallam a100d66fb4 Add option --weak-unresolved-symbols to treat unresolved symbols as weak ref.
This patch adds option --weak-unresolved-symbols to treat unresolved symbols as
weak references.  This is helpful when we want the link to succeed with unresolved
symbols and the dynamic loader to not complain at run-time.  Option
--warn-unresolved-symbols lets the link succeed but could fail at run-time with
unresolved symbol warnings especially when the unresolved symbols have GOT entries
and dynamic relocations against them, like when -fPIE is used.
2015-04-23 13:56:40 -07:00
Sriraman Tallam 65eb8c79be Add option --weak-unresolved-symbols to treat unresolved as weak references.
This patch adds option --weak-unresolved-symbols to treat unresolved symbols as
weak references.  This is helpful when we want the link to succeed with unresolved
symbols and the dynamic loader to not complain at run-time.  Option
--warn-unresolved-symbols lets the link succeed but could fail at run-time with
unresolved symbol warnings especially when the unresolved symbols have GOT entries
and dynamic relocations against them, like when -fPIE is used.

2015-04-23  Sriraman Tallam  <tmsriram@google.com>
	* options.h (--weak-unresolved-symbols): New option.
	* symtab.cc (Symbol_table::sized_write_globals): Change symbol
	binding to weak with new option.
	* symtab.h (is_weak_undefined): Check for new option.
	(is_strong_undefined): Check for new option.
	* testsuite/Makefile.am (weak_unresolved_symbols_test): New test.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/weak_unresolved_symbols_test.cc: New file.
2015-04-23 13:50:48 -07:00
Ian Coolidge 4b889c3013 Ensure that dynamically loaded libraries won't use separate copies of GNU_UNIQUE symbols.
gold/
	* symtab.cc (Symbol::should_add_dynsym_entry): Return true for
	GNU_UNIQUE.
2015-04-20 18:07:49 -07:00
Rafael Ávila de Espíndola 4277535cdc Use LIFO instead of FIFO to implement gc's transitive closure.
FIFO is harder to implement and has less locality than LIFO. It is
also not necessary to implement a transitive closure, a LIFO works
just as well.
2015-04-17 11:51:36 -04:00
Han Shen 5019d64a1f [gold] The first patch to address cortex-a53 erratum-843419.
It implemented scanning the binary and reporting occurrences to users
when '--fix-cortex-a53' is turned on. With this, gold users will be
able to see if or not there are such erratum occurrences in the output
binary. Also included in the CL is reading/recording mapping symbols,
which is needed during scan.

gold/ChangeLog:
    * aarch64.cc (AArch64_insn_utilities): New utility class.
    (AArch64_relobj::Mapping_symbol_position): New struct.
    (AArch64_relobj::Mapping_symbol_info): New typedef.
    (AArch64_relobj::do_count_local_symbols): New function overriding
    parent's implementation.
    (AArch64_relobj::mapping_symbol_info_): New member
    (AArch64_relobj::scan_erratum_843419): New method.
    (Target_aarch64::scan_erratum_843419_span): New method.
    (Target_aarch64::is_erratum_843419_sequence): New method.
    * options.h (fix_cortex_a53): New option.
2015-04-16 15:26:34 -07:00
Cary Coutant a6a177507c Allow gold to resolve defined TLS symbols in a PIE link.
This patch fixes Symbol::final_value_is_known so that a defined TLS symbol
in a PIE link is treated as having a known final value, thus allowing
GD->LE TLS optimization, eliminating an unnecessary GOT entry and dynamic
relocation.

gold/
	* symtab.cc (Symbol::final_value_is_known): Check for TLS symbol
	in a PIE link.
	* testsuite/Makefile.am (tls_pie_test.sh): New test.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/tls_pie_test.sh: New.
2015-04-09 15:47:37 -07:00
Cary Coutant 437ddf0c4c Improve ODR checking in gold.
gold/
	* debug.h (DEBUG_LOCATION): New.
	(DEBUG_ALL): Include DEBUG_LOCATION.
	(debug_string_to_enum): Add DEBUG_LOCATION.
	* dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
	output to print correct context.
	(Sized_dwarf_line_info::do_addr2line): Add debug output. Return
	up to 4 more locations at the beginning of the function.
	* symtab.cc (Symbol_table::detect_odr_violations): Get canonical
	result before sorting list of line numbers.
	* testsuite/debug_msg.sh: Allow range of line numbers for
	canonical results on optimized code.
2015-04-09 11:53:01 -07:00
Han Shen 2449132744 Add AArch32 support for arm gold linker. 2015-04-07 17:21:27 -07:00
Rafael Ávila de Espíndola 7fa5525f8e Fix the signature of a virtual method to match the one in the parent class. 2015-04-06 15:49:50 -04:00
Rafael Ávila de Espíndola 5368dcf2ba Avoid a call to find by using the return value of insert. 2015-04-06 15:46:30 -04:00
Rafael Ávila de Espíndola 9dbb4b021d Avoid a copy constructor call. 2015-04-06 15:39:42 -04:00
Ilya Tocar 1fa29f1060 [Gold,x86_64] Convert mov foo@GOTPCREL(%rip), %reg to lea foo(%rip), %reg
2015-04-06  Ilya Tocar  <ilya.tocar@intel.com>

	PR gold/17641
	* x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
	(Target_x86_64::Scan::local): Don't create GOT entry, when we
	can convert mov to lea.
	(Target_x86_64::Scan::global): Ditto.
	(Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
	%reg to lea foo(%rip), %reg if possible.
	* testsuite/Makefile.am (x86_64_mov_to_lea): New test.
	* testsuite/x86_64_mov_to_lea1.s: New.
	* testsuite/x86_64_mov_to_lea2.s: Ditto.
	* testsuite/x86_64_mov_to_lea3.s: Ditto.
	* testsuite/x86_64_mov_to_lea4.s: Ditto.
	* testsuite/x86_64_mov_to_lea.sh: Ditto.
---
2015-04-06 12:37:34 +03:00
H.J. Lu 39f3de7c43 Regenerate configure in bfd/binutils/gas/gdb/gold
bfd/

	* configure: Regenerated.

binutils/

	* configure: Regenerated.

gas/

	* configure: Regenerated.

gdb/

	* Makefile.in (top_srcdir): New.
	* configure: Regenerated.

gold/

	* configure: Regenerated.
2015-04-02 05:45:03 -07:00
Ilya Tocar c4fc4724a6 Convert mov foo@GOT(%reg), %reg to lea foo@GOTOFF(%reg), %reg
2015-04-01  Ilya Tocar  <ilya.tocar@intel.com>

	PR gold/17640
	* i386.cc (Target_i386::can_convert_mov_to_lea): New.
	(Target_i386::Scan::local): Don't create GOT entry, when we
	can convert GOT to GOTOFF.
	(Target_i386::Scan::global): Ditto.
	(Target_i386::Relocate::relocate): Convert  mov foo@GOT(%reg), %reg to
	lea foo@GOTOFF(%reg), %reg if possible.
	* testsuite/Makefile.am (i386_mov_to_lea): New test.
	* testsuite/i386_mov_to_lea1.s: New.
	* testsuite/i386_mov_to_lea2.s: Ditto.
	* testsuite/i386_mov_to_lea3.s: Ditto.
	* testsuite/i386_mov_to_lea4.s: Ditto.
	* testsuite/i386_mov_to_lea5.s: Ditto.
	* testsuite/i386_mov_to_lea.sh: Ditto.
2015-04-01 16:52:09 +03:00
H.J. Lu 918357b955 Regenerate configure in gold
Regenerate configure for zlib.m4 change, which adds --with-system-zlib and
removes --with-zlib in gold.  zlib is enabled unconditionally with builtin
zlib imported from GCC.

	* Makefile.am (ZLIB): New.
	(ZLIBINC): Likewise.
	(AM_CFLAGS): Add $(ZLIBINC).
	(AM_CXXFLAGS): Likewise.
	(ldadd_varldadd_var): Add $(ZLIB).
	(incremental_dump_LDADD): Likewise.
	(dwp_LDADD): Likewise.
	* compressed_output.cc: Don't check HAVE_ZLIB_H to include
	<zlib.h>.
	(zlib_compress): Don't check HAVE_ZLIB_H.
	(zlib_decompress): Likewise.
	* options.h (compress_debug_sections): Likewise.
	* configure.ac (AM_CONDITIONAL): Removed.
	* testsuite/Makefile.am (ZLIB): New.
	(LDADD): Add $(ZLIB).
	Don't check HAVE_ZLIB.
	* Makefile.in: Regenerated.
	* config.in: Likewise.
	* configure: Likewise.
	* testsuite/Makefile.in: Likewise.
2015-04-01 06:40:35 -07:00
Jing Yu 6b0ad2ebf6 Support AARCH64_TLSLD_ADD_DTPREL_* relocations.
Also Change _TLS_MODULE_BASE_. Always let it point to the start
of TLS segment.

2015-03-28  Jing Yu  <jingyu@google.com>

	* aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
	TLSLD_ADD_DTPREL_LO12_NC.
	* aarch64.cc (Target_aarch64::define_tls_base_symbol): Always
	let _TLS_MODULE_BASE_ point to the start of tls segment.
	(Target_aarch64::optimize_tls_reloc): Add cases for
	R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
	R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
	(Target_aarch64::Scan::local): Likewise.
	(Target_aarch64::Scan::global): Likewise.
	(Target_aarch64::Relocate::relocate): Likewise.
	(Target_aarch64::Relocate::relocate_tls): Likewise. And remove
	subtracting tls segment size from symbol value for
	TLSLD_*_DTPREL relocations.
2015-03-30 14:11:48 -07:00
Rafael Ávila de Espíndola 0916f9e741 Avoid looking up Input_merge_map multiple times.
Avoid looking up Input_merge_map multiple times when we know were are
processing items from the same input section.
2015-03-27 09:51:15 -04:00
Alan Modra 282c975030 PR18147, relocation overflow when --unresolved-symbols=ignore-all
If ignoring unresolved symbols, ignore reloc overflows too.  If not
ignoring unresolved symbols we will report an error about the symbol
being undefined, making any report about reloc overflow superfluous.

	PR18147
	* powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
	relocation errors for branches to strong undefined symbols.
2015-03-24 17:06:12 +10:30
Rafael Ávila de Espíndola 67f95b96b4 Remove is_merge_section_for.
Now that Input_merge_map has an Output_section_data, we can use it in
implementing find_merge_section and replace the only use of is_merge_section_for
with it.
2015-03-23 09:16:49 -04:00
Cary Coutant 152f702439 Fix support for i386 TLS GD-to-IE optimization.
There are two cases to support, one with an SIB-form (6-byte) LEA,
the other with a 5-byte LEA and a NOP after the call __tls_get_addr.
Gold did not yet support the second case. This patch adds that
support.

gold/
	PR gold/18106
	* i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
	non-SIB form of lea, with nop after the call.
2015-03-22 11:59:21 -07:00
Cary Coutant bccffdfdf2 Fix internal error with -z relro when .tbss is last relro section.
When calculating the padding necessary to align the end of the relro
segment to a page boundary, gold erroneously ignores the .tdata section
when checking to see if there are any relro sections (so if .tdata
is the only relro section, we fail to align the segment properly),
and erroneously pads the cumulative size of the segment based on
the alignment of .tbss. If there are no relro sections following .tbss,
it then fails to note the padding needed at the end of .tdata.

This patch fixes both problems. is_first_section_relro() will return
true when it sees a .tdata section, and we do not align the cumulative
size until after checking for the .tbss section.

gold/
	PR gold/14217
	* output.cc (Output_segment::is_first_section_relro): Don't ignore
	.tdata section.
	(Output_segment::set_section_addresses): Don't align size of relro
	segment for .tbss.
2015-03-21 22:30:44 -07:00
Cary Coutant 1c582fe718 Fix bug when optimizing string pools of aligned strings.
Tail optimization of string pools (enabled when linker is run with -O2
or greater) should not be done when the section alignment is greater
than the size of the characters in the strings; otherwise, unaligned
strings may result.

gold/
	PR gold/18010
	* stringpool.cc (Stringpool_template): Don't optimize if section
	alignment is greater than sizeof(char).
2015-03-21 21:09:46 -07:00
Cary Coutant 410da591ba PR gold/18048: Fix INCLUDE directive support for gold
This patch fixes INCLUDE directives in script files, so that when
an INCLUDE appears inside a sections block, section commands block,
or memory def block, the contents are parsed in the appropriate
context.

gold/
	PR gold/18048
	* script-c.h (script_include_directive): Add first_token parameter.
	* script.cc (script_include_directive): Add first_token parameter, and
	pass it to read_script_file.
	* yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
	(PARSING_MEMORY_DEF): New tokens.
	(top): Add new productions for INCLUDE files.
	(file_cmd): Replace file_or_sections_cmd with copy of its productions.
	Pass PARSING_LINKER_SCRIPT to script_include_directive.
	(section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
	(section_cmd): Pass PARSING_SECTION_CMDS.
	(file_or_sections_cmd): Remove.
	(memory_def): Pass PARSING_MEMORY_DEF.
	* testsuite/Makefile.am (memory_test_2): New test.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/memory_test_inc.t: New script file.
	* testsuite/memory_test_inc_1.t.src: New script file.
	* testsuite/memory_test_inc_2.t.src: New script file.
	* testsuite/memory_test_inc_3.t.src: New script file.
2015-03-21 19:54:15 -07:00
Cary Coutant 0d5bbdb0e1 Support compressed debug sections in dynamic object files.
This patch adds support for reading compressed debug info in
shared objects. It actually simplifies things, by moving the
support for compressed sections all the way up to the top-level
Object class, eliminating the need for several virtual methods.

gold/
	* dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
	(Sized_relobj_dwo::setup): Build compressed section map.
	(Sized_relobj_dwo::do_decompressed_section_contents): Delete.
	* dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
	section map.
	* object.cc (Sized_relobj_file::Sized_relobj_file): Remove
	compressed_sections_ field.
	(build_compressed_section_map): Take Object instead of
	Sized_relobj_file parameter; add decompress_if_needed parameter.
	(Sized_relobj_file::do_find_special_sections): Store compressed
	section map in parent Object.
	(Sized_relobj_file::do_decompressed_section_contents): Move
	implementation to Object::decompressed_section_contents.
	(Sized_relobj_file::do_discard_decompressed_sections): Move
	implementation to Object::discard_decompressed_sections.
	* object.h (build_compressed_section_map): Declare.
	(Object::Object): Add compressed_sections_ field.
	(Object::section_is_compressed): Move implementation here.
	(Object::decompressed_section_contents): De-virtualize.
	(Object::discard_decompressed_sections): De-virtualize.
	(Object::do_section_is_compressed): Delete.
	(Object::do_decompressed_section_contents): Delete.
	(Object::set_compressed_sections): New method.
	(Object::compressed_sections): New method.
	(Object::compressed_sections_): New data member.
	(Compressed_section_info, Compressed_section_map): Move to top of file.
	(Sized_relobj_file::do_section_is_compressed): Delete.
	(Sized_relobj_file::do_decompressed_section_contents): Delete.
	(Sized_relobj_file::do_discard_decompressed_sections): Delete.
	(Sized_relobj_file::compressed_sections_): Move to Object class.
2015-03-21 18:50:11 -07:00
Cary Coutant bd9e0d4628 Fix internal error in do_relocate_sections when using plugins.
In a previous patch for PR 14675, to fix a problem with
the .eh_frame section when static linking, I added a step to
finalize the .eh_frame section at the end of the first link
pass. This patch caused PR 18152, where a plugin-claimed
object caused a non-claimed object's layout to be deferred
until replacement files were read. The call to
finalize_eh_frame_section() is happening before the layout of
the deferred objects, leading to the internal error in
do_relocate_sections.

This patch moves the finalization of the .eh_frame section to
after deferred objects have been processed.

gold/
	PR gold/14675
	PR gold/18152
	* gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
	deferred objects.
2015-03-21 17:49:21 -07:00
Cary Coutant 943c8b4393 Fix gold incremental test failures.
Newer version of GCC pass -z relro to the linker, but incremental linking
does not support relro. This patch adds a check to complain about the
conflict, and changes the testsuite to pass -z norelro to the incremental
tests.

2015-03-11  Cary Coutant  <ccoutant@google.com>

gold/
	* options.cc (General_options::finalize): Don't allow -z relro
	with incremental linking.
	* testsuite/Makefile.am (incremental_test): Add -z norelro.
	(incremental_test_2): Likewise.
	(incremental_test_3): Likewise.
	(incremental_test_4): Likewise.
	(incremental_test_5): Likewise.
	(incremental_test_6): Likewise.
	(incremental_copy_test): Likewise.
	(incremental_common_test_1): Likewise.
	(incremental_comdat_test_1): Likewise.
	* testsuite/Makefile.in: Regenerate.
2015-03-11 22:07:51 -07:00
Cary Coutant e16631979e Fix failure in exception_static_test.
Because the __EH_FRAME_BEGIN__ symbol is provided in an empty .eh_frame
section in crtbeginT.o, if crt1.o has a non-empty .eh_frame section,
we place all optimized .eh_frame sections into the output section ahead
of the __EH_FRAME_BEGIN__ symbol, which breaks EH for statically-linked
binaries.

This patch fixes the problem by delaying the attachment of the optimized
.eh_frame sections to the output section until we see the end marker
section (or to the end of pass 1 if we never see an end marker).

gold/
	PR gold/14675
	* ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
	return enum indicating whether .eh_frame section is empty, optimizable,
	unrecognized, or an end marker. Adjust explicit instantiations.
	* ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
	(Eh_frame::add_ehframe_input_section): Change return type.
	* gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
	* layout.cc (Layout::layout_eh_frame): Don't add optimized sections
	to the .eh_frame output section until we see the end marker.
	(Layout::finalize_eh_frame_section): New.
	* layout.h: (Layout::finalize_eh_frame_section): New.
2015-03-09 10:12:06 -07:00
H.J. Lu beb8418f47 Remove typename on elfcpp::Elf_types<size>::Elf_Addr
GCC 4.2 complains:

binutils/gold/object.cc:3261: error: using ‘typename’ outside of template

This patch removes typename.  It works with both GCC 4.2 and 4.8.

	* output.cc (Relobj::initialize_input_to_output_map<size>):
	Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
2015-03-05 07:52:41 -08:00
Cary Coutant 48c734280a Fix a race condition when setting default target for ARM targets.
gold/
	* parameters.cc (Parameters::set_target_once): Call
	Target::select_as_default_target just once from here...
	(set_parameters_target): ...instead of from here.
2015-03-04 15:17:23 -08:00
Rafael Ávila de Espíndola dbe40a8891 Remove empty class Merge_map.
2015-03-02  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>

	* ehframe.cc (Cie::set_output_offset): Pass in and use a
	Output_section_data instead of a Merge_map.
	(Eh_frame::Eh_frame): Don't initialize merge_map_.
	(Eh_frame::read_cie): Use add_merge_mapping instead of
	Merge_map::add_mapping.
	(Eh_frame::read_fde): Ditto.
	(Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
	(Eh_frame::do_output_offset): Use merge_output_offset istead of
	merge_map_->get_output_offset.
	(Eh_frame::do_is_merge_section_for): Delete.
	* ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
	instead of a Merge_map.
	(Cie::set_output_offset): Pass in a Output_section_data instead of a
	Merge_map.
	(Eh_frame::do_is_merge_section_for): Delete.
	(Eh_frame::merge_map_): Delete.
	* merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
	and use a Output_section_data instead of a Merge_map.
	(Object_merge_map::add_mapping): Ditto.
	(Object_merge_map::get_output_offset): Remove the merge_map argument.
	(Object_merge_map::is_merge_section_for): Pass in and use a
	Output_section_data instead of a Merge_map.
	(Merge_map): Delete.
	(Output_merge_base::do_output_offset): Use merge_output_offset instead
	of merge_map_.get_output_offset.
	(Output_merge_base::do_is_merge_section_for): Delete.
	(Output_merge_data::do_add_input_section): Use
	object->add_merge_mapping instead of add_mapping.
	(Output_merge_string<Char_type>::finalize_merged_data): Ditto.
	* merge.h (Merge_map): Delete forward declaration.
	(Object_merge_map::add_mapping): Pass in and use a Output_section_data
	instead of a Merge_map.
	(Object_merge_map::get_output_offset): Remove the merge_map argument.
	(Object_merge_map::is_merge_section_for): Pass in and use a
	Output_section_data instead of a Merge_map.
	(Input_merge_map::Object_merge_map::merge_map): Replace with
	output_data.
	(Object_merge_map::get_or_make_input_merge_map): Pass in and use a
	Output_section_data instead of a Merge_map.
	(Merge_map): Delete.
	(Output_merge_base::Output_merge_base): Don't initialize merge_map_.
	(Output_merge_base::do_is_merge_section_for): Delete.
	(Output_merge_base::add_mapping): Delete.
	(Output_merge_base::merge_map_): Delete.
	* object.cc (Relobj::initialize_input_to_output_map): New.
	(Relobj::initialize_input_to_output_map): New.
	(Relobj::merge_output_offset): New.
	(Relobj::is_merge_section_for): New.
	(Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
	bits.
	* object.h (Relobj::merge_map): Delete.
	(initialize_input_to_output_map): New.
	(set_merge_map): Delete.
	(add_merge_mapping): New.
	(merge_output_offset): New.
	(is_merge_section_for): New.
	* output.cc (Output_section::Input_section::is_merge_section_for):
	Use object->is_merge_section_for.
	* output.h (Output_section_data::is_merge_section_for): Delete.
	(Output_section_data::do_is_merge_section_for): Delete.
	* reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
	Use object->initialize_input_to_output_map.
	(Merged_symbol_value<size>::value_from_output_section): Use
	object->merge_output_offset.
2015-03-04 15:10:18 -08:00
Cary Coutant 2c7b626cee Fix crash when processing merge section with entsize of 0.
2015-02-04  Peter Collingbourne  <pcc@google.com>
            Cary Coutant  <ccoutant@google.com>

gold/
	* output.cc (Output_section::add_merge_input_section): Do not
	attempt to merge sections with an entsize of 0.
2015-03-02 10:20:21 -08:00
Cary Coutant 5b07cd848d Fix an internal error in do_print_to_mapfile on Arm.
2015-02-02  Khem Raj  <raj.khem@gmail.com>

gold/
	* attributes.h (class Output_attributes_section_data ): Add
	do_print_to_mapfile function.
2015-03-02 10:10:52 -08:00
Alan Modra ec86f43468 PowerPC64 GOLD: complain on misaligned _DS relocs
PR 18010
	* powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
	complain if value is not a multiple of four.
	(Target_powerpc::Relocate::relocate): Correct handling of
	R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
2015-02-24 18:21:39 +10:30
H.J. Lu be66981e16 Set GOLD_DEFAULT_SIZE to 32 for x32
* configure.ac (default_size): Set to 32 for x32.
	* configure: Regenerated.
2015-02-22 12:26:27 -08:00
Alan Modra e3ee8ed41b Fix gold error: hidden symbol '...' is not defined locally
Found when applying relocs in .debug that reference removed functions.

	PR 17954
	* powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
	visibility.
2015-02-18 22:51:14 +10:30
Rafael Ávila de Espíndola 3a935c6cf9 Simplify Garbage_collection::add_reference a bit.
this->section_reloc_map_[src_id] is created if it doesn't exist, so there
is no point in doing a find.
2015-02-17 10:49:41 -05:00
Rafael Ávila de Espíndola e0a1e121b3 avoid std::vector copy. 2015-02-17 10:47:02 -05:00
Rafael Ávila de Espíndola 45a4fb1a70 Use std::upper_bound to simplify code a bit.
With std::upper_bound we don't have to check p->input_offset > input_offset.
2015-02-17 10:44:37 -05:00
Mark Wielaard 2d9afefe22 [gold] Recognize DWARF5/GCC5 DW_LANG_Fortran03 and DW_LANG_Fortran08.
DWARFv5 defines and GCC5 may output two new DW_LANG constants for the
Fortran 2003 and Fortran 2008 standards. Recognize both in gold gdb-index
as unsupported.

For consistency also add the other new DWARF5/GCC5 language constants in
the elfcpp::DW_LANG enum to match include/dwarf2.h.

elfcpp/ChangeLog:

	* dwarf.h (enum DW_LANG): Add DW_LANG_C_plus_plus_11,
	DW_LANG_C11, DW_LANG_C_plus_plus_14, DW_LANG_Fortran03 and
	DW_LANG_Fortran08 from ../include/dwarf2.h.

gold/ChangeLog:

	* gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
	DW_LANG_Fortran03 and DW_LANG_Fortran08.
2015-02-17 08:08:24 +01:00
Cary Coutant e9c1bdad26 Fix --dynamic-list so that symbols not in the list are still exported.
In PR 13577, the complaint was that -Bsymbolic was overriding the binding
behavior for symbols listed in the --dynamic-list by setting the DT_SYMBOLIC
tag in the dynamic table. In reading the Gnu ld manual, I decided that
--dynamic-list should be mutually exclusive of -Bsymbolic, and modified
gold so that --dynamic-list would treat symbols listed as preemptible,
and all other symbols as internally bound. I was wrong.

PR 16992 shows that with --dynamic-list (and not -Bsymbolic), a symbol
not listed in the dynamic list is being internally bound within the
shared library, but because it's still in the dynamic symbol table, we
expose it to a COPY relocation, and things go really bad from there.

(I can reproduce the same failure, simply by turning on -Bsymbolic-functions
with the Gnu linker. Even though the symbol is bound internally, it's
still exported to the dynamic symbol table, and is exposed to a COPY
relocation.)

I've backed out part of the fix for PR 13577, and -Bsymbolic (or
-Bsymbolic-functions) can now be used with --dynamic-list, but if the
two are used together, we do not set DT_SYMBOLIC or DF_SYMBOLIC
(this matches Gnu ld behavior). We now treat symbols listed in the
dynamic list as premptible, but we do not automatically treat symbols
not listed there as non-premptible.

gold/
	PR gold/13577
	PR gold/16992
	* layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
	DF_SYMBOLIC if --dynamic-list option is used.
	* options.cc (General_options::finalize): --dynamic-list is not
	mutually exclusive with -Bsymbolic.
	* symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
	listed in --dynamic-list.
	* testsuite/Makefile.am (dynamic_list_lib2.so): Add
	-Bsymbolic-functions.
	* testsuite/Makefile.in: Regenerate.
2015-02-16 22:15:12 -08:00
Cary Coutant 0ed4b0bf3d Remove redundant include of "output.h".
gold/
	PR gold/17971
	* incremental.cc: Remove redundant include of "output.h".
2015-02-16 20:15:07 -08:00
Jing Yu 1a920511af Add missing TLSLE relocations for gold aarch64 backend.
gold/ChangeLog:
	* aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
	TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
	New relocation.
	* aarch64.cc (Target_aarch64::Scan::local): Add cases for new
	TLSLE_MOVW_* relocations.
	(Target_aarch64::Scan::global): Likewise.
	(Target_aarch64::Relocate::relocate): Likewise.
	(Target_aarch64::Relocate::relocate_tls): Add cases and handlings
	for new TLSLE_MOVW_* relocations.
2015-02-12 14:51:57 -08:00
Will Newton 07f107f306 gold/arm.cc: Output mapping symbol for PLT code
Output an ARM state mapping symbol at the start of the PLT. With the
current code objdump will fail to disassemble the PLT that gold
creates.

gold/ChangeLog:

2015-02-11  Will Newton  <will.newton@linaro.org>

	PR gold/13321
	* arm.cc (Target_arm::make_plt_section): Create an ARM
	state mapping symbol at the start of the PLT.
2015-02-11 15:18:59 +08:00
H.J. Lu e051a5b512 Replace two_file_shared_2.so with two_file_shared_1.so
There are

two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so

There should be two_file_shared_1.so, not two_file_shared_2.so in
two_file_shared_2_pic_1_test_DEPENDENCIES.

	* testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
	Replace two_file_shared_2.so with two_file_shared_1.so.
	* testsuite/Makefile.in: Regenerated.
2015-02-09 05:36:02 -08:00
Alan Modra dddcc5b9a8 Gold testsuite make clean
* testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
	plugin_test_thin.a and defsym_test.
	* testsuite/Makefile.in: Regenerate.
2015-02-09 13:19:53 +10:30
Rafael Ávila de Espíndola b39b8b9d90 Combine loop epilogue into main loop body to reduce duplication. 2015-02-04 17:37:05 -05:00
Cary Coutant b66d1c52ac Add missing ChangeLog entry. 2015-02-04 10:36:25 -08:00
Peter Collingbourne 3c537f7fdb Resolve forwarding symbols in plugins.
2015-02-04  Peter Collingbourne  <pcc@google.com>

	* plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
	forwarding symbols when computing symbol resolution info for plugins.
2015-02-04 09:48:22 -08:00
Cary Coutant 23081de018 Add missing ChangeLog entries. 2015-02-03 20:18:25 -08:00
Cary Coutant 2cfbf2fece Fix a file descriptor leak in gold.
When an LTO linker plugin claims an external member of a thin archive, gold
does not properly unlock the file and make its file descriptor available for
reuse. This patch fixes the problem by modifying Archive::include_member to
unlock the object file via an RAII class instance, ensuring that it will be
unlocked no matter what path is taken through the function.

gold/
	PR gold/15660
	* archive.cc (Thin_archive_object_unlocker): New class.
	(Archive::include_member): Unlock external members of thin archives.
	* testsuite/Makefile.am (plugin_test_1): Rename .syms files.
	(plugin_test_2): Likewise.
	(plugin_test_3): Likewise.
	(plugin_test_4): Likewise.
	(plugin_test_5): Likewise.
	(plugin_test_6): Likewise.
	(plugin_test_7): Likewise.
	(plugin_test_8): Likewise.
	(plugin_test_9): Likewise.
	(plugin_test_10): Likewise.
	(plugin_test_11): New test case.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
	file to decide whether to claim file.
	(all_symbols_read_hook): Likewise.
	* testsuite/plugin_test_1.sh: Adjust expected output.
	* testsuite/plugin_test_2.sh: Likewise.
	* testsuite/plugin_test_3.sh: Likewise.
	* testsuite/plugin_test_6.sh: Likewise.
	* testsuite/plugin_test_tls.sh: Likewise.
	* testsuite/plugin_test_11.sh: New testcase.
2015-02-03 20:03:42 -08:00
Cary Coutant 8265ef9502 Add extra debugging output for files and descriptors.
gold/
	* descriptors.cc (Descriptors::open): Set artificially-low limit for
	file descriptors when debugging enabled. Add debug output.
	(Descriptors::release): Add debug output.
	(Descriptors::close_some_descriptor): Likewise.
	(Descriptors::close_all): Likewise.
	* fileread.cc (File_read::lock): Likewise.
	(File_read::unlock): Likewise.
2015-02-03 20:03:41 -08:00
Cary Coutant 24dd580891 Fix bug with previous patch for unresolved TLS symbol.
We need to check that the output is executable before assuming that we
can replace the reference with zero.

2015-02-02  Cary Coutant  <ccoutant@google.com>

gold/
	* x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
	executable output file.
2015-02-02 11:46:45 -08:00