MIPS/BFD: Also handle `jalr $0, $25' with R_MIPS_JALR
authorMaciej W. Rozycki <macro@imgtec.com>
Tue, 28 Feb 2017 00:14:08 +0000 (00:14 +0000)
committerMaciej W. Rozycki <macro@imgtec.com>
Tue, 28 Feb 2017 00:22:36 +0000 (00:22 +0000)
commit0e39210161e7c547ab53afb86997303e24a42c0c
treed9e7851d07bece63eb64bb4e283d70f7b59932ca
parent279a558a4d0fad268738ec916628c9c12cfcaf5b
MIPS/BFD: Also handle `jalr $0, $25' with R_MIPS_JALR

Interpret the `jalr $0, $25' instruction encoding with an R_MIPS_JALR
relocation attached as an alias to `jr $25' and convert the jump to an
equivalent branch where possible, consequently covering the MIPSr6
architecture for the purpose of this optimization too.

bfd/
* elfxx-mips.c (mips_elf_perform_relocation): Also handle the
`jalr $0, $25' instruction encoding.

gas/
* testsuite/gas/mips/jalr4.s: Add `jalr $0, $25' instructions.
* testsuite/gas/mips/jalr4.d: Adjust accordingly.  Remove MIPSr6
encoding patterns.
* testsuite/gas/mips/jalr4-n64.d: Likewise.
* testsuite/gas/mips/mipsr6@jalr4.d: New test.
* testsuite/gas/mips/mipsr6@jalr4-n32.d: New test.
* testsuite/gas/mips/mipsr6@jalr4-n64.d: New test.

ld/
* testsuite/ld-mips-elf/jalr4.dd: Adjust for `jalr $0, $25'
instructions.
* testsuite/ld-mips-elf/jalr4-r6.dd: New test.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new test.
13 files changed:
bfd/ChangeLog
bfd/elfxx-mips.c
gas/ChangeLog
gas/testsuite/gas/mips/jalr4-n64.d
gas/testsuite/gas/mips/jalr4.d
gas/testsuite/gas/mips/jalr4.s
gas/testsuite/gas/mips/mipsr6@jalr4-n32.d [new file with mode: 0644]
gas/testsuite/gas/mips/mipsr6@jalr4-n64.d [new file with mode: 0644]
gas/testsuite/gas/mips/mipsr6@jalr4.d [new file with mode: 0644]
ld/ChangeLog
ld/testsuite/ld-mips-elf/jalr4-r6.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/jalr4.dd
ld/testsuite/ld-mips-elf/mips-elf.exp