diff options
author | Maciej W. Rozycki <macro@imgtec.com> | 2016-12-14 21:20:01 +0000 |
---|---|---|
committer | Maciej W. Rozycki <macro@imgtec.com> | 2016-12-14 22:05:38 +0000 |
commit | eefc3365838ed15c02bd7da39fbc31c00d07b398 (patch) | |
tree | aa3c25bd41a330bfb1b14ad7efc0fc2a254c32d6 /gas/config/tc-mips.c | |
parent | 353abf7c10561aab3e8e7ffce6e270c3743376f0 (diff) | |
download | binutils-eefc3365838ed15c02bd7da39fbc31c00d07b398.zip binutils-eefc3365838ed15c02bd7da39fbc31c00d07b398.tar.gz binutils-eefc3365838ed15c02bd7da39fbc31c00d07b398.tar.bz2 |
MIPS16/GAS: Fix assertion failures with relocations on 16-bit instructions
Complement commit c9775dde3277 ("MIPS16: Add R_MIPS16_PC16_S1 branch
relocation support)" and report an assembly error when a relocation is
required for an instruction, currently a branch only, that has been
forced to use its unextended encoding, either with the use of an
explicit `.t' mnemonic suffix, or by means of `.set noautoextend' being
active, fixing an assertion failure currently caused instead.
gas/
* config/tc-mips.c (md_convert_frag): Report an error instead of
asserting on `ext'.
* testsuite/gas/mips/mips16-branch-unextended-1.d: New test.
* testsuite/gas/mips/mips16-branch-unextended-2.d: New test.
* testsuite/gas/mips/mips16-branch-unextended-1.s: New test
source.
* testsuite/gas/mips/mips16-branch-unextended-2.s: New test.
* testsuite/gas/mips/mips16-branch-unextended.l: New stderr
output.
* testsuite/gas/mips/mips.exp: Run the new tests.
Diffstat (limited to 'gas/config/tc-mips.c')
-rw-r--r-- | gas/config/tc-mips.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 4288d96..1241b9c 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -18369,10 +18369,10 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp) _("unsupported relocation")); break; } - if (reloc != BFD_RELOC_NONE) + if (reloc == BFD_RELOC_NONE) + ; + else if (ext) { - gas_assert (ext); - exp.X_op = O_symbol; exp.X_add_symbol = fragp->fr_symbol; exp.X_add_number = fragp->fr_offset; @@ -18387,6 +18387,9 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp) in 2 octets. */ fixp->fx_no_overflow = 1; } + else + as_bad_where (fragp->fr_file, fragp->fr_line, + _("invalid unextended operand value")); } else mips16_immed (fragp->fr_file, fragp->fr_line, type, |