MIPS/BFD: Correct microMIPS cross-mode BAL to JALX relaxation
authorMaciej W. Rozycki <macro@imgtec.com>
Wed, 30 Aug 2017 15:03:31 +0000 (16:03 +0100)
committerMaciej W. Rozycki <macro@imgtec.com>
Wed, 30 Aug 2017 15:07:45 +0000 (16:07 +0100)
commit70e65ca8e5d1fc984d58f6137c290e807fe772a5
tree0943c3adf717058f551e0ef7fd3d1319da584b59
parent37b2d327512baf2f39020e44958fd1f11db46a91
MIPS/BFD: Correct microMIPS cross-mode BAL to JALX relaxation

Fix a bug in commit a6ebf6169a1b ("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.
22 files changed:
bfd/ChangeLog
bfd/elfxx-mips.c
gas/ChangeLog
gas/testsuite/gas/mips/branch-addend-micromips-n32.d [new file with mode: 0644]
gas/testsuite/gas/mips/branch-addend-micromips-n64.d [new file with mode: 0644]
gas/testsuite/gas/mips/branch-addend-micromips.d [new file with mode: 0644]
gas/testsuite/gas/mips/branch-addend-micromips.s [new file with mode: 0644]
gas/testsuite/gas/mips/mips.exp
ld/ChangeLog
ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips-n32.d [new file with mode: 0644]
ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips-n64.d [new file with mode: 0644]
ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips.d [new file with mode: 0644]
ld/testsuite/ld-mips-elf/bal-jalx-local-micromips-n32.d [new file with mode: 0644]
ld/testsuite/ld-mips-elf/bal-jalx-local-micromips-n64.d [new file with mode: 0644]
ld/testsuite/ld-mips-elf/bal-jalx-local-micromips.d [new file with mode: 0644]
ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n32.d [new file with mode: 0644]
ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n64.d [new file with mode: 0644]
ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips.d [new file with mode: 0644]
ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips-n32.d [new file with mode: 0644]
ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips-n64.d [new file with mode: 0644]
ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips.d [new file with mode: 0644]
ld/testsuite/ld-mips-elf/mips-elf.exp