MIPS/GAS: Handle resolved R6 PC-relative relocations
authorMaciej W. Rozycki <macro@imgtec.com>
Tue, 21 Jun 2016 20:22:39 +0000 (21:22 +0100)
committerMaciej W. Rozycki <macro@imgtec.com>
Tue, 21 Jun 2016 22:00:20 +0000 (23:00 +0100)
commit41947d9e38c4fd27b17843f328d58138193e4f19
treeab440ef62ed51a22e1f7c1fd4214585e69afd8b9
parent717ba204e06d88ed68441e236da3688a92cf054c
MIPS/GAS: Handle resolved R6 PC-relative relocations

Complement commit 7361da2c952e ("Add support for MIPS R6.") and fix
internal errors like:

foo.s: Assembler messages:
foo.s: Internal error!
Assertion failure in md_apply_fix at .../gas/config/tc-mips.c:15028.
Please report this bug.

triggered by resolved R6 PC-relative relocations in sources containing
R6 code fragments wrapped into ISA override blocks embedded within code
otherwise assembled for an older ISA.

gas/
* config/tc-mips.c (calculate_reloc) <BFD_RELOC_HI16_S_PCREL>
<BFD_RELOC_LO16_PCREL>: New switch cases.
(md_apply_fix) <BFD_RELOC_HI16_S_PCREL, BFD_RELOC_LO16_PCREL>:
Move switch cases along `BFD_RELOC_MIPS_JMP'.
<BFD_RELOC_MIPS_21_PCREL_S2, BFD_RELOC_MIPS_26_PCREL_S2>
<BFD_RELOC_MIPS_18_PCREL_S3, BFD_RELOC_MIPS_19_PCREL_S2>: Handle
the resolved case.
* testsuite/gas/mips/pcrel-reloc-4.d: New test.
* testsuite/gas/mips/pcrel-reloc-4-r6.d: New test.
* testsuite/gas/mips/pcrel-reloc-5.d: New test.
* testsuite/gas/mips/pcrel-reloc-5-r6.d: New test.
* testsuite/gas/mips/pcrel-reloc-6.d: New test.
* testsuite/gas/mips/pcrel-reloc-6.l: New list test.
* testsuite/gas/mips/pcrel-reloc-4.s: New test source.
* testsuite/gas/mips/pcrel-reloc-6.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.
gas/config/tc-mips.c
gas/testsuite/gas/mips/mips.exp
gas/testsuite/gas/mips/pcrel-reloc-4-r6.d [new file with mode: 0644]
gas/testsuite/gas/mips/pcrel-reloc-4.d [new file with mode: 0644]
gas/testsuite/gas/mips/pcrel-reloc-4.s [new file with mode: 0644]
gas/testsuite/gas/mips/pcrel-reloc-5-r6.d [new file with mode: 0644]
gas/testsuite/gas/mips/pcrel-reloc-5.d [new file with mode: 0644]
gas/testsuite/gas/mips/pcrel-reloc-6.d [new file with mode: 0644]
gas/testsuite/gas/mips/pcrel-reloc-6.l [new file with mode: 0644]
gas/testsuite/gas/mips/pcrel-reloc-6.s [new file with mode: 0644]