]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
score-elf gas SEGV
authorAlan Modra <amodra@gmail.com>
Sat, 15 Feb 2025 21:59:27 +0000 (08:29 +1030)
committerAlan Modra <amodra@gmail.com>
Sat, 15 Feb 2025 22:13:10 +0000 (08:43 +1030)
Commit 3fb6f5457e5b typoed an array subscript.

* config/tc-score7.c (s7_gen_reloc): Correct array subscript.
* testsuite/gas/score/pr32700.d,
* testsuite/gas/score/pr32700.s: New test.
* testsuite/gas/score/relax.exp: Run it.

gas/config/tc-score7.c
gas/testsuite/gas/score/pr32700.d [new file with mode: 0644]
gas/testsuite/gas/score/pr32700.s [new file with mode: 0644]
gas/testsuite/gas/score/relax.exp

index 63a720e3dd44bffbd872e82a11cba4d5d2726553..cb56ba9c177fc248ce3183f79d51c015e371b86d 100644 (file)
@@ -6845,7 +6845,7 @@ s7_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
       s7_number_to_chars (buf, newval, s7_INSN_SIZE);
 
       retval[1] = notes_alloc (sizeof (arelent));
-      retval[2]->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
+      retval[1]->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
       retval[2] = NULL;
       *retval[1]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
       retval[1]->address = (reloc->address + s7_RELAX_RELOC2 (fixp->fx_frag->fr_subtype));
diff --git a/gas/testsuite/gas/score/pr32700.d b/gas/testsuite/gas/score/pr32700.d
new file mode 100644 (file)
index 0000000..be814b8
--- /dev/null
@@ -0,0 +1,14 @@
+#as:
+#objdump: -dr
+#source: pr32700.s
+
+.*: +file format .*
+
+Disassembly of section \.text:
+
+0+ <\.text>:
+   0:  94388000        ldis            r1, 0x0\(0\)
+                       0: R_SCORE_HI16 dwarf_reg_size_table
+   4:  84348000        ori             r1, 0x0
+                       4: R_SCORE_LO16 dwarf_reg_size_table
+   8:  d8e18000        lbu             r7, \[r1, 0\]
diff --git a/gas/testsuite/gas/score/pr32700.s b/gas/testsuite/gas/score/pr32700.s
new file mode 100644 (file)
index 0000000..117b3c8
--- /dev/null
@@ -0,0 +1,2 @@
+ .text
+ lbu r7,dwarf_reg_size_table
index 184f9180e970b15089b79a500e2cc0cc35812fc7..534a822f806b87a8fc68ba694f1a196bba391930 100644 (file)
@@ -32,5 +32,5 @@ if [istarget score-*-*] then {
     run_dump_test "move"
     run_dump_test "rD_rA_BN"
     run_dump_test "rD_rA"
+    run_dump_test pr32700
 }
-