aboutsummaryrefslogtreecommitdiff
path: root/binutils/testsuite/binutils-all
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2023-01-06 16:42:23 +0000
committerAndrew Burgess <aburgess@redhat.com>2023-02-13 12:05:32 +0000
commit77be7257442b1ca19deba8ec0e424f0faf53321f (patch)
tree4d70af2c5d233796f906dfdd10a4d8435b26f785 /binutils/testsuite/binutils-all
parent97c195191578e9a68bfbb810eea373f5f3efcb7d (diff)
downloadgdb-77be7257442b1ca19deba8ec0e424f0faf53321f.zip
gdb-77be7257442b1ca19deba8ec0e424f0faf53321f.tar.gz
gdb-77be7257442b1ca19deba8ec0e424f0faf53321f.tar.bz2
opcodes/mips: disassemble unknown micromips instructions as two shorts
Before commit: commit 2438b771ee07be19d5b01ea55e077dd8b7cef445 Date: Wed Nov 2 15:53:43 2022 +0000 opcodes/mips: use .word/.short for undefined instructions unknown 32-bit microMIPS instructions were disassembled as a raw 32-bit number with no '.word' directive. The above commit changed this and added a '.word' directive before the 32-bit number. It was pointed out on the mailing list, that for microMIPS it would be better to display such 32-bit instructions using a '.short' directive followed by two 16-bit values. This commit updates the mips disassembler to do this, and adds a new test that validates this output.
Diffstat (limited to 'binutils/testsuite/binutils-all')
-rw-r--r--binutils/testsuite/binutils-all/mips/micromips-reserved-enc-n32.d5
-rw-r--r--binutils/testsuite/binutils-all/mips/micromips-reserved-enc-n64.d5
-rw-r--r--binutils/testsuite/binutils-all/mips/micromips-reserved-enc-o32.d10
-rw-r--r--binutils/testsuite/binutils-all/mips/micromips-reserved-enc.s9
-rw-r--r--binutils/testsuite/binutils-all/mips/mips.exp4
5 files changed, 33 insertions, 0 deletions
diff --git a/binutils/testsuite/binutils-all/mips/micromips-reserved-enc-n32.d b/binutils/testsuite/binutils-all/mips/micromips-reserved-enc-n32.d
new file mode 100644
index 0000000..e6608f3
--- /dev/null
+++ b/binutils/testsuite/binutils-all/mips/micromips-reserved-enc-n32.d
@@ -0,0 +1,5 @@
+#PROG: objcopy
+#objdump: -d --prefix-addresses --show-raw-insn
+#name: microMIPS source file contains reserved encoding (n32)
+#source: micromips-reserved-enc.s
+#dump: micromips-reserved-enc-o32.d
diff --git a/binutils/testsuite/binutils-all/mips/micromips-reserved-enc-n64.d b/binutils/testsuite/binutils-all/mips/micromips-reserved-enc-n64.d
new file mode 100644
index 0000000..f892bfa
--- /dev/null
+++ b/binutils/testsuite/binutils-all/mips/micromips-reserved-enc-n64.d
@@ -0,0 +1,5 @@
+#PROG: objcopy
+#objdump: -d --prefix-addresses --show-raw-insn
+#name: microMIPS source file contains reserved encoding (n64)
+#source: micromips-reserved-enc.s
+#dump: micromips-reserved-enc-o32.d
diff --git a/binutils/testsuite/binutils-all/mips/micromips-reserved-enc-o32.d b/binutils/testsuite/binutils-all/mips/micromips-reserved-enc-o32.d
new file mode 100644
index 0000000..3de3989
--- /dev/null
+++ b/binutils/testsuite/binutils-all/mips/micromips-reserved-enc-o32.d
@@ -0,0 +1,10 @@
+#PROG: objcopy
+#objdump: -d --prefix-addresses --show-raw-insn
+#name: microMIPS source file contains reserved encoding (o32)
+#source: micromips-reserved-enc.s
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+[0-9a-f]+ <[^>]*> 7f6e 5d4c \.short 0x7f6e, 0x5d4c
+ \.\.\.
diff --git a/binutils/testsuite/binutils-all/mips/micromips-reserved-enc.s b/binutils/testsuite/binutils-all/mips/micromips-reserved-enc.s
new file mode 100644
index 0000000..d4918f3
--- /dev/null
+++ b/binutils/testsuite/binutils-all/mips/micromips-reserved-enc.s
@@ -0,0 +1,9 @@
+ .module mips64r3
+ .module micromips
+foo:
+ .insn
+ .short 0x7f6e, 0x5d4c
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+ .align 4, 0
+ .space 16
diff --git a/binutils/testsuite/binutils-all/mips/mips.exp b/binutils/testsuite/binutils-all/mips/mips.exp
index 6a0ec25..91bf327 100644
--- a/binutils/testsuite/binutils-all/mips/mips.exp
+++ b/binutils/testsuite/binutils-all/mips/mips.exp
@@ -266,3 +266,7 @@ run_dump_test_n64 "global-local-symtab-sort-n64${tmips}"
run_dump_test_o32 "global-local-symtab-final-o32" useld
run_dump_test_n32 "global-local-symtab-final-n32" useld
run_dump_test_n64 "global-local-symtab-final-n64" useld
+
+run_dump_test_o32 "micromips-reserved-enc-o32"
+run_dump_test_n32 "micromips-reserved-enc-n32"
+run_dump_test_n64 "micromips-reserved-enc-n64"