]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
MIPS: Correct HI/LO rel reloc howto special_function entries
authorAlan Modra <amodra@gmail.com>
Sat, 12 Jul 2025 00:25:53 +0000 (01:25 +0100)
committerMaciej W. Rozycki <macro@orcam.me.uk>
Sat, 12 Jul 2025 00:25:53 +0000 (01:25 +0100)
commit78f28b69ff1cdd8fcdf1944cfd82ea45f23e94d2
treee1d1e93662803251bf61161fe27276cd109bcc21
parent68f5cb38c27699e9b4840f22596ede96762c4796
MIPS: Correct HI/LO rel reloc howto special_function entries

This corrects the DTPREL_HI16/LO16 and TPREL_HI16/LO16 howtos to use
_bfd_mips_elf_{hi,lo}16_reloc special functions, in order to support
addends outside the range [0,32767] on these relocations.

R_MIPS_GOT_HI16, R_MIPS_GOT_LO16, R_MIPS_CALL_HI16 and R_MIPS_CALL_LO16
are left alone as it seems that we (quite reasonably) only support
zero addends for those relocs.

PR 19977
bfd/
* elf32-mips.c (elf_mips_howto_table_rel): Set special_function
to _bfd_mips_elf_hi16_reloc for R_MIPS_TLS_DTPREL_HI16 and
R_MIPS_TLS_TPREL_HI16.  Set special_function to
_bfd_mips_elf_lo16_reloc for R_MIPS_TLS_DTPREL_LO16 and
R_MIPS_TLS_TPREL_LO16
(elf_mips16_howto_table_rel): Likewise for
R_MIPS16_TLS_DTPREL_HI16, R_MIPS16_TLS_DTPREL_LO16,
R_MIPS16_TLS_TPREL_HI16 and R_MIPS16_TLS_TPREL_LO16.
(elf_micromips_howto_table_rel): Likewise for
R_MICROMIPS_TLS_DTPREL_HI16, R_MICROMIPS_TLS_DTPREL_LO16,
R_MICROMIPS_TLS_TPREL_HI16 and R_MICROMIPS_TLS_TPREL_LO16.
* elf64-mips.c (mips_elf64_howto_table_rel): Similarly.
(mips16_elf64_howto_table_rel): Similarly.
(micromips_elf64_howto_table_rel): Similarly.
* elfn32-mips.c: As for elf64-mips.c.
gas/
* testsuite/gas/mips/pr19977.d,
* testsuite/gas/mips/pr19977.s: New test.
* testsuite/gas/mips/mips.exp: Run it.
bfd/elf32-mips.c
bfd/elf64-mips.c
bfd/elfn32-mips.c
gas/testsuite/gas/mips/mips.exp
gas/testsuite/gas/mips/pr19977.d [new file with mode: 0644]
gas/testsuite/gas/mips/pr19977.s [new file with mode: 0644]