• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Révisionadc1273cb27286452ed8b32c5ca3ea263b4854f0 (tree)
l'heure2017-04-25 19:53:45
AuteurMaciej W. Rozycki <macro@imgt...>
CommiterMaciej W. Rozycki

Message de Log

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.

Change Summary

Modification

--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -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+
113 2017-04-25 Jose E. Marchesi <jose.marchesi@oracle.com>
214
315 PR gas/21407
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -18445,15 +18445,11 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp)
1844518445 exp.X_add_symbol = fragp->fr_symbol;
1844618446 exp.X_add_number = fragp->fr_offset;
1844718447
18448- fixp = fix_new_exp (fragp, buf - fragp->fr_literal, 2, &exp,
18448+ fixp = fix_new_exp (fragp, buf - fragp->fr_literal, 4, &exp,
1844918449 TRUE, reloc);
1845018450
1845118451 fixp->fx_file = fragp->fr_file;
1845218452 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;
1845718453 }
1845818454 else
1845918455 as_bad_where (fragp->fr_file, fragp->fr_line,
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -1552,6 +1552,8 @@ if { [istarget mips*-*-vxworks*] } {
15521552 run_dump_test "mips16-branch-addend-1"
15531553 run_dump_test "mips16-branch-addend-2"
15541554 run_dump_test "mips16-branch-addend-3"
1555+ run_dump_test "mips16-branch-addend-4"
1556+ run_dump_test "mips16-branch-addend-5"
15551557 run_dump_test "mips16-branch-absolute"
15561558 run_dump_test "mips16-branch-absolute-addend"
15571559 if $has_newabi {
--- /dev/null
+++ b/gas/testsuite/gas/mips/mips16-branch-addend-4.d
@@ -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+ \.\.\.
--- /dev/null
+++ b/gas/testsuite/gas/mips/mips16-branch-addend-4.s
@@ -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
--- /dev/null
+++ b/gas/testsuite/gas/mips/mips16-branch-addend-5.d
@@ -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
--- /dev/null
+++ b/gas/testsuite/gas/mips/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
--- /dev/null
+++ b/gas/testsuite/gas/mips/mips16-branch-addend-5.s
@@ -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