Commit Graph

5690 Commits

Author SHA1 Message Date
H.J. Lu e01c16a838 cris: Check UNDEFWEAK_NO_DYNAMIC_RELOC
Don't generate dynamic relocation against weak undefined symbol if it
is resolved to zero.  FIXME: UNDEFWEAK_NO_DYNAMIC_RELOC may need to be
checked in more places.

bfd/

	PR ld/22269
	* elf32-cris.c (cris_elf_relocate_section): Don't generate
	dynamic relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
	(cris_elf_check_relocs): Don't allocate dynamic relocation
	if UNDEFWEAK_NO_DYNAMIC_RELOC is true.

ld/

	PR ld/22269
	* testsuite/ld-cris/weakhiddso.d: Update and remove R_CRIS_NONE.
2017-10-14 11:09:44 -07:00
Alan Modra 354bac403e PR22263 testcase
A number of targets need dynamic relocs in PIEs for reasons other than
relocating thread variables.  The PR is about text relocations, and,
reading between the lines, unnecessary dynamic tprel relocations.
Change the test to check for those conditions rather than no dynamic
relocations

	PR ld/22263
	* testsuite/ld-elf/tls.exp: Link with -z text.
	* testsuite/ld-elf/pr22263-1.rd: Test for tprel relocs.
2017-10-14 00:15:44 +10:30
H.J. Lu 74ffa56673 Add a compile-time test for PR ld/22263
This compile-time test requires a target C compiler to run.  It fails
on many targets where ELF backend linkers incorrectly check bfd_link_pic
for TLS relocations, which should check bfd_link_executable instead.

	PR ld/22263
	* testsuite/ld-elf/pr22263-1.rd: New file.
	* testsuite/ld-elf/pr22263-1a.c: Likewise.
	* testsuite/ld-elf/pr22263-1b.c: Likewise.
	* testsuite/ld-elf/tls.exp: Likewise.
2017-10-12 14:55:01 -07:00
Alan Modra 6c19b93bcd ld whitespace fixes
* pe-dll.c: Formatting, whitespace fixes.
	* NEWS: Whitespace fixes.
	* configure.ac: Likewise.
	* configure.tgt: Likewise.
	* deffilep.y: Likewise.
	* genscripts.sh: Likewise.
	* ld.texinfo: Likewise.
	* ldgram.y: Likewise.
	* ldlang.c: Likewise.
	* ldlex.l: Likewise.
	* lexsup.c: Likewise.
	* plugin.c: Likewise.
	* emulparams/arc-endianness.sh: Likewise.
	* emulparams/elf32_x86_64.sh: Likewise.
	* emulparams/elf64mmix.sh: Likewise.
	* emulparams/elf_x86_64.sh: Likewise.
	* emulparams/h8300elf.sh: Likewise.
	* emulparams/h8300elf_linux.sh: Likewise.
	* emulparams/vxworks.sh: Likewise.
	* emultempl/aarch64elf.em: Likewise.
	* emultempl/aix.em: Likewise.
	* emultempl/armelf.em: Likewise.
	* emultempl/avrelf.em: Likewise.
	* emultempl/beos.em: Likewise.
	* emultempl/hppaelf.em: Likewise.
	* emultempl/m68kcoff.em: Likewise.
	* emultempl/m68kelf.em: Likewise.
	* emultempl/metagelf.em: Likewise.
	* emultempl/msp430.em: Likewise.
	* emultempl/nds32elf.em: Likewise.
	* emultempl/pe.em: Likewise.
	* emultempl/pep.em: Likewise.
	* emultempl/ppc64elf.em: Likewise.
	* emultempl/sh64elf.em: Likewise.
	* emultempl/spu_ovl.S: Likewise.
	* emultempl/spuelf.em: Likewise.
	* emultempl/tic6xdsbt.em: Likewise.
	* emultempl/ticoff.em: Likewise.
	* emultempl/vms.em: Likewise.
	* po/Make-in: Likewise.
	* scripttempl/DWARF.sc: Likewise.
	* scripttempl/aix.sc: Likewise.
	* scripttempl/alpha.sc: Likewise.
	* scripttempl/alphavms.sc: Likewise.
	* scripttempl/aout.sc: Likewise.
	* scripttempl/arclinux.sc: Likewise.
	* scripttempl/armaout.sc: Likewise.
	* scripttempl/armbpabi.sc: Likewise.
	* scripttempl/armcoff.sc: Likewise.
	* scripttempl/avr.sc: Likewise.
	* scripttempl/crisaout.sc: Likewise.
	* scripttempl/delta68.sc: Likewise.
	* scripttempl/dlx.sc: Likewise.
	* scripttempl/elf.sc: Likewise.
	* scripttempl/elf32cr16.sc: Likewise.
	* scripttempl/elf32cr16c.sc: Likewise.
	* scripttempl/elf32crx.sc: Likewise.
	* scripttempl/elf32msp430.sc: Likewise.
	* scripttempl/elf32msp430_3.sc: Likewise.
	* scripttempl/elf32sh-symbian.sc: Likewise.
	* scripttempl/elf32xc16x.sc: Likewise.
	* scripttempl/elf32xc16xl.sc: Likewise.
	* scripttempl/elf32xc16xs.sc: Likewise.
	* scripttempl/elf64hppa.sc: Likewise.
	* scripttempl/elf_chaos.sc: Likewise.
	* scripttempl/elfarc.sc: Likewise.
	* scripttempl/elfarcv2.sc: Likewise.
	* scripttempl/elfd10v.sc: Likewise.
	* scripttempl/elfd30v.sc: Likewise.
	* scripttempl/elfi370.sc: Likewise.
	* scripttempl/elfm68hc11.sc: Likewise.
	* scripttempl/elfm68hc12.sc: Likewise.
	* scripttempl/elfmicroblaze.sc: Likewise.
	* scripttempl/elfxgate.sc: Likewise.
	* scripttempl/elfxtensa.sc: Likewise.
	* scripttempl/epiphany_4x4.sc: Likewise.
	* scripttempl/epocpe.sc: Likewise.
	* scripttempl/h8300.sc: Likewise.
	* scripttempl/h8300h.sc: Likewise.
	* scripttempl/h8300hn.sc: Likewise.
	* scripttempl/h8300s.sc: Likewise.
	* scripttempl/h8300sn.sc: Likewise.
	* scripttempl/h8300sx.sc: Likewise.
	* scripttempl/h8300sxn.sc: Likewise.
	* scripttempl/h8500.sc: Likewise.
	* scripttempl/h8500b.sc: Likewise.
	* scripttempl/h8500c.sc: Likewise.
	* scripttempl/h8500m.sc: Likewise.
	* scripttempl/h8500s.sc: Likewise.
	* scripttempl/hppaelf.sc: Likewise.
	* scripttempl/i386beos.sc: Likewise.
	* scripttempl/i386coff.sc: Likewise.
	* scripttempl/i386go32.sc: Likewise.
	* scripttempl/i386msdos.sc: Likewise.
	* scripttempl/i860coff.sc: Likewise.
	* scripttempl/i960.sc: Likewise.
	* scripttempl/ia64vms.sc: Likewise.
	* scripttempl/ip2k.sc: Likewise.
	* scripttempl/iq2000.sc: Likewise.
	* scripttempl/m68kaux.sc: Likewise.
	* scripttempl/m68kcoff.sc: Likewise.
	* scripttempl/m88kbcs.sc: Likewise.
	* scripttempl/mcorepe.sc: Likewise.
	* scripttempl/mep.sc: Likewise.
	* scripttempl/mips.sc: Likewise.
	* scripttempl/mipsbsd.sc: Likewise.
	* scripttempl/mmo.sc: Likewise.
	* scripttempl/moxie.sc: Likewise.
	* scripttempl/nds32elf.sc: Likewise.
	* scripttempl/nw.sc: Likewise.
	* scripttempl/pe.sc: Likewise.
	* scripttempl/pep.sc: Likewise.
	* scripttempl/pj.sc: Likewise.
	* scripttempl/ppcpe.sc: Likewise.
	* scripttempl/psos.sc: Likewise.
	* scripttempl/riscix.sc: Likewise.
	* scripttempl/sh.sc: Likewise.
	* scripttempl/sparccoff.sc: Likewise.
	* scripttempl/st2000.sc: Likewise.
	* scripttempl/tic30aout.sc: Likewise.
	* scripttempl/tic30coff.sc: Likewise.
	* scripttempl/tic4xcoff.sc: Likewise.
	* scripttempl/tic54xcoff.sc: Likewise.
	* scripttempl/tic80coff.sc: Likewise.
	* scripttempl/v850.sc: Likewise.
	* scripttempl/v850_rh850.sc: Likewise.
	* scripttempl/vanilla.sc: Likewise.
	* scripttempl/visium.sc: Likewise.
	* scripttempl/w65.sc: Likewise.
	* scripttempl/xstormy16.sc: Likewise.
	* scripttempl/z80.sc: Likewise.
	* scripttempl/z8000.sc: Likewise.
	* configure: Regenerate.
2017-10-12 23:30:43 +10:30
Nick Clifton 1d75a8e26e Force the AArch64 linker backend to refuse to link when it encounters unresoleable relocations.
* reloc.c (enum bfd_reloc_status): Start values at 2.
	* bfd-in2.h: Regenerate.
	* elfnn-aarch64.c (aarch64_relocate): Invert sense of function, so
	that a TRUE return indicates success.  Compare the result of
	calling _bfd_aarch64_elf_put_addend against bfd_reloc_ok.
	(build_one_stub): Change sense of tests against aarch64_relocate
	return value.
	(elfNN_aarch64_tls_relax): Return bfd_reloc_notsupported, rather
	than FALSE, when an error is detected.
	(elfNN_aarch64_final_link_relocate): Likewise.

	* testsuite/ld-aarch64/pcrel_pic_defined.d: Expect errors not
	warnings.  Expect errors about unsupported relocations.
	* testsuite/ld-aarch64/pcrel_pic_undefined.d: Likewise.
2017-10-12 13:38:20 +01:00
H.J. Lu 359987e218 ld: Update tests for warning of "-z dynamic-undefined-weak ignored"
Update tests to expect warning of "-z dynamic-undefined-weak ignored"
from

commit 22b1ee183d
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Oct 12 13:19:10 2017 +1030

    Set dynamic_undefined_weak to zero for static PIEs

	* testsuite/ld-elf/pr22269b.d: Expect warning of
	"-z dynamic-undefined-weak ignored".
	* testsuite/ld-i386/pr19636-1j.d: Likewise.
	* testsuite/ld-i386/pr19636-1k.d: Likewise.
	* testsuite/ld-i386/pr19636-1l.d: Likewise.
	* testsuite/ld-x86-64/pr19636-2j.d: Likewise.
	* testsuite/ld-x86-64/pr19636-2k.d: Likewise.
	* testsuite/ld-x86-64/pr19636-2l.d: Likewise.
	* testsuite/ld-x86-64/pr19636-2m.d: Likewise.
2017-10-12 01:52:33 -07:00
Alan Modra 22b1ee183d Set dynamic_undefined_weak to zero for static PIEs
I believe we should be warning if ld is given both --no-dynamic-linker
and -z dynamic-undefined-weak.  The two options are contradictory, the
first says an executable has no dynamic interpreter to resolve dynamic
symbols, while the second is asking for dynamic symbols to be emitted.
(And even if a static PIE's relocation code, which is needed to
process R_*_RELATIVE relocs, could process symbols, there are no
DT_NEEDED dynamic objects to define such symbols.)

I also think that dynamic_undefined_weak is the right flag to control
whether undefined weaks are made dynamic, whether in static PIEs or
anywhere else.  So force it to 0 for static PIEs, fixing PR 22269 for
powerpc and any other target where the backend usually defaults to
undefined weaks being made dynamic.

This patch introduces regressions.  I'd normally not do that, but
these are all in very recently added test cases, or expose bugs in the
x86 backend.  The test cases were added after I'd made it known that
this patch or one like it was imminent.

	PR 22269
	* emultempl/elf32.em (after_parse): Warn on --no-dynamic-linker
	-z dynamic-undefined-weak combination.  Set dynamic_undefined_weak
	to zero when nointerp.
2017-10-12 14:37:11 +10:30
Alan Modra 559192d89d _bfd_elf_link_hash_hide_symbol calls in generic ELF code
This function shouldn't be called directly, except from backend code.

bfd/
	* elflink.c (_bfd_elf_adjust_dynamic_symbol): Call
	elf_backend_hide_symbol, not _bfd_elf_link_hash_hide_symbol.
	(bfd_elf_define_start_stop): Likewise.
ld/
	* emultempl/elf32.em (before_allocation): Call
	elf_backend_hide_symbol, not _bfd_elf_link_hash_hide_symbol.
	Formatting.
2017-10-12 13:13:06 +10:30
H.J. Lu 4b97e3893e Add 2 testcases for PR ld/22269
Since undefined weak symbols in static PIE are always resolved to 0 at
run-time, linker should resolve them as 0 at link-time, regardless of
whether "-z dynamic-undefined-weak" is used.  "-z dynamic-undefined-weak"
only makes undefined weak symbols dynamic, but doesn't change undefined
weak symbol resolution in static PIE at link-time.  These tests currently
pass on x86, but fails on many other targets.

The framework to resolve weak symbols in static PE at link-time is
posted at

https://sourceware.org/ml/binutils/2017-10/msg00087.html

which requires users/hjl/check_relocs branch to call check_relocs after
opening all inputs.  I will submit backend patches for failling targets
after merging users/hjl/check_relocs branch next.

	* PR ld/22269
	* testsuite/ld-elf/pr22269.s: New file.
	* testsuite/ld-elf/pr22269a.d: Likewise.
	* testsuite/ld-elf/pr22269b.d: Likewise.
2017-10-11 13:44:16 -07:00
H.J. Lu 853ee16fcd x86: Run PR ld/19636 tests with -z dynamic-undefined-weak
"-z dynamic-undefined-weak" makes undefined weak symbols dynamic, but
undefined weak symbols are still resolved to 0 at link-time if there
is no dynamic linker in executable.

	* testsuite/ld-i386/i386.exp: Run pr19636-1j, pr19636-1k,
	pr19636-1l, pr19636-3h and pr19636-3i.
	* testsuite/ld-i386/pr19636-1j.d: New file.
	* testsuite/ld-i386/pr19636-1k.d: Likewise.
	* testsuite/ld-i386/pr19636-1l.d: Likewise.
	* testsuite/ld-i386/pr19636-3h.d: Likewise.
	* testsuite/ld-i386/pr19636-3i.d: Likewise.
	* testsuite/ld-x86-64/pr19636-1h.d: Likewise.
	* testsuite/ld-x86-64/pr19636-1i.d: Likewise.
	* testsuite/ld-x86-64/pr19636-1j.d: Likewise.
	* testsuite/ld-x86-64/pr19636-2j.d: Likewise.
	* testsuite/ld-x86-64/pr19636-2k.d: Likewise.
	* testsuite/ld-x86-64/pr19636-2l.d: Likewise.
	* testsuite/ld-x86-64/pr19636-2m.d: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Run pr19636-1h, pr19636-1i,
	pr19636-1j, pr19636-2j, pr19636-2k, pr19636-2l and pr19636-2m.
2017-10-11 13:36:19 -07:00
Alan Modra d003af5580 ld internationalization fixes
* emultempl/aarch64elf.em: Wrap einfo strings in _().  Formatting.
	* emultempl/aix.em: Likewise.
	* emultempl/armcoff.em: Likewise.
	* emultempl/armelf.em: Likewise.
	* emultempl/avrelf.em: Likewise.
	* emultempl/beos.em: Likewise.
	* emultempl/cr16elf.em: Likewise.
	* emultempl/elf-generic.em: Likewise.
	* emultempl/elf32.em: Likewise.
	* emultempl/genelf.em: Likewise.
	* emultempl/hppaelf.em: Likewise.
	* emultempl/linux.em: Likewise.
	* emultempl/lnk960.em: Likewise.
	* emultempl/m68hc1xelf.em: Likewise.
	* emultempl/m68kcoff.em: Likewise.
	* emultempl/m68kelf.em: Likewise.
	* emultempl/metagelf.em: Likewise.
	* emultempl/mipself.em: Likewise.
	* emultempl/mmix-elfnmmo.em: Likewise.
	* emultempl/mmo.em: Likewise.
	* emultempl/msp430.em: Likewise.
	* emultempl/nds32elf.em: Likewise.
	* emultempl/nios2elf.em: Likewise.
	* emultempl/pe.em: Likewise.
	* emultempl/pep.em: Likewise.
	* emultempl/ppc32elf.em: Likewise.
	* emultempl/ppc64elf.em: Likewise.
	* emultempl/riscvelf.em: Likewise.
	* emultempl/s390.em: Likewise.
	* emultempl/scoreelf.em: Likewise.
	* emultempl/spuelf.em: Likewise.
	* emultempl/sunos.em: Likewise.
	* emultempl/tic6xdsbt.em: Likewise.
	* emultempl/v850elf.em: Likewise.
	* emultempl/vms.em: Likewise.
	* emultempl/vxworks.em: Likewise.
	* ldcref.c: Likewise.
	* ldlang.c: Likewise.
	* ldlex.l: Likewise.
	* ldmain.c: Likewise.
	* pe-dll.c: Likewise.
	* plugin.c: Likewise.
2017-10-11 15:04:59 +10:30
Renlin Li 6c699715f6 [ARM] PR ld/21402, only override the symbol dynamic decision on undefined weak symbol.
Similar as aarch64 backend, arm backend only overrides the decision on undefined
weak symbols. arm backend part already emits necessary relative relocation for
this case.

bfd/

	PR ld/21402
	* elf32-arm.c (allocate_dynrelocs_for_symbol): Only make undefined weak
	symbols into dynamic.

ld/

	PR ld/21402
	* testsuite/ld-arm/tls-app.d: Update address.
	* testsuite/ld-arm/tls-app.r: Remove relocations.
	* testsuite/ld-arm/unresolved-1-dyn.d: Update.
2017-10-10 16:18:07 +01:00
Alan Modra cbd3b1c155 Correct ld/Makefile earmelfb_fuchsia dependencies
There were two copies of earmelf_fuchsia.c dependencies.

	* Makefile.am (earmelfb_fuchsia.c): Rename rule from earmelf_fuchsia.c.
	* Makefile.in: Regenerate.
2017-10-10 14:44:58 +10:30
Nick Clifton c474ea1a5f Fix link time warning message when running the srec linker tests.
* testsuite/ld-srec/srec.exp (run_srec_test): Set start address.
2017-10-09 15:32:09 +01:00
Nick Clifton 6753e38a5c Fix compile time warning message when running the PR19874 linker test.
PR ld/19874
	* testsuite/ld-x86-64/pr19784c.c (bar): Change return type to void.
2017-10-09 15:00:31 +01:00
H.J. Lu 76f361eb49 ld: Don't allow '~' as the first char in symbol name
Don't allow '~' as the first character in symbol name in linker script.

	PR ld/22267
	* ldlex.l (SYMBOLNAMECHAR1) New.
	(DEFSYMEXP): Replace FILENAMECHAR1 with SYMBOLNAMECHAR1.
	(EXPRESSION): Likewise.
	* testsuite/ld-scripts/expr.exp: Run pr22267.
	* testsuite/ld-scripts/pr22267.d: New file.
	* testsuite/ld-scripts/pr22267.s: Likewise.
	* testsuite/ld-scripts/pr22267.t: Likewise.
2017-10-09 04:17:24 -07:00
H.J. Lu 2458d83bbc ld-elf/merge.d: Don't expect to fail for sparc
It passed with cross binutils to sparc-linux and sparc64-linux.

	* testsuite/ld-elf/merge.d: Don't expect to fail for sparc.
2017-10-07 16:14:50 -07:00
Nick Clifton 94750c06e8 Updated Turkish translation for the ld sub-directory.
* po/tr.po: Updated Turkish translation.
2017-10-05 14:03:48 +01:00
Nick Clifton 5c144731ed Change readelf so that when --wide is active a relocation's full name is displayed.
PR 22262
binutils* readelf.c (dump_relocations): Do not truncate reloc names when
	displaying output in wide mode.

ld	* testsuite/ld-powerpc/relocsort.d: Update expected output (for
	longer reloc names).
2017-10-05 13:25:44 +01:00
Alan Modra db4677b8bd PR21167, relocation sections not included in groups
This fixes a wart I've known about for years, but haven't done
anything about because BFD treats relocation sections as an adjunct to
the section they relocate.  SHF_GROUP on the section thus implicitly
applies to its relocation section(s), but it is an error that the
reloc sections aren't part of the group.

Like many patches to gas, this wasn't as straightforward as it could
be due to a number of backends, i386, cr16 and others, removing relocs
in tc_get_reloc rather than marking them as "done" earlier in
md_apply_reloc.  So it isn't possible for the group support to
reliably detect the presence of relocs by looking at fixups earlier
than write_relocs.  However the group support needs to create
signature symbols, and that must be done before the symbol table is
frozen, before write_relocs.  So split off the group sizing from
elf_adjust_symtab and put it in elf_frob_file_after_relocs.

bfd/
	PR 21167
	* elf.c (_bfd_elf_setup_sections): Don't trim reloc sections from
	groups.
	(_bfd_elf_init_reloc_shdr): Pass sec_hdr, use it to copy SHF_GROUP
	flag from section.
	(elf_fake_sections): Adjust calls.  Exit immediately on failure.
	(bfd_elf_set_group_contents): Add associated reloc section indices
	to group contents
gas/
	PR 21167
	* config/obj-elf.c (struct group_list): Delete elt_count.
	(groups): New static.
	(build_group_lists): Don't count elements.
	(elf_adjust_symtab): Use groups rather than auto list.  Set up
	pointer from group member to SHT_GROUP section.  Don't size
	SHT_GROUP section or clean up here..
	(elf_frob_file_after_relocs): ..do so here instead.
	* testsuite/gas/arc/jli-1.d,
	* testsuite/gas/elf/groupautob.d,
	* testsuite/gas/mips/compact-eh-eb-2.d,
	* testsuite/gas/mips/compact-eh-eb-5.d,
	* testsuite/gas/mips/compact-eh-el-2.d,
	* testsuite/gas/mips/compact-eh-el-5.d: Adjust.
ld/
	PR 21167
	* testsuite/ld-elf/group9b.d: Adjust for relocs included in group.
2017-10-05 08:38:11 +10:30
Alan Modra 9194f82dc3 PR21294, Binary size regression on PPC embedded
PR 21294
	* NEWS: Note that defaulting to -z relro results in increased
	memory and disk size.
2017-10-03 15:11:25 +10:30
Alan Modra def5c83c02 ld -z relro documentation
* ld.texinfo (-z relro): Expand description.
	(DATA_SEGMENT_ALIGN): Note that -z relro is not effective when
	running with system page size larger than commonpagesize.
	(DATA_SEGMENT_RELRO_END): Be explicit about the alignment.
2017-10-03 09:36:26 +10:30
Alan Modra 8cb1232a8c PR21970, assertion failed when more than one overlay has subalign specified
PR 21970
	* ldlang.c (lang_leave_overlay): Reset overlay_subalign.
2017-10-01 19:35:07 +10:30
H.J. Lu 2715765b0f Add a test for PR binutils/21978
PR binutils/21978
	* testsuite/ld-elf/pr21978.od: New file.
	* testsuite/ld-elf/pr21978a.c: Likewise.
	* testsuite/ld-elf/pr21978b.c: Likewise.
	* testsuite/ld-elf/shared.exp: Run PR binutils/21978 test.
2017-09-30 03:04:52 -07:00
Nick Clifton 231ca75323 Skip the PR 14918 linker test for ARM targets.
I am applying a patch that has been lying around in the Fedora
  binutils sources for a while.  It skips the PR14918 linker test for
  ARM based targets.  This test checks that libgcc is not included in a
  link of an empty executable.  This works for most targets, but on the
  ARM the crt1.o startup code calls __libc_csu_init which is in
  /usr/lib/libc_nonshared.a(elf-init.oS).  This in turn needs
  __aeabi_unwind_cpp_pr0@@GCC_3.5 which is provided by libgcc_s.so.1,
  and so the test fails.
2017-09-28 11:33:20 +01:00
Alan Modra 1a3b5c34fe PR22220, BFD linker wrongly marks symbols as PREVAILING_DEF_IRONLY
non_ir_ref_dynamic wasn't being set in the case where we have a
versioned dynamic symbol definition with a non-versioned matching IR
symbol.

bfd/
	PR 22220
	* elflink.c (_bfd_elf_merge_symbol): Set non_ir_ref_dynamic in
	a case where plugin_notice isn't called.
ld/
	* testsuite/ld-plugin/pr22220.h,
	* testsuite/ld-plugin/pr22220lib.cc,
	* testsuite/ld-plugin/pr22220lib.ver,
	* testsuite/ld-plugin/pr22220main.cc: New test.
	* testsuite/ld-plugin/lto.exp: Run it.
2017-09-28 17:36:36 +09:30
Maciej W. Rozycki 28d810f7ff LD/testsuite: Fix undefined symbol tests for MIPS and S+core targets
Fix commit 647d4de92e ("Test undefined symbols in shared libraries")
and remove "undefined symbols in shared lib (dyn reloc)" test failures
for MIPS and S+core targets.

This test assumes 3 dynamic relocation entries, however the respective
psABIs define an extra single dummy *_NONE relocation at the beginning
of the dynamic relocation table, which results in test output like the
following for MIPS:

Relocation section '.rel.dyn' at offset 0x33c contains 4 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
00000000  00000000 R_MIPS_NONE
00010364  00000903 R_MIPS_REL32      00000000   undef_pfun
00010360  00000a03 R_MIPS_REL32      00000000   undef_data
00010368  00000b03 R_MIPS_REL32      00000000   undef_notype

and S+core:

Relocation section '.rel.dyn' at offset 0x274 contains 4 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
00000000  00000000 R_SCORE_NONE
5ffe0464  00000e12 R_SCORE_REL32     00000000   undef_notype
5ffe045c  00000f12 R_SCORE_REL32     00000000   undef_data
5ffe0460  00001012 R_SCORE_REL32     00000000   undef_pfun

targets respectively, and also n64 MIPS targets pad relocation triplets
they use with extra *_NONE relocations, resulting in output like this:

Relocation section '.rel.dyn' at offset 0x4c0 contains 4 entries:
  Offset          Info           Type           Sym. Value    Sym. Name
000000000000  000000000000 R_MIPS_NONE
                    Type2: R_MIPS_NONE
                    Type3: R_MIPS_NONE
000000010508  000900001203 R_MIPS_REL32      0000000000000000 undef_pfun
                    Type2: R_MIPS_64
                    Type3: R_MIPS_NONE
000000010500  000a00001203 R_MIPS_REL32      0000000000000000 undef_data
                    Type2: R_MIPS_64
                    Type3: R_MIPS_NONE
000000010510  000b00001203 R_MIPS_REL32      0000000000000000 undef_notype
                    Type2: R_MIPS_64
                    Type3: R_MIPS_NONE

Expect the right number of *_NONE relocations then, and adjust the total
number of relocations expected accordingly.

	ld/
	* testsuite/ld-undefined/undefined.exp: Correct the dyn reloc
	test for MIPS and S+core targets.
2017-09-26 12:09:50 +01:00
H.J. Lu be2b629f64 Add a test for PR ld/22150
PR ld/22150
	* testsuite/ld-elf/pr22150.vd: New file.
	* testsuite/ld-elf/pr22150.ver: Likewise.
	* testsuite/ld-elf/pr22150a.s: Likewise.
	* testsuite/ld-elf/pr22150b.s: Likewise.
	* testsuite/ld-elf/shared.exp: Run PR ld/22150 tests.
2017-09-22 07:05:53 -07:00
Alan Modra ba52cbb9d0 Reduce excessive .eh_frame alignment for powerpc
PowerPC64 .cfi directives use DW_EH_PE_sdata4 encoding for .eh_frame,
so there is no real reason why .eh_frame should be 8 byte aligned.

gas/
	* config/tc-ppc.h (EH_FRAME_ALIGNMENT): Define.
ld/
	* testsuite/ld-powerpc/tlsopt5.wf: Update for reduced alignment.
2017-09-21 23:17:44 +09:30
Maciej W. Rozycki b7f54058d9 MIPS/LD: Add OpenBSD/mips64 support
Complement commit 26eebcf553 ("Update OpenBSD/mips64 support"),
<https://sourceware.org/ml/binutils/2005-04/msg00382.html>, which added
OpenBSD/mips64 support to GAS, and also add it to LD, avoiding a build
failure at the configuration stage, like:

*** ld does not support target mips64-unknown-openbsd
*** see ld/configure.tgt for supported targets
make[1]: *** [configure-ld] Error 1

As per OS support only include n64 MIPS emulations, and use the
traditional ones, matching the choice already made with the addition of
GAS support.

	ld/
	* configure.tgt <mips64el-*-openbsd*, mips64-*-openbsd*>: New
	targets.
2017-09-19 15:20:41 +01:00
Alan Modra 8fd138c43b PR22118, Incorrectly-capitalized regexp
PR 22118
	* testsuite/ld-aarch64/erratum843419.d: Correct regexp.
2017-09-15 20:21:42 +09:30
H.J. Lu 79254a5260 globalaudit.rd: Allow additional bits in DT_FLAGS_1
With -PIE on x86-64, we get

 0x000000006ffffffb (FLAGS_1)            Flags: GLOBAUDIT PIE

We should allow additional bits in DT_FLAGS_1.

	PR ld/22139
	* testsuite/ld-elf/globalaudit.rd: Allow additional bits in
	DT_FLAGS_1.
2017-09-14 12:45:18 -07:00
H.J. Lu 5e5e02aeca x86: Cache section contents and relocations
bfd/

	PR ld/22135
	* elf32-i386.c (elf_i386_convert_load_reloc): Add an argument
	to indicate if conversion is performed.
	(elf_i386_check_relocs): Cache section contents and relocations
	if conversion is performed.
	* elf64-x86-64.c (elf_x86_64_check_relocs): Cache section
	contents and relocations if conversion is performed.

ld/

	PR ld/22135
	* testsuite/ld-i386/i386.exp: Run pr22135.
	* testsuite/ld-x86-64/x86-64.exp: Likewise.
	* testsuite/ld-i386/pr22135.d: New file.
	* testsuite/ld-i386/pr22135.s: Likewise.
	* testsuite/ld-x86-64/pr22135.d: Likewise.
	* testsuite/ld-x86-64/pr22135.s: Likewise.
2017-09-14 12:29:29 -07:00
Alan Modra 2420fff633 PowerPC64 --plt-align
This changes the PowerPC64 --plt-align option to perform the usual
alignment of code as suggested by its name, as well as the previous
behaviour of padding so as to reduce boundary crossing.  The old
behaviour is had by using a negative parameter.

The default is also changed to align plt stub code by default to 32
byte boundaries, the point being to get better bctr branch prediction
on power8 and power9 hardware.

bfd/
	* elf64-ppp.c (plt_stub_pad): Handle positive and negative
	plt_stub_align.
ld/
	* ld.texinfo (--plt-align): Describe new behaviour of option.
	* emultempl/ppc64elf.em (params): Default plt_stub_align to 5.
	* testsuite/ld-powerpc/powerpc.exp: Pass --no-plt-align for
	selected tests.
	* testsuite/ld-powerpc/relbrlt.d: Pass --no-plt-align.
	* testsuite/ld-powerpc/elfv2so.d: Adjust expected output.
2017-09-10 01:55:16 +09:30
H.J. Lu 0a27fed72d x86: Properly handle __ehdr_start
After _bfd_i386_elf_convert_load and _bfd_x86_64_elf_convert_load are
removed, elf_i386_convert_load_reloc and elf_x86_64_convert_load_reloc
see __ehdr_start as an undefined symbol when they are called from
check_relocs to convert GOT relocations against local symbols.  But
__ehdr_start will be defined as a hidden symbol by linker at the later
stage if it is referenced.  This patch marks __ehdr_start as a defined
local symbol at the start of check_relocs if it is referenced and not
defined.

bfd/

	PR ld/22115
	* elf32-i386.c (elf_i386_convert_load_reloc): Check linker_def.
	Don't use UNDEFINED_WEAK_RESOLVED_TO_ZERO.
	* elf64-x86-64.c (elf_x86_64_convert_load_reloc): Check
	linker_def.  Don't use UNDEFINED_WEAK_RESOLVED_TO_ZERO.
	* elfxx-x86.c (_bfd_x86_elf_link_check_relocs): Set local_ref
	and linker_def on __ehdr_start if it is referenced and not
	defined.
	(_bfd_x86_elf_link_symbol_references_local): Also set local_ref
	and return TRUE when building executable, if a symbol has
	non-GOT/non-PLT relocations in text section or there is no
	dynamic linker.
	* elfxx-x86.h (elf_x86_link_hash_entry): Add linker_def.

ld/

	PR ld/22115
	* ld-i386/i386.exp: Run PR ld/22115 tests,
	* ld/testsuite/ld-x86-64/x86-64.exp: Likewise.
	* testsuite/ld-i386/pr22115-1.s: New file.
	* testsuite/ld-i386/pr22115-1a.d: Likewise.
	* testsuite/ld-i386/pr22115-1b.d: Likewise.
	* testsuite/ld-i386/pr22115-1c.d: Likewise.
	* testsuite/ld-i386/pr22115-1d.d: Likewise.
	* testsuite/ld-x86-64/pr22115-1.s: Likewise.
	* testsuite/ld-x86-64/pr22115-1a-x32.d: Likewise.
	* testsuite/ld-x86-64/pr22115-1a.d: Likewise.
	* testsuite/ld-x86-64/pr22115-1b-x32.d: Likewise.
	* testsuite/ld-x86-64/pr22115-1b.d: Likewise.
	* testsuite/ld-x86-64/pr22115-1c-x32.d: Likewise.
	* testsuite/ld-x86-64/pr22115-1c.d: Likewise.
	* testsuite/ld-x86-64/pr22115-1d-x32.d: Likewise.
	* testsuite/ld-x86-64/pr22115-1d.d: Likewise.
2017-09-09 05:05:29 -07:00
H.J. Lu 78984959cb x86-64: Add R_X86_64_converted_reloc_bit
Add R_X86_64_converted_reloc_bit to relocation type to indicate if a
relocation is converted from a GOTPCREL relocation.  Linker now generates

failed to convert GOTPCREL relocation; relink with --no-relax

for all cases, including relocations against local symbols.

bfd/

	* elf64-x86-64.c (R_X86_64_converted_reloc_bit): New.
	(elf_x86_64_info_to_howto): Get the real relocation type by
	masking out R_X86_64_converted_reloc_bit.
	(elf_x86_64_check_tls_transition): Get the real relocation type
	by masking out R_X86_64_converted_reloc_bit.
	(elf_x86_64_convert_load_reloc): Set R_X86_64_converted_reloc_bit
	instead of setting converted_reloc.
	(elf_x86_64_relocate_section): Check R_X86_64_converted_reloc_bit
	instead of converted_reloc. Get the real relocation type by
	masking out R_X86_64_converted_reloc_bit.
	(elf_x86_64_link_setup_gnu_properties): Verify that the value of
	R_X86_64_converted_reloc_bit is valid.
	* elfxx-x86.h (converted_reloc): Removed.

ld/

	* testsuite/ld-x86-64/pr19609-2a.d: Updated.
	* testsuite/ld-x86-64/pr19609-2b.d: Likewise.
	* testsuite/ld-x86-64/pr19609-4a.d: Likewise.
	* testsuite/ld-x86-64/pr19609-4c.d: Likewise.
2017-09-06 05:06:35 -07:00
H.J. Lu dc08907213 x86-64: Properly set converted_reloc
Linker now generates

failed to convert GOTPCREL relocation; relink with --no-relax

for more cases.

bfd/

	* elf64-x86-64.c (elf_x86_64_convert_load_reloc): Properly set
	converted_reloc.

ld/

	* testsuite/ld-x86-64/pr19609-5d.d: Updated.
	* testsuite/ld-x86-64/pr19609-7a.d: Likewise.
	* testsuite/ld-x86-64/pr19609-7c.d: Likewise.
2017-09-05 13:43:02 -07:00
H.J. Lu 8b43e45688 x86-64: Improve GOTPCREL relocation conversion
When GOTPCREL relocation conversion leads to relocation overflow, we
may get a mysterious linker message, like

relocation truncated to fit: R_X86_64_32S against symbol `foo'

This patch changes the linker message to

failed to convert GOTPCREL relocation; relink with --no-relax

bfd/

	* elf64-x86-64.c (elf_x86_64_convert_load_reloc): Remove the sec
	argument.  Don't check relocation overflow.  Avoid relocation
	overflow if --no-relax is used.  Set converted_reloc on symbol
	if a GOTPCREL relocation is converted.
	(elf_x86_64_relocate_section): Issue a fatal error and suggest
	--no-relax if GOTPCREL relocation conversion leads to relocation
	overflow.
	* elfxx-x86.h (elf_x86_link_hash_entry): Add converted_reloc.

ld/

	* testsuite/ld-x86-64/pr19609-4e.d: Updated.
	* testsuite/ld-x86-64/pr19609-6a.d: Likewise.
2017-09-05 11:24:14 -07:00
H.J. Lu 0e30d99180 x86-64: Set tlsdesc_plt if GOT_TLS_GDESC_P is true
We need to set tlsdesc_plt for x86-64 if GOT_TLS_GDESC_P is true when
allocating dynamic relocations so that _bfd_x86_elf_size_dynamic_sections
will generate TLSDESC_PLT and TLSDESC_GOT in x86-64 output.

bfd/

	PR ld/22071
	* elfxx-x86.c (elf_x86_allocate_dynrelocs): Set tlsdesc_plt
	for x86-64 if GOT_TLS_GDESC_P is true.

ld/

	PR ld/22071
	* testsuite/ld-x86-64/pr22071.d: New file.
	* testsuite/ld-x86-64/pr22071.s: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Run pr22071.
2017-09-03 10:18:38 -07:00
Alan Modra 1fa4ec6ae7 LTO rescan archives
ld ought to be more clever about where it puts LTO recompiled objects.
Ideally the recompiled objects ought to be ordered to the same place
their IR objects were, and files extracted from archives on the second
pass ought to go in the same place as they would if extracted on the
first pass.  This patch addresses the archive problem.  Without this
fix, objects extracted from archives might be placed after the crt
files intended to go at the end of an executable or shared library,
possibly causing exception handling failures.

	* ldlang.h (lang_input_statement_type): Expand comments.
	(LANG_FOR_EACH_INPUT_STATEMENT): Rewrite without casts.
	* ldlang.c (lang_for_each_input_file): Likewise.
	(load_symbols): Set usrdata for archives.
	(find_rescan_insertion): New function.
	(lang_process): Trim off and reinsert entries added to file chain
	when rescanning archives for LTO.
	* ldmain.c (add_archive_element): Set my_archive input_statement
	next pointer to last element added.
2017-09-02 17:39:04 +09:30
H.J. Lu ad71ce8de7 x86-64: Check ELF_COMMON_DEF_P for common symbols
bfd/

	PR ld/22064
	* elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Check
	ELF_COMMON_DEF_P for common symbols.

ld/

	PR ld/22064
	* testsuite/ld-x86-64/pr22064a.S: New file.
	* testsuite/ld-x86-64/pr22064b.c: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Run PR ld/22064 test.
2017-09-01 18:55:55 -07:00
Alan Modra 96d01d93c4 -Og warning fixes
Found when building with gcc 4.9.4 using -Og.

bfd/
	* elf-eh-frame.c (offset_adjust): Avoid false positive gcc warning.
	* elflink.c (bfd_elf_size_dynsym_hash_dynstr): Likewise.
	* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise.
ld/
	* emultempl/msp430.em (eval_upper_either_sections): Make base_sec_name
	a const char*.
	(eval_lower_either_sections): Likewise.
	(msp430_elf_after_allocation): Likewise, and don't needlessly concat
	and free.  Warning fix.
2017-09-02 11:00:02 +09:30
H.J. Lu e10c9c620c x86: Correct unwind information for the second PLT
For i386, generate unwind information for the second PLT.  For x32,
correct alignment of .eh_frame section for the second PLT.

bfd/

	PR ld/22061
	* elf32-i386.c (elf_i386_link_setup_gnu_properties): Create
	.eh_frame section for the second PLT.
	* elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Correct
	alignment of .eh_frame section for the second PLT.

ld/

	PR ld/22061
	* testsuite/ld-i386/ibt-plt-1.d: Updated.
	* testsuite/ld-i386/ibt-plt-2a.d: Likewise.
	* testsuite/ld-i386/ibt-plt-2c.d: Likewise.
	* testsuite/ld-i386/ibt-plt-3a.d: Likewise.
	* testsuite/ld-i386/ibt-plt-3c.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-1-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-2a-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-2c-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-3a-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-3c-x32.d: Likewise.
	* testsuite/ld-i386/ibt-plt-2b.d: Pass --hash-style=sysv to ld
	and dump unwind information.
	* testsuite/ld-i386/ibt-plt-2d.d: Likewise.
	* testsuite/ld-i386/ibt-plt-3b.d: Likewise.
	* testsuite/ld-i386/ibt-plt-3d.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-2b-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-2b.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-2d-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-2d.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-3b-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-3b.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-3d-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-3d.d: Likewise.
2017-09-01 06:12:06 -07:00
H.J. Lu d7de64088c Add a test for PR ld/22048
PR ld/22048
	* testsuite/ld-x86-64/pr22048.d: New file.
	* testsuite/ld-x86-64/pr22048a.s: Likewise.
	* testsuite/ld-x86-64/pr22048b.s: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Run pr22048.
2017-08-31 03:54:01 -07:00
Alan Modra 9866ffe25a Remove .eh_frame zero terminators
The machinery to do this was there, but not enabled if the terminator
was the only thing in the section.

bfd/
	* elf-eh-frame.c (_bfd_elf_parse_eh_frame): Don't exit early
	for a section containing just a terminator.  Allow multiple
	terminators at end of section.
	* elflink.c (bfd_elf_discard_info): Iterate over .eh_frame
	sections when not adding alignment.  Assert on terminator in
	the middle of FDEs.
ld/
	* testsuite/ld-elf/eh3.d: Update.
	* testsuite/ld-elf/eh4.d: Update.
2017-08-31 19:40:35 +09:30
Maciej W. Rozycki 5dda32094f LD/testsuite: Also discard `.MIPS.options' in orphan tests
Complement commit 5b5f4e6f8c ("ld: Early detection of orphans we know
will be discarded") and add `.MIPS.options' to the list of sections
discarded with orphan tests, removing failures like:

./ld-new: error: unplaced orphan section `.MIPS.options' from `tmpdir/orphan-11.o'.
FAIL: ld-elf/orphan-11

and:

./ld-new: error: unplaced orphan section `.MIPS.options' from `tmpdir/orphan-12.o'.
FAIL: ld-elf/orphan-12

from n64 MIPS testing.

	ld/
	* testsuite/ld-elf/orphan-11.ld: Also discard `.MIPS.options'
	sections.
2017-08-30 22:55:14 +01:00
Maciej W. Rozycki 70e65ca8e5 MIPS/BFD: Correct microMIPS cross-mode BAL to JALX relaxation
Fix a bug in commit a6ebf6169a ("MIPS: Convert cross-mode BAL to
JALX") and in BFD linker relaxation correct the microMIPS interpretation
of the branch offset, which is supposed to be shifted by 1 bit, rather
than 2 as in the regular MIPS case.

	bfd/
	* elfxx-mips.c (mips_elf_perform_relocation): Correct microMIPS
	branch offset interpretation.

	gas/
	* testsuite/gas/mips/branch-addend-micromips.d: New test.
	* testsuite/gas/mips/branch-addend-micromips-n32.d: New test.
	* testsuite/gas/mips/branch-addend-micromips-n64.d: New test.
	* testsuite/gas/mips/branch-addend-micromips.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new tests.

	ld/
	* testsuite/ld-mips-elf/bal-jalx-addend-micromips.d: New test.
	* testsuite/ld-mips-elf/bal-jalx-addend-micromips-n32.d: New
	test.
	* testsuite/ld-mips-elf/bal-jalx-addend-micromips-n64.d: New
	test.
	* testsuite/ld-mips-elf/bal-jalx-local-micromips.d: New test.
	* testsuite/ld-mips-elf/bal-jalx-local-micromips-n32.d: New
	test.
	* testsuite/ld-mips-elf/bal-jalx-local-micromips-n64.d: New
	test.
	* testsuite/ld-mips-elf/bal-jalx-pic-micromips.d: New test.
	* testsuite/ld-mips-elf/bal-jalx-pic-micromips-n32.d: New test.
	* testsuite/ld-mips-elf/bal-jalx-pic-micromips-n64.d: New test.
	* testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips.d: New
	test.
	* testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n32.d: New
	test.
	* testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n64.d: New
	test.
	* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2017-08-30 16:07:45 +01:00
Alan Modra 9a23f96e91 PowerPC TPREL16_HA/LO reloc optimization
In the TLS GD/LD to LE optimization, ld replaces a sequence like

 addi 3,2,x@got@tlsgd		R_PPC64_GOT_TLSGD16	x
 bl __tls_get_addr(x@tlsgd)	R_PPC64_TLSGD		x
				R_PPC64_REL24		__tls_get_addr
 nop

with

 addis 3,13,x@tprel@ha		R_PPC64_TPREL16_HA	x
 addi 3,3,x@tprel@l		R_PPC64_TPREL16_LO	x
 nop

When the tprel offset is small, this can be further optimized to

 nop
 addi 3,13,x@tprel
 nop

bfd/
	* elf64-ppc.c (struct ppc_link_hash_table): Add do_tls_opt.
	(ppc64_elf_tls_optimize): Set it.
	(ppc64_elf_relocate_section): Nop addis on TPREL16_HA, and convert
	insn on TPREL16_LO and TPREL16_LO_DS relocs to use r13 when
	addis would add zero.
	* elf32-ppc.c (struct ppc_elf_link_hash_table): Add do_tls_opt.
	(ppc_elf_tls_optimize): Set it.
	(ppc_elf_relocate_section): Nop addis on TPREL16_HA, and convert
	insn on TPREL16_LO relocs to use r2 when addis would add zero.
gold/
	* powerpc.cc (Target_powerpc::Relocate::relocate): Nop addis on
	TPREL16_HA, and convert insn on TPREL16_LO and TPREL16_LO_DS
	relocs to use r2/r13 when addis would add zero.
ld/
	* testsuite/ld-powerpc/tls.s: Add calls with tls markers.
	* testsuite/ld-powerpc/tls32.s: Likewise.
	* testsuite/ld-powerpc/powerpc.exp: Run tls marker tests.
	* testsuite/ld-powerpc/tls.d: Adjust for TPREL16_HA/LO optimization.
	* testsuite/ld-powerpc/tlsexe.d: Likewise.
	* testsuite/ld-powerpc/tlsexetoc.d: Likewise.
	* testsuite/ld-powerpc/tlsld.d: Likewise.
	* testsuite/ld-powerpc/tlsmark.d: Likewise.
	* testsuite/ld-powerpc/tlsopt4.d: Likewise.
	* testsuite/ld-powerpc/tlstoc.d: Likewise.
2017-08-30 20:43:31 +09:30
Alan Modra b9f04fe0df PowerPC64 __tls_get_addr sequence optimization
There isn't a good reason for ld.bfd to behave differently from gold
in the code generated by TLS GD/LD to LE optimization.

bfd/
	* elf64-ppc.c (ppc64_elf_relocate_section): When optimizing
	__tls_get_addr call sequences to LE, don't move the addi down
	to the nop.  Replace the bl with addi and leave the nop alone.
ld/
	* testsuite/ld-powerpc/tls.d: Update.
	* testsuite/ld-powerpc/tlsexe.d: Update.
	* testsuite/ld-powerpc/tlsexetoc.d: Update.
	* testsuite/ld-powerpc/tlsld.d: Update.
	* testsuite/ld-powerpc/tlsmark.d: Update.
	* testsuite/ld-powerpc/tlsopt4.d: Update.
	* testsuite/ld-powerpc/tlstoc.d: Update.
2017-08-30 20:35:09 +09:30
Hans-Peter Nilsson c7dffc390c testsuite/ld-cris various files: Run ld with --hash-style=sysv.
* testsuite/ld-cris/dso-pltdis1.d: Run ld with --hash-style=sysv.
	* testsuite/ld-cris/dso-pltdis2.d,
	testsuite/ld-cris/dso12-pltdis.d, testsuite/ld-cris/expdyn1.d,
	testsuite/ld-cris/expdyn5.d, testsuite/ld-cris/expdyn6.d,
	testsuite/ld-cris/expdyn7.d, testsuite/ld-cris/gotplt1.d,
	testsuite/ld-cris/gotplt2.d, testsuite/ld-cris/gotplt3.d,
	testsuite/ld-cris/hiddef1.d, testsuite/ld-cris/libdso-11.d,
	testsuite/ld-cris/libdso-12.d, testsuite/ld-cris/libdso-12b.d,
	testsuite/ld-cris/libdso-12c.d, testsuite/ld-cris/libdso-13.d,
	testsuite/ld-cris/libdso-13b.d, testsuite/ld-cris/libdso-14.d,
	testsuite/ld-cris/libdso-15.d, testsuite/ld-cris/libdso-15b.d,
	testsuite/ld-cris/libdso-1b.d, testsuite/ld-cris/libdso-1c.d,
	testsuite/ld-cris/libdso-1d.d, testsuite/ld-cris/libdso-4.d,
	testsuite/ld-cris/pr16044.d, testsuite/ld-cris/pv32-1.d,
	testsuite/ld-cris/tls-dso-dtpoffd2.d,
	testsuite/ld-cris/tls-dso-dtpoffd4.d,
	testsuite/ld-cris/tls-dso-tpoffgotcomm1.d,
	testsuite/ld-cris/tls-dso-x1x2-1.d, testsuite/ld-cris/tls-gc-71.d,
	testsuite/ld-cris/tls-ie-78.d, testsuite/ld-cris/tls-js1.d,
	testsuite/ld-cris/tls-ldgdex-14.d,
	testsuite/ld-cris/tls-ldgdex-15.d,
	testsuite/ld-cris/tls-legdx-16.d,
	testsuite/ld-cris/tls-legdx-17.d,
	testsuite/ld-cris/tls-local-63.d,
	testsuite/ld-cris/tls-local-64.d, testsuite/ld-cris/tls-ok-30.d,
	testsuite/ld-cris/tls-ok-32.d, testsuite/ld-cris/tls-ok-34.d,
	testsuite/ld-cris/tls-und-38.d, testsuite/ld-cris/tls-und-42.d,
	testsuite/ld-cris/tls-und-46.d, testsuite/ld-cris/tls-und-50.d,
	testsuite/ld-cris/weakref2.d, testsuite/ld-cris/weakref3.d,
	testsuite/ld-cris/weakref4.d: Likewise.
2017-08-30 02:27:14 +02:00