aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@mips.com>2018-02-05 14:00:21 +0000
committerMaciej W. Rozycki <macro@mips.com>2018-02-05 14:00:21 +0000
commit2d6dda71611ba6cc16fe2bd21ac816d5f7d1e74d (patch)
tree64d139184ccc165a25a68a53f01467a1a127ebd9 /binutils
parent7550610057c51d47e3815ef93893d4f4faa7e03d (diff)
downloadgdb-2d6dda71611ba6cc16fe2bd21ac816d5f7d1e74d.zip
gdb-2d6dda71611ba6cc16fe2bd21ac816d5f7d1e74d.tar.gz
gdb-2d6dda71611ba6cc16fe2bd21ac816d5f7d1e74d.tar.bz2
MIPS/BFD: Correctly report unsupported `.reginfo' section size
Report an error when an unsupported `.reginfo' section size is found in `_bfd_mips_elf_section_processing', removing an assertion that triggers at elfxx-mips.c:7105 in GAS when assembling input like: .section .reginfo .word 0xdeadbeef and in `objcopy --rename-section' when renaming an incorrectly sized section to `.reginfo'. bfd/ * elfxx-mips.c (_bfd_mips_elf_section_processing): For SHT_MIPS_REGINFO sections don't assert the correct size and report an error instead. binutils/ * testsuite/binutils-all/mips/mips-reginfo.d: New test. * testsuite/binutils-all/mips/mips-reginfo-n32.d: New test. * testsuite/binutils-all/mips/mips-reginfo.s: New test source. * testsuite/binutils-all/mips/mips.exp: Run the new tests. gas/ * testsuite/gas/mips/reginfo-2.d: New test. * testsuite/gas/mips/reginfo-2-n32.d: New test. * testsuite/gas/mips/reginfo-2.l: New test stderr output. * testsuite/gas/mips/reginfo-2.s: New test source. * testsuite/gas/mips/mips.exp: Run the new tests.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog7
-rw-r--r--binutils/testsuite/binutils-all/mips/mips-reginfo-n32.d7
-rw-r--r--binutils/testsuite/binutils-all/mips/mips-reginfo.d6
-rw-r--r--binutils/testsuite/binutils-all/mips/mips-reginfo.s2
-rw-r--r--binutils/testsuite/binutils-all/mips/mips.exp5
5 files changed, 27 insertions, 0 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index b52c2d6..f6f3e99 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,12 @@
2018-02-05 Maciej W. Rozycki <macro@mips.com>
+ * testsuite/binutils-all/mips/mips-reginfo.d: New test.
+ * testsuite/binutils-all/mips/mips-reginfo-n32.d: New test.
+ * testsuite/binutils-all/mips/mips-reginfo.s: New test source.
+ * testsuite/binutils-all/mips/mips.exp: Run the new tests.
+
+2018-02-05 Maciej W. Rozycki <macro@mips.com>
+
* testsuite/config/default.exp (binutils_run): Document
`binutils_run_status'.
* testsuite/lib/utils-lib.exp (default_binutils_run): Likewise,
diff --git a/binutils/testsuite/binutils-all/mips/mips-reginfo-n32.d b/binutils/testsuite/binutils-all/mips/mips-reginfo-n32.d
new file mode 100644
index 0000000..fe55e95
--- /dev/null
+++ b/binutils/testsuite/binutils-all/mips/mips-reginfo-n32.d
@@ -0,0 +1,7 @@
+#PROG: objcopy
+#name: MIPS objcopy .reginfo section size (n32)
+#as: -n32 -mips3
+#objcopy: --rename-section .foo=.reginfo
+#source: mips-reginfo.s
+#error: \A[^\n]*: Incorrect `\.reginfo' section size; expected 24, got 4\n
+#error: [^\n]*: Bad value\Z
diff --git a/binutils/testsuite/binutils-all/mips/mips-reginfo.d b/binutils/testsuite/binutils-all/mips/mips-reginfo.d
new file mode 100644
index 0000000..7a8c1ca
--- /dev/null
+++ b/binutils/testsuite/binutils-all/mips/mips-reginfo.d
@@ -0,0 +1,6 @@
+#PROG: objcopy
+#name: MIPS objcopy .reginfo section size
+#as: -32
+#objcopy: --rename-section .foo=.reginfo
+#error: \A[^\n]*: Incorrect `\.reginfo' section size; expected 24, got 4\n
+#error: [^\n]*: Bad value\Z
diff --git a/binutils/testsuite/binutils-all/mips/mips-reginfo.s b/binutils/testsuite/binutils-all/mips/mips-reginfo.s
new file mode 100644
index 0000000..75eaa94
--- /dev/null
+++ b/binutils/testsuite/binutils-all/mips/mips-reginfo.s
@@ -0,0 +1,2 @@
+ .section .foo, "a"
+ .word 0xdeadbeef
diff --git a/binutils/testsuite/binutils-all/mips/mips.exp b/binutils/testsuite/binutils-all/mips/mips.exp
index be6e785..2167d4a 100644
--- a/binutils/testsuite/binutils-all/mips/mips.exp
+++ b/binutils/testsuite/binutils-all/mips/mips.exp
@@ -60,3 +60,8 @@ if $has_newabi {
run_dump_test "mips-note-2r-n32"
run_dump_test "mips-note-2r-n64"
}
+
+run_dump_test "mips-reginfo"
+if $has_newabi {
+ run_dump_test "mips-reginfo-n32"
+}