Commit Graph

714 Commits

Author SHA1 Message Date
Alan Modra 87c69f9732 Rename PowerPC64 pcrel GOT TLS relocations
These relocations should have had REL in their names, to reflect the
fact that they are pc-relative.  Fix that now by adding _PCREL.
I've added some back-compatibility code to support anyone using
.reloc with the old relocations.

include/
	* elf/ppc64.h (elf_ppc64_reloc_type): Rename
	R_PPC64_GOT_TLSGD34 to R_PPC64_GOT_TLSGD_PCREL34,
	R_PPC64_GOT_TLSLD34 to R_PPC64_GOT_TLSLD_PCREL34,
	R_PPC64_GOT_TPREL34 to R_PPC64_GOT_TPREL_PCREL34, and
	R_PPC64_GOT_DTPREL34 to R_PPC64_GOT_DTPREL_PCREL34.
bfd/
	* reloc.c: Rename
	BFD_RELOC_PPC64_GOT_TLSGD34 to BFD_RELOC_PPC64_GOT_TLSGD_PCREL34,
	BFD_RELOC_PPC64_GOT_TLSLD34 to BFD_RELOC_PPC64_GOT_TLSLD_PCREL34,
	BFD_RELOC_PPC64_GOT_TPREL34 to BFD_RELOC_PPC64_GOT_TPREL_PCREL34,
	BFD_RELOC_PPC64_GOT_DTPREL34 to BFD_RELOC_PPC64_GOT_DTPREL_PCREL34.
	* elf64-ppc.c: Update throughout for reloc renaming.
	(ppc64_elf_reloc_name_lookup): Handle old reloc names.
	* libbfd.h: Regenerate.
	* bfd-in2.h: Regenerate.
gas/
	* config/tc-ppc.c: Update throughout for reloc renaming.
elfcpp/
	* powerpc.h: Rename
	R_PPC64_GOT_TLSGD34 to R_PPC64_GOT_TLSGD_PCREL34,
	R_PPC64_GOT_TLSLD34 to R_PPC64_GOT_TLSLD_PCREL34,
	R_PPC64_GOT_TPREL34 to R_PPC64_GOT_TPREL_PCREL34, and
	R_PPC64_GOT_DTPREL34 to R_PPC64_GOT_DTPREL_PCREL34.
gold/
	* powerpc.cc: Update throughout for reloc renaming.
2020-06-06 14:44:32 +09:30
H.J. Lu c4b126b87a ELF: Don't check relocations in non-loaded, non-alloced sections
Don't do anything special with non-loaded, non-alloced sections.
In particular, any relocs in such sections should not affect GOT
and PLT reference counting (ie. we don't allow them to create GOT
or PLT entries), there's no possibility or desire to optimize TLS
relocs, and there's not much point in propagating relocs to shared
libs that the dynamic linker won't relocate.

Since check_relocs is no longer called on non-loaded, non-alloced
sections, remove SEC_ALLOC check.  Resolve relocation in debug section
against symbol defined in shared library to 0.

bfd/

	PR ld/26080
	* elf-m10300.c (mn10300_elf_relocate_section): Resolve relocation
	in debug section against symbol defined in shared library to 0.
	* elf32-i386.c (elf_i386_check_relocs): Remove SEC_ALLOC check.
	* elf32-lm32.c (lm32_elf_check_relocs): Likewise.
	* elf32-m32r.c (m32r_elf_check_relocs): Likewise.
	* elf32-nds32.c (nds32_elf_check_relocs): Likewise.
	* elf32-nios2.c (nios2_elf32_check_relocs): Likewise.
	* elf32-or1k.c (or1k_elf_check_relocs): Likewise.
	* elf32-ppc.c (ppc_elf_check_relocs): Likewise.
	* elf32-sh.c (sh_elf_check_relocs): Likewise.
	* elf32-xtensa.c (elf_xtensa_check_relocs): Likewise.
	* elf64-alpha.c (elf64_alpha_check_relocs): Likewise.
	* elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
	* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
	* elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
	* elf32-vax.c (elf_vax_check_relocs): Set non_got_ref for non-GOT
	reference.
	(elf_vax_adjust_dynamic_symbol): Generate a copy reloc only if
	there is non-GOT reference.
	* elflink.c (_bfd_elf_link_check_relocs): Skip non-loaded,
	non-alloced sections.

ld/

	PR ld/26080
	* testsuite/ld-elf/comm-data.exp: Remove copy_reloc.
	* testsuite/ld-elf/comm-data2r.rd: Removed.
	* testsuite/ld-elf/comm-data2r.sd: Likewise.
	* testsuite/ld-elf/comm-data2r.xd: Likewise.
2020-06-04 05:58:47 -07:00
H.J. Lu d49e5065ed ELF: Consolidate maybe_set_textrel
All maybe_set_textrel implementations are the same.  Consolidate them
to a single _bfd_elf_maybe_set_textrel.

	* elf-bfd.h (_bfd_elf_maybe_set_textrel): New
	* elf32-arm.c (maybe_set_textrel): Removed.
	(elf32_arm_size_dynamic_sections): Replace maybe_set_textrel
	with _bfd_elf_maybe_set_textrel.
	* elf32-csky.c (maybe_set_textrel): Removed.
	(csky_elf_size_dynamic_sections): Replace maybe_set_textrel
	with _bfd_elf_maybe_set_textrel.
	* elf32-hppa.c (maybe_set_textrel): Removed.
	(elf32_hppa_size_dynamic_sections): Replace maybe_set_textrel
	with _bfd_elf_maybe_set_textrel.
	* elf32-lm32.c (maybe_set_textrel): Removed.
	(lm32_elf_size_dynamic_sections): Replace maybe_set_textrel
	with _bfd_elf_maybe_set_textrel.
	* elf32-m32r.c (maybe_set_textrel): Removed.
	(m32r_elf_size_dynamic_sections): Replace maybe_set_textrel
	with _bfd_elf_maybe_set_textrel.
	* elf32-metag.c (maybe_set_textrel): Removed.
	(elf_metag_size_dynamic_sections): Replace maybe_set_textrel
	with _bfd_elf_maybe_set_textrel.
	* elf32-nds32.c (maybe_set_textrel): Removed.
	(nds32_elf_size_dynamic_sections): Replace maybe_set_textrel
	with _bfd_elf_maybe_set_textrel.
	* elf32-or1k.c (maybe_set_textrel): Removed.
	(or1k_elf_size_dynamic_sections): Replace maybe_set_textrel
	with _bfd_elf_maybe_set_textrel.
	* elf32-ppc.c (maybe_set_textrel): Removed.
	(ppc_elf_size_dynamic_sections): Replace maybe_set_textrel
	with _bfd_elf_maybe_set_textrel.
	* elf32-s390.c (maybe_set_textrel): Removed.
	(elf_s390_size_dynamic_sections): Replace maybe_set_textrel
	with _bfd_elf_maybe_set_textrel.
	* elf32-sh.c (maybe_set_textrel): Removed.
	(sh_elf_size_dynamic_sections): Replace maybe_set_textrel
	with _bfd_elf_maybe_set_textrel.
	* elf32-tic6x.c (maybe_set_textrel): Removed.
	(elf32_tic6x_size_dynamic_sections): Replace maybe_set_textrel
	with _bfd_elf_maybe_set_textrel.
	* elf32-tilepro.c (maybe_set_textrel): Removed.
	(tilepro_elf_size_dynamic_sections): Replace maybe_set_textrel
	with _bfd_elf_maybe_set_textrel.
	* elf64-ppc.c (maybe_set_textrel): Removed.
	(ppc64_elf_size_dynamic_sections): Replace maybe_set_textrel
	with _bfd_elf_maybe_set_textrel.
	* elf64-s390.c (maybe_set_textrel): Removed.
	(elf_s390_size_dynamic_sections): Replace maybe_set_textrel
	with _bfd_elf_maybe_set_textrel.
	* elfnn-aarch64.c (maybe_set_textrel): Removed.
	(elfNN_aarch64_size_dynamic_sections): Replace maybe_set_textrel
	with _bfd_elf_maybe_set_textrel.
	* elfnn-riscv.c (maybe_set_textrel): Removed.
	(riscv_elf_size_dynamic_sections): Replace maybe_set_textrel
	with _bfd_elf_maybe_set_textrel.
	* elfxx-sparc.c (maybe_set_textrel): Removed.
	(_bfd_sparc_elf_size_dynamic_sections): Replace maybe_set_textrel
	with _bfd_elf_maybe_set_textrel.
	* elfxx-tilegx.c (maybe_set_textrel): Removed.
	(tilegx_elf_size_dynamic_sections): Replace maybe_set_textrel
	with _bfd_elf_maybe_set_textrel.
	* elfxx-x86.c (maybe_set_textrel): Removed.
	(_bfd_x86_elf_size_dynamic_sections): Replace maybe_set_textrel
	with _bfd_elf_maybe_set_textrel.
	* elflink.c (_bfd_elf_maybe_set_textrel): New.
2020-06-03 07:07:24 -07:00
H.J. Lu 5dbc8b372f ELF: Consolidate readonly_dynrelocs
All readonly_dynrelocs implementations are the same.  Consolidate them
to a single _bfd_elf_readonly_dynrelocs.

	PR ld/26067
	* elf-bfd.h (_bfd_elf_readonly_dynrelocs): New.
	* elf32-arm.c (readonly_dynrelocs): Removed.
	(maybe_set_textrel): Replace readonly_dynrelocs with
	_bfd_elf_readonly_dynrelocs.
	* elf32-csky.c (readonly_dynrelocs): Removed.
	(maybe_set_textrel): Replace readonly_dynrelocs with
	_bfd_elf_readonly_dynrelocs.
	*  elf32-hppa.c(readonly_dynrelocs): Removed.
	(alias_readonly_dynrelocs): Replace readonly_dynrelocs with
	_bfd_elf_readonly_dynrelocs.
	(maybe_set_textrel): Likewise.
	* elf32-lm32.c (readonly_dynrelocs): Removed.
	(lm32_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
	with _bfd_elf_readonly_dynrelocs.
	(maybe_set_textrel): Likewise.
	* elf32-m32r.c (readonly_dynrelocs): Removed.
	(m32r_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
	with _bfd_elf_readonly_dynrelocs.
	(maybe_set_textrel): Likewise.
	* elf32-metag.c (readonly_dynrelocs): Removed.
	(elf_metag_adjust_dynamic_symbol): Replace readonly_dynrelocs
	with _bfd_elf_readonly_dynrelocs.
	(maybe_set_textrel): Likewise.
	* elf32-microblaze.c (readonly_dynrelocs): Removed.
	(microblaze_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
	with _bfd_elf_readonly_dynrelocs.
	* elf32-nds32.c (readonly_dynrelocs): Removed.
	(nds32_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
	with _bfd_elf_readonly_dynrelocs.
	(maybe_set_textrel): Likewise.
	* elf32-or1k.c (readonly_dynrelocs): Removed.
	(or1k_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
	with _bfd_elf_readonly_dynrelocs.
	* elf32-ppc.c (readonly_dynrelocs): Removed.
	(alias_readonly_dynrelocs): Replace readonly_dynrelocs with
	_bfd_elf_readonly_dynrelocs.
	(ppc_elf_adjust_dynamic_symbol): Likewise.
	(maybe_set_textrel): Likewise.
	* elf32-s390.c (readonly_dynrelocs): Removed.
	(elf_s390_adjust_dynamic_symbol): Replace readonly_dynrelocs
	with _bfd_elf_readonly_dynrelocs.
	(maybe_set_textrel): Likewise.
	* elf32-sh.c (readonly_dynrelocs): Removed.
	(sh_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs with
	_bfd_elf_readonly_dynrelocs.
	(maybe_set_textrel): Likewise.
	* elf32-tic6x.c (readonly_dynrelocs): Removed.
	(maybe_set_textrel): Replace readonly_dynrelocs with
	_bfd_elf_readonly_dynrelocs.
	* elf32-tilepro.c (readonly_dynrelocs): Removed.
	(tilepro_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
	with _bfd_elf_readonly_dynrelocs.
	(maybe_set_textrel): Likewise.
	* elf64-ppc.c (readonly_dynrelocs): Removed.
	(alias_readonly_dynrelocs): Replace readonly_dynrelocs with
	_bfd_elf_readonly_dynrelocs.
	(ppc64_elf_adjust_dynamic_symbol): Likewise.
	(maybe_set_textrel): Likewise.
	* elf64-s390.c (readonly_dynrelocs): Removed.
	(elf_s390_adjust_dynamic_symbol): Replace readonly_dynrelocs
	with _bfd_elf_readonly_dynrelocs.
	(maybe_set_textrel): Likewise.
	* elflink.c (_bfd_elf_readonly_dynrelocs): New.
	* elfnn-aarch64.c (readonly_dynrelocs): Removed.
	(maybe_set_textrel): Replace readonly_dynrelocs with
	_bfd_elf_readonly_dynrelocs.
	* elfnn-riscv.c (readonly_dynrelocs): Removed.
	(riscv_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
	with _bfd_elf_readonly_dynrelocs.
	(maybe_set_textrel): Likewise.
	* elfxx-sparc.c (readonly_dynrelocs): Removed.
	(_bfd_sparc_elf_adjust_dynamic_symbol): Replace
	readonly_dynrelocs with _bfd_elf_readonly_dynrelocs.
	(maybe_set_textrel): Likewise.
	* elfxx-tilegx.c (readonly_dynrelocs): Removed.
	(tilegx_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
	with _bfd_elf_readonly_dynrelocs.
	(maybe_set_textrel): Likewise.
	* elfxx-x86.c (readonly_dynrelocs): Removed.
	(maybe_set_textrel): Replace readonly_dynrelocs with
	_bfd_elf_readonly_dynrelocs.
	(_bfd_x86_elf_adjust_dynamic_symbol): Likewise.
2020-06-03 07:01:13 -07:00
H.J. Lu 190eb1ddba ELF: Move dyn_relocs to struct elf_link_hash_entry
All ELF backends with shared library support have

  /* Track dynamic relocs copied for this symbol.  */
  struct elf_dyn_relocs *dyn_relocs;

in symbol hash entry.  Move dyn_relocs to struct elf_link_hash_entry
to reduce code duplication.

	PR ld/26067
	* elf-bfd.h (elf_link_hash_entry): Add dyn_relocs after size.
	* elf-s390-common.c (s390_elf_allocate_ifunc_dyn_relocs):
	Updated.
	* elf32-arc.c (elf_arc_link_hash_entry): Remove dyn_relocs.
	(elf_arc_link_hash_newfunc): Updated.
	* elf32-arm.c (elf32_arm_link_hash_entry): Remove dyn_relocs.
	(elf32_arm_link_hash_newfunc): Updated.
	(elf32_arm_copy_indirect_symbol): Likewise.
	(elf32_arm_check_relocs): Likewise.
	(readonly_dynrelocs): Likewise.
	(allocate_dynrelocs_for_symbol): Likewise.
	* elf32-csky.c (csky_elf_link_hash_entry): Remove dyn_relocs.
	(csky_elf_link_hash_newfunc): Updated.
	(csky_allocate_dynrelocs): Likewise.
	(readonly_dynrelocs): Likewise.
	(csky_elf_copy_indirect_symbol): Likewise.
	* elf32-hppa.c (elf32_hppa_link_hash_entry): Remove dyn_relocs.
	(hppa_link_hash_newfunc): Updated.
	(elf32_hppa_copy_indirect_symbol): Likewise.
	(elf32_hppa_hide_symbol): Likewise.
	(elf32_hppa_adjust_dynamic_symbol): Likewise.
	(allocate_dynrelocs): Likewise.
	(elf32_hppa_relocate_section): Likewise.
	* elf32-i386.c (elf_i386_check_relocs): Likewise.
	* elf32-lm32.c (elf_lm32_link_hash_entry): Removed.
	(lm32_elf_link_hash_newfunc): Likewise.
	(lm32_elf_link_hash_table_create): Updated.
	(readonly_dynrelocs): Likewise.
	(allocate_dynrelocs): Likewise.
	(lm32_elf_copy_indirect_symbol): Likewise.
	* elf32-m32r.c (elf_m32r_link_hash_entry): Removed.
	(m32r_elf_link_hash_newfunc): Likewise.
	(m32r_elf_link_hash_table_create): Updated.
	(m32r_elf_copy_indirect_symbol): Likewise.
	(allocate_dynrelocs): Likewise.
	* elf32-metag.c (elf_metag_link_hash_entry): Remove dyn_relocs.
	(metag_link_hash_newfunc): Updated.
	(elf_metag_copy_indirect_symbol): Likewise.
	(readonly_dynrelocs): Likewise.
	(allocate_dynrelocs): Likewise.
	* elf32-microblaze.c (elf32_mb_link_hash_entry): Remove
	dyn_relocs.
	(link_hash_newfunc): Updated.
	(microblaze_elf_check_relocs): Likewise.
	(microblaze_elf_copy_indirect_symbol): Likewise.
	(readonly_dynrelocs): Likewise.
	(allocate_dynrelocs): Likewise.
	* elf32-nds32.c (elf_nds32_link_hash_entry): Remove dyn_relocs.
	(nds32_elf_link_hash_newfunc): Updated.
	(nds32_elf_copy_indirect_symbol): Likewise.
	(readonly_dynrelocs): Likewise.
	(allocate_dynrelocs): Likewise.
	(nds32_elf_check_relocs): Likewise.
	* elf32-nios2.c (elf32_nios2_link_hash_entry): Remove dyn_relocs.
	(link_hash_newfunc): Updated.
	(nios2_elf32_copy_indirect_symbol): Likewise.
	(nios2_elf32_check_relocs): Likewise.
	(allocate_dynrelocs): Likewise.
	* elf32-or1k.c (elf_or1k_link_hash_entry): Remove dyn_relocs.
	(or1k_elf_link_hash_newfunc): Updated.
	(readonly_dynrelocs): Likewise.
	(allocate_dynrelocs): Likewise.
	(or1k_elf_copy_indirect_symbol): Likewise.
	* elf32-ppc.c (ppc_elf_link_hash_entry): Remove dyn_relocs.
	(ppc_elf_link_hash_newfunc): Updated.
	(ppc_elf_copy_indirect_symbol): Likewise.
	(ppc_elf_check_relocs): Likewise.
	(readonly_dynrelocs): Likewise.
	(ppc_elf_adjust_dynamic_symbol): Likewise.
	(allocate_dynrelocs): Likewise.
	(ppc_elf_relocate_section): Likewise.
	* elf32-s390.c (elf_s390_link_hash_entry): Remove dyn_relocs.
	(link_hash_newfunc): Updated.
	(elf_s390_copy_indirect_symbol): Likewise.
	(readonly_dynrelocs): Likewise.
	(elf_s390_adjust_dynamic_symbol): Likewise.
	(allocate_dynrelocs): Likewise.
	* elf32-sh.c (elf_sh_link_hash_entry): Remove dyn_relocs.
	(sh_elf_link_hash_newfunc): Updated.
	(readonly_dynrelocs): Likewise.
	(allocate_dynrelocs): Likewise.
	(sh_elf_copy_indirect_symbol): Likewise.
	(sh_elf_check_relocs): Likewise.
	* elf32-tic6x.c (elf32_tic6x_link_hash_entry): Removed.
	(elf32_tic6x_link_hash_newfunc): Likewise.
	(elf32_tic6x_link_hash_table_create): Updated.
	(readonly_dynrelocs): Likewise.
	(elf32_tic6x_check_relocs): Likewise.
	(elf32_tic6x_allocate_dynrelocs): Likewise.
	* elf32-tilepro.c (tilepro_elf_link_hash_entry): Remove
	dyn_relocs.
	(link_hash_newfunc): Updated.
	(tilepro_elf_copy_indirect_symbol): Likewise.
	(tilepro_elf_check_relocs): Likewise.
	(allocate_dynrelocs): Likewise.
	* elf64-ppc.c (ppc_link_hash_entry): Remove dyn_relocs.
	(ppc64_elf_copy_indirect_symbol): Updated.
	(ppc64_elf_check_relocs): Likewise.
	(readonly_dynrelocs): Likewise.
	(ppc64_elf_adjust_dynamic_symbol): Likewise.
	(dec_dynrel_count): Likewise.
	(allocate_dynrelocs): Likewise.
	(ppc64_elf_relocate_section): Likewise.
	* elf64-s390.c (elf_s390_link_hash_entry): Remove dyn_relocs.
	(link_hash_newfunc): Updated.
	(elf_s390_copy_indirect_symbol): Likewise.
	(readonly_dynrelocs): Likewise.
	(allocate_dynrelocs): Likewise.
	* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
	* elfnn-aarch64.c (elf_aarch64_link_hash_entry): Remove
	dyn_relocs.
	(elfNN_aarch64_link_hash_newfunc): Updated.
	(elfNN_aarch64_copy_indirect_symbol): Likewise.
	(readonly_dynrelocs): Likewise.
	(need_copy_relocation_p): Likewise.
	(elfNN_aarch64_allocate_dynrelocs): Likewise.
	(elfNN_aarch64_allocate_ifunc_dynrelocs): Likewise.
	* elfnn-riscv.c (riscv_elf_link_hash_entry): Remove dyn_relocs.
	(link_hash_newfunc): Updated.
	(riscv_elf_copy_indirect_symbol): Likewise.
	(riscv_elf_check_relocs): Likewise.
	(readonly_dynrelocs): Likewise.
	(allocate_dynrelocs): Likewise.
	* elfxx-sparc.c (_bfd_sparc_elf_link_hash_entry): Remove
	dyn_relocs.
	(link_hash_newfunc): Updated.
	(_bfd_sparc_elf_copy_indirect_symbol): Likewise.
	(_bfd_sparc_elf_check_relocs): Likewise.
	(readonly_dynrelocs): Likewise.
	(allocate_dynrelocs): Likewise.
	* elfxx-tilegx.c (tilegx_elf_link_hash_entry): Remove dyn_relocs.
	(link_hash_newfunc): Updated.
	(tilegx_elf_copy_indirect_symbol): Likewise.
	(tilegx_elf_check_relocs): Likewise.
	(readonly_dynrelocs): Likewise.
	(allocate_dynrelocs): Likewise.
	* elfxx-x86.c (elf_x86_allocate_dynrelocs): Likewise.
	(readonly_dynrelocs): Likewise.
	(_bfd_x86_elf_copy_indirect_symbol): Likewise.
	* elfxx-x86.h (elf_x86_link_hash_entry): Remove dyn_relocs.
2020-06-01 18:19:05 -07:00
Alan Modra c95949892f Replace "if (x) free (x)" with "free (x)", bfd
* aoutx.h: Replace "if (x) free (x)" with "free (x)" throughout.
	* archive.c, * bfd.c, * bfdio.c, * coff-alpha.c, * coff-ppc.c,
	* coff-sh.c, * coff-stgo32.c, * coffcode.h, * coffgen.c,
	* cofflink.c, * cpu-arm.c, * doc/chew.c, * dwarf2.c, * ecoff.c,
	* ecofflink.c, * elf-eh-frame.c, * elf-m10200.c, * elf-m10300.c,
	* elf-strtab.c, * elf.c, * elf32-arc.c, * elf32-arm.c,
	* elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c, * elf32-crx.c,
	* elf32-epiphany.c, * elf32-ft32.c, * elf32-h8300.c,
	* elf32-ip2k.c, * elf32-m32c.c, * elf32-m68hc11.c,
	* elf32-m68k.c, * elf32-microblaze.c, * elf32-msp430.c,
	* elf32-nds32.c, * elf32-nios2.c, * elf32-ppc.c, * elf32-pru.c,
	* elf32-rl78.c, * elf32-rx.c, * elf32-sh.c, * elf32-spu.c,
	* elf32-v850.c, * elf32-xtensa.c, * elf64-alpha.c,
	* elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c
	* elf64-mmix.c, * elf64-ppc.c, * elf64-sparc.c, * elfcode.h,
	* elflink.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-mips.c,
	* elfxx-x86.c, * format.c, * ihex.c, * libbfd.c, * linker.c,
	* mmo.c, * opncls.c, * pdp11.c, * peXXigen.c, * pef.c,
	* peicode.h, * simple.c, * som.c, * srec.c, * stabs.c, * syms.c,
	* targets.c, * vms-lib.c, * xcofflink.c, * xtensa-isa.c: Likewise.
2020-05-21 10:11:57 +09:30
Alan Modra 94ba9882d5 Power10 VSX 32-byte storage access
bfd/
	* elf64-ppc.c (xlate_pcrel_opt): Handle lxvp and stxvp.
opcodes/
	* ppc-opc.c (insert_xtp, extract_xtp): New functions.
	(XTP, DQXP, DQXP_MASK): Define.
	(powerpc_opcodes): Add lxvp, stxvp, lxvpx, stxvpx.
	(prefix_opcodes): Add plxvp and pstxvp.
gas/
	* testsuite/gas/ppc/vsx_32byte.d,
	* testsuite/gas/ppc/vsx_32byte.s: New test.
	* testsuite/gas/ppc/ppc.exp: Run it.
ld/
	* testsuite/ld-powerpc/pcrelopt.s: Add lxvp and stxvp.
	* testsuite/ld-powerpc/pcrelopt.d: Update.
2020-05-11 21:08:37 +09:30
Alan Modra 7c1f422735 PowerPC Rename powerxx to power10
Now that ISA3.1 is out we can finish with the powerxx silliness.

bfd/
	* elf64-ppc.c: Rename powerxx to power10 throughout.
gas/
	* config/tc-ppc.c (md_assemble): Update for PPC_OPCODE_POWER10
	renaming.
	* testsuite/gas/ppc/prefix-align.d: Use -mpower10/-Mpower10 in
	place of -mfuture/-Mfuture.
	* testsuite/gas/ppc/prefix-pcrel.d: Likewise.
	* testsuite/gas/ppc/prefix-reloc.d: Likewise.
gold/
	* powerpc.cc: Rename powerxx to power10 throughout.
include/
	* elf/ppc64.h: Update comment.
	* opcode/ppc.h (PPC_OPCODE_POWER10): Rename from PPC_OPCODE_POWERXX.
ld/
	* testsuite/ld-powerpc/callstub-1.d: Use -mpower10/-Mpower10 in
	place of -mfuture/-Mfuture.
	* testsuite/ld-powerpc/notoc2.d: Likewise.
	* testsuite/ld-powerpc/powerpc.exp: Likewise.
	* testsuite/ld-powerpc/tlsgd.d: Likewise.
	* testsuite/ld-powerpc/tlsie.d: Likewise.
	* testsuite/ld-powerpc/tlsld.d: Likewise.
opcodes/
	* ppc-dis.c (ppc_opts): Add "power10" entry.
	(print_insn_powerpc): Update for PPC_OPCODE_POWER10 renaming.
	* ppc-opc.c (POWER10): Rename from POWERXX.  Update all uses.
2020-05-11 21:08:36 +09:30
Alan Modra 2efec98b28 PowerPC64: remove empty .rela.dyn (.rela.branch_lt)
Stripping .rela.branch_lt is easy enough but messes with the
testsuite due to stub symbols (that use section id) changing.  Tests
that run on more than one target variant can be tricky to fix, this
renaming happened to work.

bfd/
	* elf64-ppc.c (ppc64_elf_size_stubs): Strip relbrlt too.
ld/
	* testsuite/ld-powerpc/tlsopt5.s: Rename foo to aaaaa.
	* testsuite/ld-powerpc/tlsopt5.d: Adjust to suit.
	* testsuite/ld-powerpc/tlsopt6.d: Likewise.
2020-04-20 08:14:42 +09:30
Alan Modra 2165dc8d90 PowerPC64 GOT reloc reserving PLT entry for ifunc
I can't see any reason why ELFv2 should create a PLT entry for ifuncs
referenced by GOT relocs as long as the GOT entry remains.  The GOT
entry ought to be resolved by ld.so to the value returned by the ifunc
resolver, or if there is global entry stub created for some other
reason, by the linker to the stub address.

	* elf64-ppc.c (ppc64_elf_check_relocs): Don't create plt entries
	for GOT relocs against ifuncs.
2020-04-16 15:43:19 +09:30
Alan Modra 06507dab61 PowerPC64 GOT reloc optimisation
When the symbol referenced by a GOT reloc is an ifunc, we can't
optimise away the GOT indirection.  Well, we can, but only if a global
entry stub is created with the ifunc symbol redefined to the stub.
But that results in slower code and an indirection via the PLT so
there isn't much to like about that solution.

	* elf64-ppc.c (ppc64_elf_edit_toc): Exclude ifunc from GOT
	optimisation.
	(ppc64_elf_relocate_section): Likewise.
2020-04-16 15:39:48 +09:30
Alan Modra 988b7300bc PR25745, powerpc64-ld overflows string buffer in --stats mode
PR 25745
	* elf64-ppc.c (ppc64_elf_build_stubs): Use asprintf to form
	statistics message.
2020-03-30 09:30:32 +10:30
Christophe Lyon 53215f214c Non-contiguous memory regions support: Avoid calls to abort
Use '%F' format when printing error messages to exit cleanly rather
than by calling abort().

2020-03-18  Christophe Lyon  <christophe.lyon@linaro.org>

	bfd/
	* elf32-arm.c (arm_build_one_stub): Emit a fatal error message
	instead of calling abort.
	* elf32-csky.c (csky_build_one_stub): Likewise.
	* elf32-hppa.c (hppa_build_one_stub): Likewise.
	* elf32-m68hc11.c (m68hc11_elf_build_one_stub): Likewise.
	* elf32-m68hc12.c (m68hc12_elf_build_one_stub): Likewise.
	* elf32-metag.c (metag_build_one_stub): Likewise.
	* elf32-nios2.c (nios2_build_one_stub): Likewise.
	* elf64-ppc.c (ppc_build_one_stub): Likewise.
	(ppc_size_one_stub): Likewise.
	* elfnn-aarch64.c (aarch64_build_one_stub): Likewise.

	ld/
	* emultempl/xtensaelf.em: Emit a fatal error message
	instead of calling abort.
	* ldlang.c: Likewise.

Change-Id: I60deaeeee59d4e7cab06b8a40a3e51837c43a8ab
2020-03-18 10:09:43 +00:00
Christophe Lyon abf874aafe Add support for non-contiguous memory regions
2020-01-06  Christophe Lyon  <christophe.lyon@linaro.org>

	bfd/
	* bfd-in2.h: Regenerate.
	* section.c (asection): Add already_assigned field.
	(BFD_FAKE_SECTION): Add default initializer for it.
	* ecoff.c (bfd_debug_section): Initialize already_assigned field.
	* elf32-arm.c (arm_build_one_stub): Add support for
	non_contiguous_regions.
	* elf32-csky.c (csky_build_one_stub): Likewise.
	* elf32-hppa.c (hppa_build_one_stub): Likewise.
	* elf32-m68hc11.c (m68hc11_elf_build_one_stub): Likewise.
	* elf32-m68hc12.c (m68hc12_elf_build_one_stub): Likewise.
	* elf32-metag.c (metag_build_one_stub): Likewise.
	* elf32-nios2.c (nios2_build_one_stub): Likewise.
	* elf64-ppc.c (ppc_build_one_stub): Likewise.
	(ppc_size_one_stub): Likewise.
	* elfnn-aarch64.c (aarch64_build_one_stub): Likewise.
	* elflink.c (elf_link_input_bfd): Likewise.

	include/
	* bfdlink.h (bfd_link_info): Add non_contiguous_regions and
	non_contiguous_regions_warnings fields.

	ld/
	* ldlang.c (lang_add_section): Add support for
	non_contiguous_regions.
	(size_input_section): Likewise.
	(lang_size_sections_1): Likewise.
	(process_insert_statements): Likewise.
	* ldlex.h (option_values): Add OPTION_NON_CONTIGUOUS_REGIONS and
	OPTION_NON_CONTIGUOUS_REGIONS_WARNINGS.
	* lexsup.c (ld_options): Add entries for
	--enable-non-contiguous-regions and
	--enable-non-contiguous-regions-warnings.
	(parse_args): Handle it.
	* NEWS: Add --enable-non-contiguous-regions and
	--enable-non-contiguous-regions-warnings.
	* ld.texi: Add --enable-non-contiguous-regions and
	--enable-non-contiguous-regions-warnings documentation.
	* emultempl/armelf.em (elf32_arm_add_stub_section): Add
	SEC_LINKER_CREATED flag.
	* emultempl/xtensaelf.em (ld_build_required_section_dependence):
	Emit an error when --enable-non-contiguous-regions is used.
	* testsuite/ld-elf/non-contiguous.d: New.
	* testsuite/ld-elf/non-contiguous.ld: New.
	* testsuite/ld-elf/non-contiguous.s: New.
	* testsuite/ld-arm/arm-elf.exp: Run the new tests.
	* testsuite/ld-arm/arm-elf/non-contiguous-arm.s: New.
	* testsuite/ld-arm/arm-elf/non-contiguous-arm.d: New.
	* testsuite/ld-arm/arm-elf/non-contiguous-arm.ld: New.
	* testsuite/ld-arm/arm-elf/non-contiguous-arm2.d: New.
	* testsuite/ld-arm/arm-elf/non-contiguous-arm3.ld: New.
	* testsuite/ld-arm/arm-elf/non-contiguous-arm3.d: New.
	* testsuite/ld-arm/arm-elf/non-contiguous-arm3.ld: New.
	* testsuite/ld-arm/arm-elf/non-contiguous-arm4.d: New.
	* testsuite/ld-arm/arm-elf/non-contiguous-arm4.ld: New.
	* testsuite/ld-arm/arm-elf/non-contiguous-arm5.d: New.
	* testsuite/ld-arm/arm-elf/non-contiguous-arm5.ld: New.
	* testsuite/ld-arm/arm-elf/non-contiguous-arm6.d: New.
	* testsuite/ld-arm/arm-elf/non-contiguous-arm6.ld: New.
	* testsuite/ld-powerpc/powerpc.exp: Run new tests.
	* testsuite/ld-powerpc/non-contiguous-powerpc.d: New.
	* testsuite/ld-powerpc/non-contiguous-powerpc.ld: New.
	* testsuite/ld-powerpc/non-contiguous-powerpc.sd: New.
	* testsuite/ld-powerpc/non-contiguous-powerpc64.d: New.
2020-03-13 14:44:45 +00:00
Alan Modra 435edf0bf2 powerpc64-ld infinite loop
If this code dealing with possible conversion of inline plt sequences
is ever executed, ld will hang.  A binary with such sequences and of
code size larger than approximately 90% the reach of an unconditional
branch is the trigger.  Oops.

	* elf64-ppc.c (ppc64_elf_inline_plt): Do increment rel in for loop.
2020-03-11 15:01:15 +10:30
Alan Modra bf57746745 ELF SEC_SMALL_DATA
For those ELF targets that have .sdata or .sbss sections, or similar
sections, arrange to mark the sections with the SEC_SMALL_DATA flag.
This fixes regressions in nm symbol type caused by removing .sdata
and .sbss from coff_section_type with commit 49d9fd42ac.

	* elf32-m32r.c (m32r_elf_section_flags): New function.
	(elf_backend_section_flags): Define.
	* elf32-nds32.c (nds32_elf_section_flags): New function.
	(elf_backend_section_flags): Define.
	* elf32-ppc.c (ppc_elf_section_from_shdr): Set SEC_SMALL_DATA for
	.sbss and .sdata sections.
	* elf32-v850.c (v850_elf_section_from_shdr): Set SEC_SMALL_DATA
	for SHF_V850_GPREL sections.
	* elf64-alpha.c (elf64_alpha_section_from_shdr): Delete outdated
	FIXME.
	* elf64-hppa.c (elf64_hppa_section_from_shdr): Set SEC_SMALL_DATA
	for SHF_PARISC_SHORT sections.
	* elf64-ppc.c (ppc64_elf_section_flags): New function.
	(elf_backend_section_flags): Define.
	* elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Set SEC_SMALL_DATA
	for SHF_MIPS_GPREL sections.  Delete FIXME.
2020-03-02 11:36:19 +10:30
Alan Modra 986f078366 bfd_size_type to size_t
bfd_size_type was invented a long time ago in the K&R days.  Many
places in binutils ought to be using size_t instead (and there are
lots of places that use long or unsigned long that really ought to use
size_t too).  Note that you can't change everything over to size_t: A
32-bit host needs a larger type than size_t to support reading and
processing of 64-bit ELF object files.  This patch just tidies some
of the more obvious uses of bfd_size_type that could be size_t.  There
no doubt are more lurking in the source.  Incidentally, practically
all functions used for output of object files can use size_t and don't
need to worry about overflow of size expressions.  If you have
something like
  symcount * sizeof (void *)
when symcount is counting symbols already in memory then you know that
this expression can't overflow since the size of a symbol in memory is
larger by far than that of a pointer.

	* aix386-core.c (aix386_core_file_p): Use size_t for "amt".
	* aout-target.h (object_p): Likewise.
	* aout-tic30.c (tic30_aout_object_p): Likewise.
	* aoutx.h (some_aout_object_p, mkobject, make_empty_symbol),
	(emit_stringtab, write_syms, link_hash_table_create),
	(aout_link_write_other_symbol): Likewise.
	* archive.c (_bfd_generic_mkarchive, bfd_generic_archive_p),
	(bfd_ar_hdr_from_filesystem, _bfd_write_archive_contents),
	(_bfd_compute_and_write_armap): Likewise.
	* archures.c (bfd_arch_list): Likewise.
	* bfd.c (bfd_record_phdr): Likewise.
	* binary.c (binary_canonicalize_symtab): Likewise.
	* cisco-core.c (cisco_core_file_validate): Likewise.
	* coff-arm.c (coff_arm_link_hash_table_create, find_thumb_glue),
	(find_arm_glue, record_arm_to_thumb_glue),
	(record_thumb_to_arm_glue): Likewise.
	* coff-ppc.c (ppc_coff_link_hash_table_create, record_toc),
	(ppc_allocate_toc_section): Likewise.
	* coff-rs6000.c (_bfd_xcoff_mkobject, _bfd_xcoff_archive_p): Likewise.
	* coff-sh.c (sh_relax_section): Likewise.
	* coff64-rs6000.c (xcoff64_archive_p): Likewise.
	* coffcode.h (handle_COMDAT, coff_new_section_hook),
	(coff_set_alignment_hook, coff_mkobject),
	(coff_compute_section_file_positions): Likewise.
	* coffgen.c (coff_make_empty_symbol, coff_bfd_make_debug_symbol),
	(coff_find_nearest_line_with_names),
	( bfd_coff_set_symbol_class): Likewise.
	* cofflink.c (_bfd_coff_link_hash_table_create),
	(_bfd_coff_link_input_bfd): Likewise.
	* dwarf1.c (alloc_dwarf1_unit, alloc_dwarf1_func): Likewise.
	* dwarf2.c (read_abbrevs, read_attribute_value, add_line_info),
	(build_line_info_table, sort_line_sequences),
	(line_info_add_include_dir, line_info_add_file_name),
	(decode_line_info, scan_unit_for_symbols, parse_comp_unit),
	(place_sections, _bfd_dwarf2_slurp_debug_info): Likewise.
	* ecoff.c (_bfd_ecoff_mkobject, _bfd_ecoff_make_empty_symbol),
	(_bfd_ecoff_find_nearest_line),
	(_bfd_ecoff_bfd_link_hash_table_create): Likewise.
	* ecofflink.c (bfd_ecoff_debug_init): Likewise.
	* elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Likewise.
	* elf-m10300.c (mn10300_elf_relax_section),
	(elf32_mn10300_link_hash_table_create): Likewise.
	* elf-strtab.c (_bfd_elf_strtab_init): Likewise.
	* elf.c (make_mapping, copy_elf_program_header): Likewise.
	* elf32-arm.c (elf32_arm_link_hash_table_create),
	(elf32_arm_setup_section_lists, elf32_arm_check_relocs),
	(elf32_arm_new_section_hook): Likewise.
	* elf32-avr.c (elf_avr_new_section_hook),
	(elf32_avr_link_hash_table_create, get_local_syms),
	(elf32_avr_setup_section_lists): Likewise.
	* elf32-bfin.c (bfinfdpic_elf_link_hash_table_create),
	(bfin_link_hash_table_create): Likewise.
	* elf32-cr16.c (elf32_cr16_link_hash_table_create): Likewise.
	* elf32-cris.c (elf_cris_link_hash_table_create): Likewise.
	* elf32-csky.c (csky_elf_link_hash_table_create),
	(csky_elf_check_relocs, elf32_csky_setup_section_lists): Likewise.
	* elf32-frv.c (frvfdpic_elf_link_hash_table_create): Likewise.
	* elf32-hppa.c (elf32_hppa_link_hash_table_create),
	(elf32_hppa_setup_section_lists, get_local_syms): Likewise.
	* elf32-i386.c (elf_i386_check_relocs): Likewise.
	* elf32-lm32.c (lm32_elf_link_hash_table_create): Likewise.
	* elf32-m32r.c (m32r_elf_link_hash_table_create),
	(m32r_elf_check_relocs): Likewise.
	* elf32-m68hc1x.c (m68hc11_elf_hash_table_create),
	(elf32_m68hc11_setup_section_lists),
	(elf32_m68hc11_size_stubs): Likewise.
	* elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise.
	* elf32-metag.c (elf_metag_link_hash_table_create),
	(elf_metag_setup_section_lists): Likewise.
	* elf32-microblaze.c (microblaze_elf_link_hash_table_create),
	(microblaze_elf_check_relocs): Likewise.
	* elf32-nds32.c (nds32_elf_link_hash_table_create),
	(nds32_elf_check_relocs): Likewise.
	* elf32-nios2.c (nios2_elf32_setup_section_lists),
	(get_local_syms, nios2_elf32_check_relocs),
	(nios2_elf32_link_hash_table_create): Likewise.
	* elf32-or1k.c (or1k_elf_link_hash_table_create),
	(or1k_elf_check_relocs): Likewise.
	* elf32-ppc.c (ppc_elf_modify_segment_map, update_plt_info): Likewise.
	* elf32-pru.c (pru_elf32_link_hash_table_create): Likewise.
	* elf32-s390.c (elf_s390_link_hash_table_create),
	(elf_s390_check_relocs): Likewise.
	* elf32-score.c (score_elf_create_got_section),
	(s3_elf32_score_new_section_hook),
	(elf32_score_link_hash_table_create): Likewise.
	* elf32-score7.c (score_elf_create_got_section),
	(s7_elf32_score_new_section_hook): Likewise.
	* elf32-sh.c (sh_elf_link_hash_table_create),
	(sh_elf_check_relocs): Likewise.
	* elf32-tic6x.c (elf32_tic6x_link_hash_table_create),
	(elf32_tic6x_new_section_hook, elf32_tic6x_check_relocs): Likewise.
	* elf32-tilepro.c (tilepro_elf_link_hash_table_create),
	(tilepro_elf_check_relocs): Likewise.
	* elf32-v850.c (remember_hi16s_reloc): Likewise.
	* elf32-vax.c (elf_vax_link_hash_table_create): Likewise.
	* elf32-xtensa.c (elf_xtensa_link_hash_table_create),
	(elf_xtensa_new_section_hook): Likewise.
	* elf64-alpha.c (elf64_alpha_bfd_link_hash_table_create),
	(get_got_entry, elf64_alpha_check_relocs): Likewise.
	* elf64-hppa.c (elf64_hppa_hash_table_create): Likewise.
	* elf64-ia64-vms.c (elf64_ia64_object_p): Likewise.
	* elf64-mmix.c (mmix_elf_new_section_hook): Likewise.
	* elf64-ppc.c (ppc64_elf_new_section_hook),
	(ppc64_elf_link_hash_table_create, update_local_sym_info),
	(update_plt_info, ppc64_elf_check_relocs): Likewise.
	* elf64-s390.c (elf_s390_link_hash_table_create),
	(elf_s390_check_relocs): Likewise.
	* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
	* elflink.c (bfd_elf_link_record_local_dynamic_symbol),
	(_bfd_elf_link_find_version_dependencies, elf_link_add_object_symbols),
	(elf_link_add_archive_symbols, compute_bucket_count),
	(bfd_elf_size_dynsym_hash_dynstr, _bfd_elf_link_hash_table_create),
	(bfd_elf_get_bfd_needed_list, elf_link_swap_symbols_out),
	(bfd_elf_final_link): Likewise.
	* elfnn-aarch64.c (elfNN_aarch64_link_hash_table_create),
	(elfNN_aarch64_setup_section_lists, elfNN_aarch64_check_relocs),
	(elfNN_aarch64_new_section_hook): Likewise.
	* elfnn-ia64.c (elfNN_ia64_object_p): Likewise.
	* elfnn-riscv.c (riscv_elf_link_hash_table_create),
	(riscv_elf_check_relocs): Likewise.
	* elfxx-mips.c (_bfd_mips_elf_new_section_hook),
	(_bfd_mips_elf_add_symbol_hook, _bfd_mips_elf_check_relocs),
	(_bfd_mips_elf_modify_segment_map, _bfd_mips_elf_set_section_contents),
	(_bfd_mips_elf_link_hash_table_create): Likewise.
	* elfxx-sparc.c (_bfd_sparc_elf_link_hash_table_create),
	(_bfd_sparc_elf_check_relocs),
	(_bfd_sparc_elf_new_section_hook): Likewise.
	* elfxx-tilegx.c (tilegx_elf_link_hash_table_create),
	(tilegx_elf_check_relocs): Likewise.
	* elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Likewise.
	* format.c (bfd_check_format_matches): Likewise.
	* hash.c (_bfd_stringtab_init): Likewise.
	* ihex.c (ihex_scan): Likewise.
	* irix-core.c (irix_core_core_file_p): Likewise.
	* linker.c (bfd_wrapped_link_hash_lookup),
	(_bfd_generic_link_hash_table_create),
	(_bfd_generic_reloc_link_order): Likewise.
	* lynx-core.c (lynx_core_file_p): Likewise.
	* netbsd-core.c (netbsd_core_file_p): Likewise.
	* osf-core.c (osf_core_core_file_p): Likewise.
	* pdp11.c (some_aout_object_p, mkobject, make_empty_symbol),
	(link_hash_table_create, aout_link_write_other_symbol): Likewise.
	* peXXigen.c (_bfd_XX_bfd_copy_private_section_data): Likewise.
	* peicode.h (pe_mkobject): Likewise.
	* ppcboot.c (ppcboot_mkobject, ppcboot_canonicalize_symtab): Likewise.
	* ptrace-core.c (ptrace_unix_core_file_p): Likewise.
	* sco5-core.c (read_uarea): Likewise.
	* som.c (hppa_som_gen_reloc_type, som_object_p, som_prep_headers),
	(som_write_fixups, som_write_space_strings, som_write_symbol_strings),
	(som_finish_writing, som_canonicalize_symtab, som_new_section_hook),
	(som_bfd_copy_private_section_data, bfd_som_set_section_attributes),
	(bfd_som_attach_aux_hdr, som_write_armap): Likewise.
	* srec.c (srec_scan): Likewise.
	* syms.c (_bfd_generic_make_empty_symbol): Likewise.
	* targets.c (bfd_target_list): Likewise.
	* tekhex.c (first_phase, tekhex_sizeof_headers): Likewise.
	* trad-core.c (trad_unix_core_file_p): Likewise.
	* vms-alpha.c (vms_initialize, alpha_vms_bfd_link_hash_table_create),
	(vms_new_section_hook): Likewise.
	* wasm-module.c (wasm_make_empty_symbol): Likewise.
	* xcofflink.c (xcoff_get_section_contents),
	(_bfd_xcoff_bfd_link_hash_table_create, xcoff_set_import_path),
	(xcoff_find_function, bfd_xcoff_link_record_set, xcoff_build_ldsym),
	(bfd_xcoff_size_dynamic_sections, xcoff_link_input_bfd): Likewise.
2020-02-19 13:12:00 +10:30
Alan Modra 6df4c9c2ff Re: Support fusion for ELFv2 stubs
git commit 397998fc32 changed the stubs but not the comments.

	* elf64-ppc.c (ppc_stub_plt_branch): Match comment with reality.
2020-02-05 07:12:48 +10:30
Alan Modra a804e4760a PowerPC64 tls_get_addr_desc static support
This provides a linker generated __tls_get_addr_desc wrapper function
preserving registers around a __tls_get_addr call.  The idea being to
support __tls_get_addr_desc without requiring a glibc update.

bfd/
	* elf64-ppc.c (struct ppc_link_hash_table): Add tga_group.
	(ppc64_elf_archive_symbol_lookup): Extract __tls_get_addr_opt for
	__tls_get_addr_desc.
	(ppc64_elf_size_stubs): Add section for linker generated
	__tls_get_addr_desc wrapper function.  Loop at least once if
	generating this function.
	(emit_tga_desc, emit_tga_desc_eh_frame): New functions.
	(ppc64_elf_build_stubs): Generate __tls_get_addr_desc.
ld/
	* testsuite/ld-powerpc/tlsdesc3.d,
	* testsuite/ld-powerpc/tlsdesc3.wf,
	* testsuite/ld-powerpc/tlsdesc4.d,
	* testsuite/ld-powerpc/tlsdesc4.s,
	* testsuite/ld-powerpc/tlsdesc4.wf: New tests.
	* testsuite/ld-powerpc/powerpc.exp: Run them.
2020-01-22 17:14:08 +10:30
Alan Modra 9e7028aa1e PowerPC64 __tls_get_addr_desc
This implements register saving and restoring in the __tls_get_addr
call stub, so that when glibc supports the optimized tls call stub gcc
can generate code that assumes only r0, r12 and of course r3 are
changed on a __tls_get_addr call.  When gcc expects __tls_get_addr
calls to preserve registers the call will be to __tls_get_addr_desc,
which will be translated by the linker to a call to __tls_get_addr_opt.

bfd/
	* elf64-ppc.h (struct ppc64_elf_params): Add no_tls_get_addr_regsave.
	* elf64-ppc.c (struct ppc_link_hash_table): Add tga_desc and
	tga_desc_fd.
	(is_tls_get_addr): Match tga_desc and tga_desc_df too.
	(STDU_R1_0R1, ADDI_R1_R1): Define.
	(tls_get_addr_prologue, tls_get_addr_epilogue): New functions.
	(ppc64_elf_tls_setup): Set up tga_desc and tga_desc_fd.  Indirect
	tga_desc_fd to opt_fd, and tga_desc to opt.  Set
	no_tls_get_addr_regsave.
	(branch_reloc_hash_match): Add hash3 and hash4.
	(ppc64_elf_tls_optimize): Handle tga_desc_fd and tga_desc too.
	(ppc64_elf_size_dynamic_sections): Likewise.
	(ppc64_elf_relocate_section): Likewise.
	(plt_stub_size, build_plt_stub): Likewise.  Size regsave
	__tls_get_addr stub.
	(build_tls_get_addr_stub): Build regsave __tls_get_addr stub and
	eh_frame.
	(ppc_size_one_stub): Handle tga_desc_fd and tga_desc too.  Size
	eh_frame for regsave __tls_get_addr.
gas/
	* config/tc-ppc.c (parse_tls_arg): Handle tls arg for
	__tls_get_addr_desc and __tls_get_addr_opt.
ld/
	* emultempl/ppc64elf.em (ppc64_opt, PARSE_AND_LIST_LONGOPTS),
	(PARSE_AND_LIST_OPTIONS, PARSE_AND_LIST_ARGS_CASES): Support
	--tls-get-addr-regsave and --no-tls-get-addr-regsave.
	(params): Init new field.
	* ld.texi (--tls-get-addr-regsave, --no-tls-get-addr-regsave):
	Document.
	* testsuite/ld-powerpc/tlsdesc.s,
	* testsuite/ld-powerpc/tlsdesc.d,
	* testsuite/ld-powerpc/tlsdesc.wf,
	* testsuite/ld-powerpc/tlsdesc2.d,
	* testsuite/ld-powerpc/tlsdesc2.wf,
	* testsuite/ld-powerpc/tlsexenors.d,
	* testsuite/ld-powerpc/tlsexenors.r,
	* testsuite/ld-powerpc/tlsexers.d,
	* testsuite/ld-powerpc/tlsexers.r,
	* testsuite/ld-powerpc/tlsexetocnors.d,
	* testsuite/ld-powerpc/tlsexetocrs.d,
	* testsuite/ld-powerpc/tlsexetocrs.r,
	* testsuite/ld-powerpc/tlsopt6.d,
	* testsuite/ld-powerpc/tlsopt6.wf: New.
	* testsuite/ld-powerpc/powerpc.exp: Run new tests.
2020-01-22 17:14:08 +10:30
Alan Modra abc489c64a PowerPC64 TLS optimization fix
When linking with --no-tls-optimize the linker doesn't generate a call
or long branch stub to __tls_get_addr in some circumstances, giving:

relocation truncated to fit: R_PPC64_REL24 against symbol `__tls_get_addr'

	* elf64-ppc.c (ppc64_elf_size_stubs): Correct condition under
	which __tls_get_addr calls will be eliminated.
2020-01-22 17:14:08 +10:30
Alan Modra b9ca1af69e Don't touch r11 in __tls_get_addr stub
This modifies the special __tls_get_addr stub that checks for a
tlsdesc style __tls_index entry and returns early.  Not using r11
isn't much benefit at the moment but a followup patch will preserve
regs around the first call to __tls_get_addr when the __tls_index
entry isn't yet set up for an early return.

bfd/
	* elf64-ppc.c (LD_R11_0R3, CMPDI_R11_0, STD_R11_0R1, LD_R11_0R1),
	(MTLR_R11): Don't define.
	(LD_R0_0R3, CMPDI_R0_0): Define.
	(build_tls_get_addr_stub): Don't use r11 in stub.
ld/
	* testsuite/ld-powerpc/tlsexe.d: Match new __tls_get_addr stub.
	* testsuite/ld-powerpc/tlsexeno.d: Likewise.
	* testsuite/ld-powerpc/tlsexetoc.d: Likewise.
	* testsuite/ld-powerpc/tlsexetocno.d: Likewise.
	* testsuite/ld-powerpc/tlsopt5.d: Likewise.
2020-01-20 18:58:05 +10:30
Alan Modra ed7007c18a PowerPC64 ppc_elf_hash_entry, defined_sym_val, is_tls_get_addr
* elf64-ppc.c (ppc_elf_hash_entry): New function, use throughout file.
	(defined_sym_val, is_tls_get_addr): Likewise.
2020-01-20 16:54:19 +10:30
Alan Modra e1c6cf618c PR25384, PowerPC64 ELFv1 copy relocs against function symbols
Function symbols of course don't normally want .dynbss copies but
with some old versions of gcc they are needed to copy the function
descriptor.  This patch restricts the cases where they are useful to
compilers using dot-symbols, and enables the warning regardless of
whether a PLT entry is emitted in the executable.  PLTs in shared
libraries are affected by a .dynbss copy in the executable.

bfd/
	PR 25384
	* elf64-ppc.c (ELIMINATE_COPY_RELOCS): Update comment.
	(ppc64_elf_adjust_dynamic_symbol): Don't allow .dynbss copies
	of function symbols unless dot symbols are present.  Do warn
	whenever one is created, regardles of whether a PLT entry is
	also emitted for the function symbol.
ld/
	* testsuite/ld-powerpc/ambiguousv1b.d: Adjust expected output.
	* testsuite/ld-powerpc/funref.s: Align func_tab.
	* testsuite/ld-powerpc/funref2.s: Likewise.
	* testsuite/ld-powerpc/funv1.s: Add dot symbols.
2020-01-15 12:29:21 +10:30
Alan Modra b3adc24a07 Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
Alan Modra 9ad9b810c3 PowerPC, use size_t rather than long for indices
This is fussing about nothing really but since I was looking at signed
vs. unsigned issues, I decided to use the correct types here.

	* elf32-ppc.c (ppc_elf_get_synthetic_symtab): Use size_t for vars.
	* elf64-ppc.c (sym_exists_at): Use size_t for lo, hi and mid.
2019-12-19 15:27:00 +10:30
Alan Modra 2365f8d70c Yet more signed overflow fixes
* elf-bfd.h (ELF_LOCAL_SYMBOL_HASH): Avoid signed overflow.
	* elf32-hppa.c (final_link_relocate): Likewise.
	* elf32-ppc.c (_bfd_elf_ppc_at_tls_transform): Likewise.
	(_bfd_elf_ppc_at_tprel_transform, is_insn_ds_form): Likewise.
	(is_insn_dq_form, ppc_elf_relocate_section): Likewise.
	* elf64-ppc.c (ok_lo_toc_insn, ppc64_elf_edit_toc): Likewise.
	(ppc64_elf_relocate_section): Likewise.
	* elfxx-mips.c (mips_elf_perform_relocation): Likewise.
	* netbsd.h (N_SET_FLAGS): Likewise.
2019-12-18 18:38:13 +10:30
Alan Modra bb2942085c Pass section when available to bfd_octets_per_byte
and other tidies.  I think it's better to default to passing the
section to bfd_octets_per_byte, even in cases where we know it won't
make a difference.

A number of the coff reloc functions used bfd_octets_per_byte wrongly,
not factoring it into the offset into the data buffer.  As it happens,
the targets using those files always had bfd_octets_per_byte equal to
one, so there wasn't any detectable wrong behaviour.  However, it is
wrong in the source and might cause trouble for anyone creating a new
target.  Besides fixing that, the patch also defines OCTETS_PER_BYTE
as one in target files where that is appropriate.

bfd/
	* archures.c (bfd_octets_per_byte): Tail call
	bfd_arch_mach_octets_per_byte.
	* coff-arm.c (OCTETS_PER_BYTE): Define.
	(coff_arm_reloc): Introduce new "octets" temp.  Use OCTETS_PER_BYTE
	with section.  Correct "addr".  Remove ATTRIBUTE_UNUSED.
	* coff-i386.c (coff_i386_reloc): Similarly.
	* coff-mips.c (mips_reflo_reloc): Similarly.
	* coff-x86_64.c (coff_amd64_reloc): Similarly.
	* elf32-msp430.c (OCTETS_PER_BYTE): Define.
	(rl78_sym_diff_handler): Use OCTETS_PER_BYTE, with section.
	* elf32-nds32.c (nds32_elf_get_relocated_section_contents): Similarly.
	* elf32-ppc.c (ppc_elf_addr16_ha_reloc): Similarly.
	* elf32-pru.c (pru_elf32_do_ldi32_relocate): Similarly.
	* elf32-s12z.c (opru18_reloc): Similarly.
	* elf32-sh.c (sh_elf_reloc): Similarly.
	* elf32-spu.c (spu_elf_rel9): Similarly.
	* elf32-xtensa.c (bfd_elf_xtensa_reloc): Similarly.
	* elf64-ppc.c (ppc64_elf_ha_reloc, ppc64_elf_brtaken_reloc),
	(ppc64_elf_toc64_reloc): Similarly.
	* bfd.c (bfd_get_section_limit): Pass section to bfd_octets_per_byte.
	* cofflink.c (_bfd_coff_link_input_bfd),
	(_bfd_coff_reloc_link_order): Likewise.
	* elf.c (_bfd_elf_section_offset): Likewise.
	* elflink.c (resolve_section, bfd_elf_perform_complex_relocation),
	(elf_link_input_bfd, elf_reloc_link_order, elf_fixup_link_order),
	(bfd_elf_final_link): Likewise.
	* elf.c (_bfd_elf_make_section_from_shdr): Don't strncmp twice
	to set SEC_ELF_OCTETS.
	* reloc.c (bfd_perform_relocation): Tidy SEC_ELF_OCTETS special case.
	(bfd_install_relocation): Likewise.
	(_bfd_final_link_relocate): Don't recalculate octets.
	* syms.c (_bfd_stab_section_find_nearest_line): Introduc new
	"octets" temp.
	* bfd-in2.h: Regenerate.
ld/
	* ldexp.c (fold_name): Pass section to bfd_octets_per_byte.
	* ldlang.c (init_opb): Don't call bfd_arch_mach_octets_per_byte
	unnecessarily.
2019-11-25 14:32:19 +10:30
Christian Eggers 618265039f Introduce new section flag: SEC_ELF_OCTETS
All symbols, sizes and relocations in this section are octets instead of
bytes.  Required for DWARF debug sections as DWARF information is
organized in octets, not bytes.

bfd/
	* section.c (struct bfd_section): New flag SEC_ELF_OCTETS.
	* archures.c (bfd_octets_per_byte): New parameter sec.
	If section is not NULL and SEC_ELF_OCTETS is set, one octet es
	returned [ELF targets only].
	* bfd.c (bfd_get_section_limit): Provide section parameter to
	bfd_octets_per_byte.
	* bfd-in2.h: regenerate.
	* binary.c (binary_set_section_contents): Move call to
	bfd_octets_per_byte into section loop. Provide section parameter
	to bfd_octets_per_byte.
	* coff-arm.c (coff_arm_reloc): Provide section parameter
	to bfd_octets_per_byte.
	* coff-i386.c (coff_i386_reloc): likewise.
	* coff-mips.c (mips_reflo_reloc): likewise.
	* coff-x86_64.c (coff_amd64_reloc): likewise.
	* cofflink.c (_bfd_coff_link_input_bfd): likewise.
	(_bfd_coff_reloc_link_order): likewise.
	* elf.c (_bfd_elf_section_offset): likewise.
	(_bfd_elf_make_section_from_shdr): likewise.
	Set SEC_ELF_OCTETS for sections with names .gnu.build.attributes,
	.debug*, .zdebug* and .note.gnu*.
	* elf32-msp430.c (rl78_sym_diff_handler): Provide section parameter
	to bfd_octets_per_byte.
	* elf32-nds.c (nds32_elf_get_relocated_section_contents): likewise.
	* elf32-ppc.c (ppc_elf_addr16_ha_reloc): likewise.
	* elf32-pru.c (pru_elf32_do_ldi32_relocate): likewise.
	* elf32-s12z.c (opru18_reloc): likewise.
	* elf32-sh.c (sh_elf_reloc): likewise.
	* elf32-spu.c (spu_elf_rel9): likewise.
	* elf32-xtensa.c (bfd_elf_xtensa_reloc): likewise
	* elf64-ppc.c (ppc64_elf_brtaken_reloc): likewise.
	(ppc64_elf_addr16_ha_reloc): likewise.
	(ppc64_elf_toc64_reloc): likewise.
	* elflink.c (bfd_elf_final_link): likewise.
	(bfd_elf_perform_complex_relocation): likewise.
	(elf_fixup_link_order): likewise.
	(elf_link_input_bfd): likewise.
	(elf_link_sort_relocs): likewise.
	(elf_reloc_link_order): likewise.
	(resolve_section): likewise.
	* linker.c (_bfd_generic_reloc_link_order): likewise.
	(bfd_generic_define_common_symbol): likewise.
	(default_data_link_order): likewise.
	(default_indirect_link_order): likewise.
	* srec.c (srec_set_section_contents): likewise.
	(srec_write_section): likewise.
	* syms.c (_bfd_stab_section_find_nearest_line): likewise.
	* reloc.c (_bfd_final_link_relocate): likewise.
	(bfd_generic_get_relocated_section_contents): likewise.
	(bfd_install_relocation): likewise.
	For section which have SEC_ELF_OCTETS set, multiply output_base
	and output_offset with bfd_octets_per_byte.
	(bfd_perform_relocation): likewise.
include/
	* coff/ti.h (GET_SCNHDR_SIZE, PUT_SCNHDR_SIZE, GET_SCN_SCNLEN),
	(PUT_SCN_SCNLEN): Adjust bfd_octets_per_byte calls.
binutils/
	* objdump.c (disassemble_data): Provide section parameter to
	bfd_octets_per_byte.
	(dump_section): likewise
	(dump_section_header): likewise. Show SEC_ELF_OCTETS flag if set.
gas/
	* as.h: Define SEC_OCTETS as SEC_ELF_OCTETS if OBJ_ELF.
	* dwarf2dbg.c: (dwarf2_finish): Set section flag SEC_OCTETS for
	.debug_line, .debug_info, .debug_abbrev, .debug_aranges, .debug_str
	and .debug_ranges sections.
	* write.c (maybe_generate_build_notes): Set section flag
	SEC_OCTETS for .gnu.build.attributes section.
	* frags.c (frag_now_fix): Don't divide by OCTETS_PER_BYTE if
	SEC_OCTETS is set.
	* symbols.c (resolve_symbol_value): Likewise.
ld/
	* ldexp.c (fold_name): Provide section parameter to
	bfd_octets_per_byte.
	* ldlang (init_opb): New argument s. Set opb_shift to 0 if
	SEC_ELF_OCTETS for the current section is set.
	(print_input_section): Pass current section to init_opb.
	(print_data_statement,print_reloc_statement,
	print_padding_statement): Likewise.
	(lang_check_section_addresses): Call init_opb for each
	section.
	(lang_size_sections_1,lang_size_sections_1,
	lang_do_assignments_1): Likewise.
	(lang_process): Pass NULL to init_opb.
2019-11-25 14:32:19 +10:30
Alan Modra 779f2ae733 PR25100, Compile fails in elf64-ppc.c because of single equal sign instead of double equal for comparison
PR 25100
	* elf64-ppc.c (sfpr_define): Delete dead code that triggered a warning.
2019-10-15 16:01:05 +10:30
Alan Modra dcea6a95d7 qsort issues
qsort isn't guaranteed to be a stable sort, that is, elements
comparing equal according to the comparison function may be reordered
relative to their original ordering.  Of course sometimes you may not
care, but even in those cases it is good to force some ordering
(ie. not have the comparison function return 0) so that linker output
is reproducible over different libc qsort implementations.

One way to make qsort stable (which the glibc manual incorrectly says
is the only way) is to augment the elements being sorted with a
monotonic counter of some kind, and use that counter as the final
arbiter of ordering in the comparison function.

Another way is to set up an array of pointers into the array of
elements, first pointer to first element, second pointer to second
element and so so, and sort the pointer array rather than the element
array.  Final arbiter in the comparison function then is the pointer
difference.  This works well with, for example, the symbol pointers
returned by _bfd_elf_canonicalize_symtab which point into a symbol
array.

This patch fixes a few places where sorting by symbol pointers is
appropriate, and adds comments where qsort stability is a non-issue.

	* elf-strtab.c (strrevcmp): Comment.
	* merge.c (strrevcmp): Likewise.
	* elf64-ppc.c (compare_symbols): Correct final pointer comparison.
	Comment on why comparing pointers ensures a stable sort.
	* elflink.c (struct elf_symbol): Add void* to union.
	(elf_sort_elf_symbol): Ensure a stable sort with pointer comparison.
	(elf_sym_name_compare): Likewise.
	(bfd_elf_match_symbols_in_sections): Style fix.
	(elf_link_sort_cmp1): Comment.
2019-10-14 16:47:12 +10:30
Alan Modra 93370e8e7b Re: PowerPC PIC vs. DLL TLS issues
A bug crept into commit f749f26eea, which could cause linker
segfaults when creating PIEs.  This patch fixes it.

	* elf64-ppc.c (ppc64_elf_size_dynamic_sections): Do allocate
	space for local got non-tls relocs when PIE.
2019-10-07 23:23:21 +10:30
Alan Modra 7d04a20ae4 PowerPC TLS miscounting PLT for __tls_get_addr
ppc*_elf_tls_optimize decrements the PLT refcount for __tls_get_addr
when a GD or LD sequence can be optimized.  Without tls marker relocs
this must be done when processing the argument setup relocations.
With marker relocs it's better done when processing the marker reloc.
But don't count them both ways.

Seen as "unresolvable R_PPC_REL24 relocation against symbol
`__tls_get_addr_opt'" (and other branch relocs).

	* elf32-ppc.c (ppc_elf_tls_optimize): Don't process R_PPC_TLSLD
	with non-local symbol.  Don't double count __tls_get_addr calls
	with marker relocs.
	* elf64-ppc.c (ppc64_elf_tls_optimize): Likewise.
2019-10-07 13:21:02 +10:30
Alan Modra 9737e8af48 PowerPC section flag tidy
has_tls_get_addr_call is no longer named correctly as the flag is
only set on finding a __tls_get_addr call without tlsld/tlsgd marker
relocations.

	* elf32-ppc.c (nomark_tls_get_addr): Rename from has_tls_get_addr_call
	throughout.
	* elf64-ppc.c (nomark_tls_get_addr): Likewise.
2019-10-07 13:18:32 +10:30
Alan Modra f749f26eea PowerPC PIC vs. DLL TLS issues
1) GOT entries generated for any of the GOT TLS relocations don't need
dynamic relocations for locally defined symbols in PIEs.  In the case
of a tls_index doubleword, the dtpmod entry is known to be 1, and the
dtprel entry is also known at link time and relative.  Similarly,
dtprel and tprel words are known at link time and relative.  (GOT
entries for other than TLS symbols are not relative and thus need
dynamic relocations in PIEs.)
2) Local dynamic TLS code is really only meant for accesses local to
the current binary.  There was a cheapskate test for this before using
the common tlsld_got slot, but the test wasn't exactly correct and
might confuse anyone looking at the code.  The proper test,
SYMBOL_REFERENCES_LOCAL isn't so expensive that it should be avoided.
3) The same cheap test for local syms when optimising TLS sequences
should be SYMBOL_REFERENCES_LOCAL too.

bfd/
	* elf64-ppc.c (ppc64_elf_check_relocs): Move initialisation of vars.
	(ppc64_elf_tls_optimize): Correct is_local condition.
	(allocate_got): Don't reserve dynamic relocations for any of the
	tls got relocs in PIEs when the symbol is local.
	(allocate_dynrelocs): Correct validity test for local sym using
	tlsld_got slot.
	(ppc64_elf_size_dynamic_sections): Don't reserve dynamic relocations
	for any of the tls got relocs in PIEs.
	(ppc64_elf_layout_multitoc): Likewise.
	(ppc64_elf_relocate_section): Correct validity test for local sym
	using tlsld_got slot.  Don't emit dynamic relocations for any of
	the tls got relocs in PIEs when the symbol is local.
	* elf32-ppc.c (ppc_elf_tls_optimize): Correct is_local condition.
	(got_relocs_needed): Delete.
	(allocate_dynrelocs): Correct validity test for local sym using
	tlsld_got slot.  Don't reserve dynamic relocations for any of the
	tls got relocs in PIEs when the symbol is local.
	(ppc_elf_size_dynamic_sections): Don't reserve dynamic relocations
	for any of the tls got relocs in PIEs.
	(ppc_elf_relocate_section): Correct validity test for local sym
	using tlsld_got slot.  Don't emit dynamic relocations for any of
	the tls got relocs in PIEs when the symbol is local.
ld/
	* testsuite/ld-powerpc/tlsso.d: Adjust to suit tlsld_got usage change.
	* testsuite/ld-powerpc/tlsso.g: Likewise.
	* testsuite/ld-powerpc/tlsso.r: Likewise.
	* testsuite/ld-powerpc/tlsso32.d: Likewise.
	* testsuite/ld-powerpc/tlsso32.g: Likewise.
	* testsuite/ld-powerpc/tlsso32.r: Likewise.
2019-10-04 22:53:56 +09:30
Alan Modra ec73ddcd43 PowerPC64 dynamic symbol tweaks
In check_relocs, bfd_link_pic true means ld is producing a shared
library or a position independent executable.  !bfd_link_pic means a
fixed position (ie. static) executable since the relocatable linking
case is excluded.  So it is appropriate to continue using bfd_link_pic
when testing whether non-pcrelative relocations should be dynamic, and
!bfd_link_pic for the special case of ifunc in static executables.
However, -Bsymbolic shouldn't affect PIEs (they are executables so
none of their symbols should be overridden) and PIEs can support copy
relocations, thus bfd_link_executable should be used in those cases
rather than bfd_link_pic.

I've also removed the test of ELIMINATE_COPY_RELOCS in check_relocs.
We can sort out what to do regarding copy relocs later, which allows
the code in check_relocs to be simplified.

	* elf64-ppc.c (ppc64_elf_check_relocs): Use bfd_link_executable
	in choosing between different actions for shared library and
	non-shared library cases.  Delete ELIMINATE_COPY_RELOCS test.
	(dec_dynrel_count): Likewise.  Account for ifunc special case.
	(ppc64_elf_adjust_dynamic_symbol): Copy relocs are for executables,
	not non-pic.
	(allocate_dynrelocs): Comment fixes.  Delete ELIMINATE_COPY_RELOCS
	test.
2019-09-23 23:49:25 +09:30
Alan Modra e59a100122 PowerPC64, error on unsupported dynamic relocation
This patch corrects the set of dynamic relocations recognised by gold
as supported by glibc, and teaches ld.bfd to report an error similar
to the gold error.  Note that ld --noinhibit-exec can be used to
produce an output, supporting older ld with newer glibc if the set of
supported glibc dynamic relocations changes.

bfd/
	* elf64-ppc.c (ppc64_glibc_dynamic_reloc): New function.
	(ppc64_elf_relocate_section): Error if emitting unsupported
	dynamic relocations.
gold/
	* powerpc.cc (Target_powerpc::Scan::check_non_pic): Move REL24
	to 32-bit supported.
2019-09-20 12:51:19 +09:30
Alan Modra fd3619828e bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions.  The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections.  Those sections shouldn't be modified
anyway.

The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma.  I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section.  This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.

bfd/
	* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
	(bfd_get_section_lma, bfd_get_section_alignment),
	(bfd_get_section_size, bfd_get_section_flags),
	(bfd_get_section_userdata): Delete.
	(bfd_section_name, bfd_section_size, bfd_section_vma),
	(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
	(bfd_section_flags, bfd_section_userdata): New.
	(bfd_is_com_section): Rename parameter.
	* section.c (bfd_set_section_userdata, bfd_set_section_vma),
	(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
	(bfd_set_section_size): Delete bfd parameter, rename section parameter.
	(bfd_set_section_lma): New.
	* bfd-in2.h: Regenerate.
	* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
	update callers.
	* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
	* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
	* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
	* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
	* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
	* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
	* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
	* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
	* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
	* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
	* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
	* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
	* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
	* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
	* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
	* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
	* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
	* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
	* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
	* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
	* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
	* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
	* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
	* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
	* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
	* xcofflink.c: Update throughout for bfd section macro and function
	changes.
binutils/
	* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
	* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
	* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
	* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
	throughout for bfd section macro and function changes.
gas/
	* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
	* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
	* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
	* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
	* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
	* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
	* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
	* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
	* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
	* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
	* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
	* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
	* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
	* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
	* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
	* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
	* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
	* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
	* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
	* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
	* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
	* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
	* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
	bfd section macro and function changes.
	* write.c (compress_debug): Use bfd_rename_section.
gdb/
	* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
	* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
	* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
	* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
	* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
	* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
	* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
	* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
	* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
	* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
	* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
	* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
	* solib-spu.c, * solib-svr4.c, * solib-target.c,
	* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
	* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
	* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
	* mi/mi-interp.c: Update throughout for bfd section macro and
	function changes.
	* gcore (gcore_create_callback): Use bfd_set_section_lma.
	* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
	* corefile.c, * symtab.c: Update throughout for bfd section
	macro and function changes.
ld/
	* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
	* emultempl/aarch64elf.em, * emultempl/aix.em,
	* emultempl/armcoff.em, * emultempl/armelf.em,
	* emultempl/cr16elf.em, * emultempl/cskyelf.em,
	* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
	* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
	* emultempl/mmo.em, * emultempl/msp430.em,
	* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
	* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
	throughout for bfd section macro and function changes.
libctf/
	* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
	* arc-ext.c: Update throughout for bfd section macro changes.
sim/
	* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
	* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
	* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
	* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
	* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-19 09:40:13 +09:30
Alan Modra 1bdd8facfb PowerPC64, support medium model access to common symbols
Some versions of clang apparently generate non-PIC on powerpc64le to
access common symbols.  Since a common symbol and a strong definition
with the same name should resolve to the strong definition we have the
possibility of non-PIC attempting to access shared library variables.
This is really a clanger since powerpc64le is supposed to be PIC by
default, but let's see if ld can cope by generating .dynbss copies.

	* elf64-ppc.c (must_be_dyn_reloc): Return 0 for TOC16 relocs.
	(ppc64_elf_check_relocs): Support dynamic/copy relocs for TOC16.
	(ppc64_elf_adjust_dynamic_symbol): Don't keep dynamic reloc when
	needs_copy even if all relocs are in rw sections.
	(dec_dynrel_count): Handle TOC16 relocs.
	(ppc64_elf_relocate_section): Support dynamic relocs for TOC16.
	(ppc64_elf_finish_dynamic_symbol): Adjust to handle needs_copy
	semantic change.
2019-09-18 21:32:51 +09:30
Alan Modra 133a1f6041 PowerPC64 GOT_PCREL relocs
PC-relative relocs typically use the addend in adjusting what they are
relative to.  For example:
	bcl 20,31,1f
1:	mflr 12
	addi 12,12,xxx-1b
generates "R_PPC64_REL16 xxx+0x4" for the addi (when little-endian).
The addend reflects the fact that you want the offset relative to the
previous insn not the current one in this case.

So the question is, will we ever want to do something like that for an
instruction using R_PPC64_GOT_PCREL34?  I thought so at the time I
first implemented support in ld but at the time I think the hardware
was possibly going to support pcrel+offset+reg addressing.  In which
case you might want something like:
	load_big_offset_into_r2
	pld 3,sym-big_offset@got@pcrel(2)
which would be a way of supporting more than 8G offsets from code to
the GOT.  We could do the same with
	load_big_offset_into_r2
	pla 9,sym-big_offset@got@pcrel
	ldx 3,9,2
However, this is really a poor version of TOC-pointer relative code.

So let's go with an addend on R_PPC64_GOT_PCREL34 meaning that
sym+addend should be put in a GOT entry, and the relocation calculate
the pc-relative offset to that GOT entry.

Note that this is an extension to the ABI, which says (by the
expression given for GOT relocs) that non-zero addends on GOT and PLT
relocs are ignored.  This is true for all GOT/PLT relocs, not just the
pcrel ones.

	* elf64-ppc.c (ppc64_elf_check_relocs): Interpret an addend in
	GOT_PCREL and PLT_PCREL relocs as affecting the value stored
	in the GOT/PLT entry rather than affecting the offset to that
	GOI/PLT entry.
	(ppc64_elf_edit_toc, ppc64_elf_relocate_section): Likewise.
2019-09-05 15:25:51 +09:30
Alan Modra 77486630b1 R_PPC64_PCREL_OPT
The loads and stores handled in the second instruction of a sequence
marked by R_PPC64_PCREL_OPT may be a prefix instruction.  For example:
 pld ra,symbol@got@pcrel
0:
 pld rt,off(ra)
 .reloc 0b-8,R_PPC64_PCREL_OPT,(.-8)-(0b-8)
can be optimised to
 pld rt,symbol+off@pcrel
 pnop

	* elf64-ppc.c (xlate_pcrel_opt): Handle prefix loads and stores
	in second instruction.
	(ppc64_elf_relocate_section): Likewise.
2019-09-05 13:56:20 +09:30
Alan Modra dd9b12c245 PowerPC64 xlate_pcrel_opt
We can easily support an offset on the second instruction of a
sequence marked with R_PPC64_PCREL_OPT.  For example,
  pla ra,symbol@pcrel
  ld rt,off(ra)
can be optimised to
  pld rt,symbol+off@pcrel
  nop

	* elf64-ppc.c (xlate_pcrel_opt): Add poff parameter.  Allow offset
	on second insn, return it in poff.
	(ppc64_elf_relocate_section): Add offset to paddi addend for
	PCREL_OPT.
2019-08-29 12:57:33 +09:30
Alan Modra 6d5554a605 PowerPC64 segfault in ppc64_elf_edit_toc
Found on a GOT reference to __ehdr_start, which is tweaked to be
undefined weak at some stages of linking.  SYMBOL_REFERENCES_LOCAL
isn't a sufficient test.

	* elf64-ppc.c (ppc64_elf_edit_toc): Exclude undefined weak
	symbols from GOT optimisation.
2019-08-24 10:05:40 +09:30
Alan Modra 903b777dde PowerPC64 ha/lo insn checks
These are done in ppc64_elf_edit_toc, which now also garbage collects
unused GOT entries.  The checks for legitimate instructions weren't
being done for the GOT relocs, unless the file also happened to have a
toc section.

	* elf64-ppc.c (struct ppc64_elf_obj_tdata): Rename has_gotrel
	to has_optrel.
	(struct _ppc64_elf_section_data): Likewise.
	(ppc64_elf_check_relocs): Set has_optrel for more relocs.
	(ppc64_elf_edit_toc): Do ha/lo insn checks in GOT loop rather
	than TOC loop.  Check PLT16 insns too.
2019-08-19 20:38:51 +09:30
Alan Modra c213164ad2 [PowerPC64] pc-relative TLS relocations
This patch supports using pcrel instructions in TLS code sequences.  A
number of new relocations are needed, gas operand modifiers to
generate those relocations, and new TLS optimisation.  For
optimisation it turns out that the new pcrel GD and LD sequences can
be distinguished from the non-pcrel GD and LD sequences by there being
different relocations on the new sequence.  The final "add ra,rb,13"
on IE sequences similarly needs a new relocation, or as I chose, a
modification of R_PPC64_TLS.  On pcrel IE code, the R_PPC64_TLS points
one byte into the "add" instruction rather than being on the
instruction boundary.

GD:
 pla 3,z@got@tlsgd@pcrel	  # R_PPC64_GOT_TLSGD34
 bl __tls_get_addr@notoc(z@tlsgd) # R_PPC64_TLSGD and R_PPC64_REL24_NOTOC
  edited to IE
   pld 3,z@got@tprel@pcrel
   add 3,3,13
  edited to LE
   paddi 3,13,z@tprel
   nop

LD:
 pla 3,z@got@tlsld@pcrel	  # R_PPC64_GOT_TLSLD34
 bl __tls_get_addr@notoc(z@tlsld) # R_PPC64_TLSLD and R_PPC64_REL24_NOTOC
 ..
 paddi 9,3,z2@dtprel
 pld 10,z3@got@dtprel@pcrel
 add 10,10,3
  edited to LE
   paddi 3,13,0x1000
   nop

IE:
 pld 9,z@got@tprel@pcrel	  # R_PPC64_GOT_TPREL34
 add 3,9,z@tls@pcrel		  # R_PPC64_TLS at insn+1
 ldx 4,9,z@tls@pcrel
 lwax 5,9,z@tls@pcrel
 stdx 5,9,z@tls@pcrel
  edited to LE
  paddi 9,13,z@tprel
  nop
  ld 4,0(9)
  lwa 5,0(9)
  std 5,0(9)

LE:
 paddi 10,13,z@tprel

include/
	* elf/ppc64.h (R_PPC64_TPREL34, R_PPC64_DTPREL34),
	(R_PPC64_GOT_TLSGD34, R_PPC64_GOT_TLSLD34),
	(R_PPC64_GOT_TPREL34, R_PPC64_GOT_DTPREL34): Define.
	(IS_PPC64_TLS_RELOC): Include new tls relocs.
bfd/
	* reloc.c (BFD_RELOC_PPC64_TPREL34, BFD_RELOC_PPC64_DTPREL34),
	(BFD_RELOC_PPC64_GOT_TLSGD34, BFD_RELOC_PPC64_GOT_TLSLD34),
	(BFD_RELOC_PPC64_GOT_TPREL34, BFD_RELOC_PPC64_GOT_DTPREL34),
	(BFD_RELOC_PPC64_TLS_PCREL): New pcrel tls relocs.
	* elf64-ppc.c (ppc64_elf_howto_raw): Add howtos for pcrel tls relocs.
	(ppc64_elf_reloc_type_lookup): Translate pcrel tls relocs.
	(must_be_dyn_reloc, dec_dynrel_count): Add R_PPC64_TPREL64.
	(ppc64_elf_check_relocs): Support pcrel tls relocs.
	(ppc64_elf_tls_optimize, ppc64_elf_relocate_section): Likewise.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
gas/
	* config/tc-ppc.c (ppc_elf_suffix): Map "tls@pcrel", "got@tlsgd@pcrel",
	"got@tlsld@pcrel", "got@tprel@pcrel", and "got@dtprel@pcrel".
	(fixup_size, md_assemble): Handle pcrel tls relocs.
	(ppc_force_relocation, ppc_fix_adjustable): Likewise.
	(md_apply_fix, tc_gen_reloc): Likewise.
ld/
	* testsuite/ld-powerpc/tlsgd.d,
	* testsuite/ld-powerpc/tlsgd.s,
	* testsuite/ld-powerpc/tlsie.d,
	* testsuite/ld-powerpc/tlsie.s,
	* testsuite/ld-powerpc/tlsld.d,
	* testsuite/ld-powerpc/tlsld.s: New tests.
	* testsuite/ld-powerpc/powerpc.exp: Run them.
2019-07-19 18:01:25 +09:30
Alan Modra 71c4e95abe [PowerPC64] Use STN_UNDEF internally for edited relocs
It's not correct to use non-STT_TLS symbols with TLS relocation, not
that it matters much when editing relocs, but this edited reloc can be
output by --emit-relocs.  So don't use a symbol on the reloc.

	* elf64-ppc.c (ppc64_elf_relocate_section): Don't bother selecting
	a TLS section symbol for edited relocs.  Tighten TLS symbol/reloc
	match test.
2019-07-18 22:17:30 +09:30
Alan Modra 46e9995a20 [PowerPC64] Don't store TLS_EXPLICIT in tls_mask
This saves a bit in tls_mask, and fixes a bug that could be triggered
in the unlikely case that both @got (usual ELF style) and @toc
(PowerOpen style) code was used to set up args for __tls_get_addr.

	* elf64-ppc.c (TLS_EXPLICIT): Define as 256.
	(ppc64_elf_check_relocs): Don't store TLS_EXPLICIT even if char
	is more than 8 bits.
	(ppc64_elf_tls_optimize): Likewise.  Make tls_set, tls_clear, and
	tls_type vars unsigned int.
	(ppc64_elf_relocate_section): Use r_type rather than TLS_EXPLICIT
	to select r_type edit.
2019-07-18 22:17:30 +09:30
Alan Modra b00a0a86c4 [PowerPC] Rename TLS_TPRELGD to TLS_GDIE
Choose a better name, that reflects why the flag is set (GD to IE
optimisation) rather than what the flag produces (TPREL64 reloc on
a single GOT entry replacing a tls_index pair).

	* elf32-ppc.c (TLS_GDIE): Rename from TLS_TPRELGD throughout file.
	Correct comment.
	* elf64-ppc.c (TLS_GDIE): Likewise.
2019-07-18 22:17:30 +09:30
Alan Modra 0b1474281c [PowerPC64] correct tprel offset limit
I don't expect anyone will have hit this bug.  You'd need a TLS
segment of 2G before you'd notice.

	* elf64-ppc.c (ppc64_elf_tls_optimize): Correct test for allowed
	range of tp-relative offsets.
2019-07-18 22:17:29 +09:30
Alan Modra f26a32876b Dynamic TLS section symbols
It is possible to create shared libraries on PowerPC using
-ftls-model=inital-exec or -ftls-model=local-exec.  The first is half
reasonable, getting you a shared library that can't be dlopen'd but
otherwise is reasonable.  The second is quite bad.  Not only do you
lose being able to dlopen, the library also has dynamic text
relocations.  Worse, the TPREL16_LO, TPREL16_HA and other TPREL16
dynamic relocs emitted were wrong, resulting in wrong values being
applied by ld.so.

Using the first TLS section symbol in dynamic relocations for local
TLS symbols doesn't work.  It's wrong because TLS symbols used by TLS
relocs have values relative to the TLS segment, whereas the TLS
section symbols are addresses.  This patch instead uses a symbol index
of zero which is used elsewhere by PowerPC on dynamic TLS relocs.
It's not strictly ABI compliant to use a non-TLS symbol with TLS
relocs but symbol index zero can be interpreted as "no symbol".  Not
using the first TLS section symbol means it doesn't need to be dynamic.

The patch also fixes a further problem with PowerPC32 dynamic TPREL16*
relocs, which shouldn't have the symbol value in the addend as we do
for non-TLS symbols.

bfd/
	* elflink.c (_bfd_elf_omit_section_dynsym_default): Don't keep
	tls_sec.
	(_bfd_elf_init_1_index_section): Prefer not using TLS sections.
	(_bfd_elf_init_2_index_sections): Likewise.
	* elf64-ppc.c (ppc64_elf_relocate_section): When emitting dynamic
	relocations for local TLS symbols, use STN_UNDEF as the relocation
	symbol.
	* elf32-ppc.c (ppc_elf_relocate_section): Likewise, and don't
	leave TLS symbol value in the addend.
ld/
	* testsuite/ld-powerpc/tlsso.r: Update.
	* testsuite/ld-powerpc/tlsso32.g: Update.
	* testsuite/ld-powerpc/tlsso32.r: Update.
	* testsuite/ld-powerpc/tlstocso.r: Update.
	* testsuite/ld-cris/tls-dso-dtpoffd2.d: Update.
	* testsuite/ld-cris/tls-dso-dtpoffd4.d: Update.
	* testsuite/ld-cris/tls-dso-tpoffgotcomm1.d: Update.
	* testsuite/ld-cris/tls-gd-1.d: Update.
	* testsuite/ld-cris/tls-gd-1h.d: Update.
	* testsuite/ld-cris/tls-gd-2.d: Update.
	* testsuite/ld-cris/tls-gd-2h.d: Update.
	* testsuite/ld-cris/tls-ie-10.d: Update.
	* testsuite/ld-cris/tls-ie-11.d: Update.
	* testsuite/ld-cris/tls-ie-8.d: Update.
	* testsuite/ld-cris/tls-ie-9.d: Update.
	* testsuite/ld-cris/tls-js1.d: Update.
	* testsuite/ld-cris/tls-ld-4.d: Update.
	* testsuite/ld-cris/tls-ld-5.d: Update.
	* testsuite/ld-cris/tls-ld-6.d: Update.
	* testsuite/ld-cris/tls-ld-7.d: Update.
	* testsuite/ld-cris/tls-ldgd-14.d: Update.
	* testsuite/ld-cris/tls-ldgd-15.d: Update.
	* testsuite/ld-cris/tls-ldgdx-14.d: Update.
	* testsuite/ld-cris/tls-ldgdx-15.d: Update.
	* testsuite/ld-cris/tls-local-54.d: Update.
	* testsuite/ld-cris/tls-local-60.d: Update.
	* testsuite/ld-cris/tls-local-61.d: Update.
	* testsuite/ld-cris/tls-local-63.d: Update.
	* testsuite/ld-cris/tls-local-64.d: Update.
	* testsuite/ld-cris/tls-ok-30.d: Update.
	* testsuite/ld-cris/tls-ok-32.d: Update.
	* testsuite/ld-cris/tls-ok-34.d: Update.
	* testsuite/ld-mips-elf/tls-multi-got-1.got: Update.
	* testsuite/ld-mips-elf/tls-multi-got-1.r: Update.
	* testsuite/ld-mips-elf/tlsdyn-pie-o32.d: Update.
	* testsuite/ld-mips-elf/tlsdyn-pie-o32.got: Update.
	* testsuite/ld-mips-elf/tlslib-o32-hidden.got: Update.
	* testsuite/ld-mips-elf/tlslib-o32-ver.got: Update.
	* testsuite/ld-mips-elf/tlslib-o32.got: Update.
	* testsuite/ld-s390/tlspic.rd: Update.
	* testsuite/ld-s390/tlspic_64.rd: Update.
	* testsuite/ld-sparc/tlssunnopic32.rd: Update.
	* testsuite/ld-sparc/tlssunnopic64.rd: Update.
	* testsuite/ld-sparc/tlssunpic32.rd: Update.
	* testsuite/ld-sparc/tlssunpic64.rd: Update.
2019-07-13 09:57:50 +09:30