MIPS: Fix linker for REL TLS HI16/LO16 relocs

With REL targets TLS HI16/LO16 relocations need to combine the low part
with the high part just as all the remaining HI16/LO16 relocations, so
as to determine the borrow in calculation correctly.

2025-07-12  Alan Modra  <amodra@gmail.com>

bfd/
	PR 19977
	* elfxx-mips.c (tls_hi16_reloc_p): New function.
	(mips_elf_add_lo16_rel_addend): Handle tls relocs.
	(_bfd_mips_elf_relocate_section): Likewise.

2025-07-12  Maciej W. Rozycki  <macro@orcam.me.uk>

ld/
	PR 19977
	* testsuite/ld-mips-elf/pr19977.d: New test.
	* testsuite/ld-mips-elf/pr19977-mips16.d: New test.
	* testsuite/ld-mips-elf/pr19977-micromips.d: New test.
	* testsuite/ld-mips-elf/pr19977-r.d: New test.
	* testsuite/ld-mips-elf/pr19977-r-mips16.d: New test.
	* testsuite/ld-mips-elf/pr19977-r-micromips.d: New test.
	* testsuite/ld-mips-elf/pr19977-r.s: New test source.
	* testsuite/ld-mips-elf/pr19977.ld: New test linker script.
	* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
10 files changed