GNU Binutils with patches for OS216
Révision | adc1273cb27286452ed8b32c5ca3ea263b4854f0 (tree) |
---|---|
l'heure | 2017-04-25 19:53:45 |
Auteur | Maciej W. Rozycki <macro@imgt...> |
Commiter | Maciej W. Rozycki |
MIPS/GAS: Correct BFD_RELOC_MIPS16_16_PCREL_S1 fixup size
Correct the size of a BFD_RELOC_MIPS16_16_PCREL_S1 fixup made in
md_convert_frag', fixing a bug introduced with commit c9775dde3277
("MIPS16: Add R_MIPS16_PC16_S1 branch relocation support)". Add test
cases to verify that the overflow of this fixup's in-place addend is
still correctly detected.
gas/
* config/tc-mips.c (md_convert_frag): Correct
BFD_RELOC_MIPS16_16_PCREL_S1 fixup size.
* testsuite/gas/mips/mips16-branch-addend-4.d: New test.
* testsuite/gas/mips/mips16-branch-addend-5.d: New test.
* testsuite/gas/mips/mips16-branch-addend-5.l: New stderr
output.
* testsuite/gas/mips/mips16-branch-addend-4.s: New test source.
* testsuite/gas/mips/mips16-branch-addend-5.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.
@@ -1,3 +1,15 @@ | ||
1 | +2017-04-25 Maciej W. Rozycki <macro@imgtec.com> | |
2 | + | |
3 | + * config/tc-mips.c (md_convert_frag): Correct | |
4 | + BFD_RELOC_MIPS16_16_PCREL_S1 fixup size. | |
5 | + * testsuite/gas/mips/mips16-branch-addend-4.d: New test. | |
6 | + * testsuite/gas/mips/mips16-branch-addend-5.d: New test. | |
7 | + * testsuite/gas/mips/mips16-branch-addend-5.l: New stderr | |
8 | + output. | |
9 | + * testsuite/gas/mips/mips16-branch-addend-4.s: New test source. | |
10 | + * testsuite/gas/mips/mips16-branch-addend-5.s: New test source. | |
11 | + * testsuite/gas/mips/mips.exp: Run the new tests. | |
12 | + | |
1 | 13 | 2017-04-25 Jose E. Marchesi <jose.marchesi@oracle.com> |
2 | 14 | |
3 | 15 | PR gas/21407 |
@@ -18445,15 +18445,11 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp) | ||
18445 | 18445 | exp.X_add_symbol = fragp->fr_symbol; |
18446 | 18446 | exp.X_add_number = fragp->fr_offset; |
18447 | 18447 | |
18448 | - fixp = fix_new_exp (fragp, buf - fragp->fr_literal, 2, &exp, | |
18448 | + fixp = fix_new_exp (fragp, buf - fragp->fr_literal, 4, &exp, | |
18449 | 18449 | TRUE, reloc); |
18450 | 18450 | |
18451 | 18451 | fixp->fx_file = fragp->fr_file; |
18452 | 18452 | fixp->fx_line = fragp->fr_line; |
18453 | - | |
18454 | - /* These relocations can have an addend that won't fit | |
18455 | - in 2 octets. */ | |
18456 | - fixp->fx_no_overflow = 1; | |
18457 | 18453 | } |
18458 | 18454 | else |
18459 | 18455 | as_bad_where (fragp->fr_file, fragp->fr_line, |
@@ -1552,6 +1552,8 @@ if { [istarget mips*-*-vxworks*] } { | ||
1552 | 1552 | run_dump_test "mips16-branch-addend-1" |
1553 | 1553 | run_dump_test "mips16-branch-addend-2" |
1554 | 1554 | run_dump_test "mips16-branch-addend-3" |
1555 | + run_dump_test "mips16-branch-addend-4" | |
1556 | + run_dump_test "mips16-branch-addend-5" | |
1555 | 1557 | run_dump_test "mips16-branch-absolute" |
1556 | 1558 | run_dump_test "mips16-branch-absolute-addend" |
1557 | 1559 | if $has_newabi { |
@@ -0,0 +1,30 @@ | ||
1 | +#objdump: -dr --prefix-addresses --show-raw-insn | |
2 | +#name: MIPS16 branch relocation with addend 4 | |
3 | +#as: -32 | |
4 | + | |
5 | +.*: +file format .*mips.* | |
6 | + | |
7 | +Disassembly of section \.text: | |
8 | + \.\.\. | |
9 | +[0-9a-f]+ <[^>]*> f7ef 101f b 00011002 <foo\+0x10002> | |
10 | +[ ]*[0-9a-f]+: R_MIPS16_PC16_S1 bar | |
11 | +[0-9a-f]+ <[^>]*> f7ef 601f bteqz 00011006 <foo\+0x10006> | |
12 | +[ ]*[0-9a-f]+: R_MIPS16_PC16_S1 bar | |
13 | +[0-9a-f]+ <[^>]*> f7ef 611f btnez 0001100a <foo\+0x1000a> | |
14 | +[ ]*[0-9a-f]+: R_MIPS16_PC16_S1 bar | |
15 | +[0-9a-f]+ <[^>]*> f7ef 221f beqz v0,0001100e <foo\+0x1000e> | |
16 | +[ ]*[0-9a-f]+: R_MIPS16_PC16_S1 bar | |
17 | +[0-9a-f]+ <[^>]*> f7ef 2a1f bnez v0,00011012 <foo\+0x10012> | |
18 | +[ ]*[0-9a-f]+: R_MIPS16_PC16_S1 bar | |
19 | +[0-9a-f]+ <[^>]*> f010 1000 b ffff1018 <foo\+0xffff0018> | |
20 | +[ ]*[0-9a-f]+: R_MIPS16_PC16_S1 bar | |
21 | +[0-9a-f]+ <[^>]*> f010 6000 bteqz ffff101c <foo\+0xffff001c> | |
22 | +[ ]*[0-9a-f]+: R_MIPS16_PC16_S1 bar | |
23 | +[0-9a-f]+ <[^>]*> f010 6100 btnez ffff1020 <foo\+0xffff0020> | |
24 | +[ ]*[0-9a-f]+: R_MIPS16_PC16_S1 bar | |
25 | +[0-9a-f]+ <[^>]*> f010 2200 beqz v0,ffff1024 <foo\+0xffff0024> | |
26 | +[ ]*[0-9a-f]+: R_MIPS16_PC16_S1 bar | |
27 | +[0-9a-f]+ <[^>]*> f010 2a00 bnez v0,ffff1028 <foo\+0xffff0028> | |
28 | +[ ]*[0-9a-f]+: R_MIPS16_PC16_S1 bar | |
29 | +[0-9a-f]+ <[^>]*> 6500 nop | |
30 | + \.\.\. |
@@ -0,0 +1,24 @@ | ||
1 | + .text | |
2 | + | |
3 | + .space 0x1000 | |
4 | + | |
5 | + .ent foo | |
6 | + .set mips16 | |
7 | +foo: | |
8 | + b bar + 4 + (0x7fff << 1) | |
9 | + bteqz bar + 4 + (0x7fff << 1) | |
10 | + btnez bar + 4 + (0x7fff << 1) | |
11 | + beqz $2, bar + 4 + (0x7fff << 1) | |
12 | + bnez $2, bar + 4 + (0x7fff << 1) | |
13 | + b bar + 4 - (0x8000 << 1) | |
14 | + bteqz bar + 4 - (0x8000 << 1) | |
15 | + btnez bar + 4 - (0x8000 << 1) | |
16 | + beqz $2, bar + 4 - (0x8000 << 1) | |
17 | + bnez $2, bar + 4 - (0x8000 << 1) | |
18 | + nop | |
19 | + .set nomips16 | |
20 | + .end foo | |
21 | + | |
22 | +# Force some (non-delay-slot) zero bytes, to make 'objdump' print ... | |
23 | + .align 4, 0 | |
24 | + .space 16 |
@@ -0,0 +1,4 @@ | ||
1 | +#objdump: -dr --prefix-addresses --show-raw-insn | |
2 | +#name: MIPS16 branch relocation with addend 5 | |
3 | +#as: -32 | |
4 | +#error-output: mips16-branch-addend-5.l |
@@ -0,0 +1,11 @@ | ||
1 | +.*: Assembler messages: | |
2 | +.*:8: Error: relocation overflow | |
3 | +.*:9: Error: relocation overflow | |
4 | +.*:10: Error: relocation overflow | |
5 | +.*:11: Error: relocation overflow | |
6 | +.*:12: Error: relocation overflow | |
7 | +.*:13: Error: relocation overflow | |
8 | +.*:14: Error: relocation overflow | |
9 | +.*:15: Error: relocation overflow | |
10 | +.*:16: Error: relocation overflow | |
11 | +.*:17: Error: relocation overflow |
@@ -0,0 +1,24 @@ | ||
1 | + .text | |
2 | + | |
3 | + .space 0x1000 | |
4 | + | |
5 | + .ent foo | |
6 | + .set mips16 | |
7 | +foo: | |
8 | + b bar + 4 + (0x8000 << 1) | |
9 | + bteqz bar + 4 + (0x8000 << 1) | |
10 | + btnez bar + 4 + (0x8000 << 1) | |
11 | + beqz $2, bar + 4 + (0x8000 << 1) | |
12 | + bnez $2, bar + 4 + (0x8000 << 1) | |
13 | + b bar + 4 - (0x8001 << 1) | |
14 | + bteqz bar + 4 - (0x8001 << 1) | |
15 | + btnez bar + 4 - (0x8001 << 1) | |
16 | + beqz $2, bar + 4 - (0x8001 << 1) | |
17 | + bnez $2, bar + 4 - (0x8001 << 1) | |
18 | + nop | |
19 | + .set nomips16 | |
20 | + .end foo | |
21 | + | |
22 | +# Force some (non-delay-slot) zero bytes, to make 'objdump' print ... | |
23 | + .align 4, 0 | |
24 | + .space 16 |