[committed v3] MIPS objdump: Add `eabi32` and `eabi64` ABI options
Maciej W. Rozycki
macro@orcam.me.uk
Sat Feb 15 01:37:21 GMT 2025
From: Anghelo Carvajal <angheloalf95@gmail.com>
Extend gpr and fpr register names with names suitable for both EABIs.
Heavily inspired by the EABI documenation written by Eric Christopher,
which can be read at
https://sourceware.org/legacy-ml/binutils/2003-06/msg00436.html
2025-02-15 Anghelo Carvajal <angheloalf95@gmail.com>
* mips-dis.c (mips_fpr_names_eabi32): New variable.
(mips_fpr_names_eabi64): New variable.
(mips_abi_choices): Add "eabi32" and "eabi64" options.
Signed-off-by: Anghelo Carvajal <angheloalf95@gmail.com>
---
Changes from v2:
- Fix a typo in the GPR disassembly test for EABI64 (s/eabi32/eabi64/).
- Reuse n64 output for the EABI32 and EABI64 GPR disassembly tests.
- Move the ChangeLog entry into the change description.
---
gas/testsuite/gas/mips/fpr-names-eabi32.d | 42 ++++++++++++++++++++++++++++++
gas/testsuite/gas/mips/fpr-names-eabi64.d | 42 ++++++++++++++++++++++++++++++
gas/testsuite/gas/mips/gpr-names-eabi32.d | 4 ++
gas/testsuite/gas/mips/gpr-names-eabi64.d | 4 ++
gas/testsuite/gas/mips/mips.exp | 4 ++
opcodes/mips-dis.c | 18 ++++++++++++
6 files changed, 114 insertions(+)
create mode 100644 gas/testsuite/gas/mips/fpr-names-eabi32.d
create mode 100644 gas/testsuite/gas/mips/fpr-names-eabi64.d
create mode 100644 gas/testsuite/gas/mips/gpr-names-eabi32.d
create mode 100644 gas/testsuite/gas/mips/gpr-names-eabi64.d
Index: binutils-gdb/gas/testsuite/gas/mips/fpr-names-eabi32.d
===================================================================
--- /dev/null
+++ binutils-gdb/gas/testsuite/gas/mips/fpr-names-eabi32.d
@@ -0,0 +1,42 @@
+#objdump: -dr --prefix-addresses --show-raw-insn -M gpr-names=numeric,fpr-names=eabi32
+#name: MIPS FPR disassembly (eabi32)
+#source: fpr-names.s
+
+# Check objdump's handling of -M fpr-names=foo options.
+
+.*: +file format .*mips.*
+
+Disassembly of section .text:
+0+0000 <[^>]*> 44800000 mtc1 \$0,fv0
+0+0004 <[^>]*> 44800800 mtc1 \$0,fv0f
+0+0008 <[^>]*> 44801000 mtc1 \$0,fv1
+0+000c <[^>]*> 44801800 mtc1 \$0,fv1f
+0+0010 <[^>]*> 44802000 mtc1 \$0,ft0
+0+0014 <[^>]*> 44802800 mtc1 \$0,ft0f
+0+0018 <[^>]*> 44803000 mtc1 \$0,ft1
+0+001c <[^>]*> 44803800 mtc1 \$0,ft1f
+0+0020 <[^>]*> 44804000 mtc1 \$0,ft2
+0+0024 <[^>]*> 44804800 mtc1 \$0,ft2f
+0+0028 <[^>]*> 44805000 mtc1 \$0,ft3
+0+002c <[^>]*> 44805800 mtc1 \$0,ft3f
+0+0030 <[^>]*> 44806000 mtc1 \$0,fa0
+0+0034 <[^>]*> 44806800 mtc1 \$0,fa0f
+0+0038 <[^>]*> 44807000 mtc1 \$0,fa1
+0+003c <[^>]*> 44807800 mtc1 \$0,fa1f
+0+0040 <[^>]*> 44808000 mtc1 \$0,fa2
+0+0044 <[^>]*> 44808800 mtc1 \$0,fa2f
+0+0048 <[^>]*> 44809000 mtc1 \$0,fa3
+0+004c <[^>]*> 44809800 mtc1 \$0,fa3f
+0+0050 <[^>]*> 4480a000 mtc1 \$0,fs0
+0+0054 <[^>]*> 4480a800 mtc1 \$0,fs0f
+0+0058 <[^>]*> 4480b000 mtc1 \$0,fs1
+0+005c <[^>]*> 4480b800 mtc1 \$0,fs1f
+0+0060 <[^>]*> 4480c000 mtc1 \$0,fs2
+0+0064 <[^>]*> 4480c800 mtc1 \$0,fs2f
+0+0068 <[^>]*> 4480d000 mtc1 \$0,fs3
+0+006c <[^>]*> 4480d800 mtc1 \$0,fs3f
+0+0070 <[^>]*> 4480e000 mtc1 \$0,fs4
+0+0074 <[^>]*> 4480e800 mtc1 \$0,fs4f
+0+0078 <[^>]*> 4480f000 mtc1 \$0,fs5
+0+007c <[^>]*> 4480f800 mtc1 \$0,fs5f
+ \.\.\.
Index: binutils-gdb/gas/testsuite/gas/mips/fpr-names-eabi64.d
===================================================================
--- /dev/null
+++ binutils-gdb/gas/testsuite/gas/mips/fpr-names-eabi64.d
@@ -0,0 +1,42 @@
+#objdump: -dr --prefix-addresses --show-raw-insn -M gpr-names=numeric,fpr-names=eabi64
+#name: MIPS FPR disassembly (eabi64)
+#source: fpr-names.s
+
+# Check objdump's handling of -M fpr-names=foo options.
+
+.*: +file format .*mips.*
+
+Disassembly of section .text:
+0+0000 <[^>]*> 44800000 mtc1 \$0,fv0
+0+0004 <[^>]*> 44800800 mtc1 \$0,fv1
+0+0008 <[^>]*> 44801000 mtc1 \$0,ft0
+0+000c <[^>]*> 44801800 mtc1 \$0,ft1
+0+0010 <[^>]*> 44802000 mtc1 \$0,ft2
+0+0014 <[^>]*> 44802800 mtc1 \$0,ft3
+0+0018 <[^>]*> 44803000 mtc1 \$0,ft4
+0+001c <[^>]*> 44803800 mtc1 \$0,ft5
+0+0020 <[^>]*> 44804000 mtc1 \$0,ft6
+0+0024 <[^>]*> 44804800 mtc1 \$0,ft7
+0+0028 <[^>]*> 44805000 mtc1 \$0,ft8
+0+002c <[^>]*> 44805800 mtc1 \$0,ft9
+0+0030 <[^>]*> 44806000 mtc1 \$0,fa0
+0+0034 <[^>]*> 44806800 mtc1 \$0,fa1
+0+0038 <[^>]*> 44807000 mtc1 \$0,fa2
+0+003c <[^>]*> 44807800 mtc1 \$0,fa3
+0+0040 <[^>]*> 44808000 mtc1 \$0,fa4
+0+0044 <[^>]*> 44808800 mtc1 \$0,fa5
+0+0048 <[^>]*> 44809000 mtc1 \$0,fa6
+0+004c <[^>]*> 44809800 mtc1 \$0,fa7
+0+0050 <[^>]*> 4480a000 mtc1 \$0,fs0
+0+0054 <[^>]*> 4480a800 mtc1 \$0,fs1
+0+0058 <[^>]*> 4480b000 mtc1 \$0,fs2
+0+005c <[^>]*> 4480b800 mtc1 \$0,fs3
+0+0060 <[^>]*> 4480c000 mtc1 \$0,fs4
+0+0064 <[^>]*> 4480c800 mtc1 \$0,fs5
+0+0068 <[^>]*> 4480d000 mtc1 \$0,fs6
+0+006c <[^>]*> 4480d800 mtc1 \$0,fs7
+0+0070 <[^>]*> 4480e000 mtc1 \$0,fs8
+0+0074 <[^>]*> 4480e800 mtc1 \$0,fs9
+0+0078 <[^>]*> 4480f000 mtc1 \$0,fs10
+0+007c <[^>]*> 4480f800 mtc1 \$0,fs11
+ \.\.\.
Index: binutils-gdb/gas/testsuite/gas/mips/gpr-names-eabi32.d
===================================================================
--- /dev/null
+++ binutils-gdb/gas/testsuite/gas/mips/gpr-names-eabi32.d
@@ -0,0 +1,4 @@
+#objdump: -dr --prefix-addresses --show-raw-insn -M gpr-names=eabi32
+#name: MIPS GPR disassembly (eabi32)
+#source: gpr-names.s
+#dump: gpr-names-64.d
Index: binutils-gdb/gas/testsuite/gas/mips/gpr-names-eabi64.d
===================================================================
--- /dev/null
+++ binutils-gdb/gas/testsuite/gas/mips/gpr-names-eabi64.d
@@ -0,0 +1,4 @@
+#objdump: -dr --prefix-addresses --show-raw-insn -M gpr-names=eabi64
+#name: MIPS GPR disassembly (eabi64)
+#source: gpr-names.s
+#dump: gpr-names-64.d
Index: binutils-gdb/gas/testsuite/gas/mips/mips.exp
===================================================================
--- binutils-gdb.orig/gas/testsuite/gas/mips/mips.exp
+++ binutils-gdb/gas/testsuite/gas/mips/mips.exp
@@ -1340,11 +1340,15 @@ if { [istarget mips*-*-vxworks*] } {
run_dump_test "gpr-names-32"
run_dump_test "gpr-names-n32"
run_dump_test "gpr-names-64"
+ run_dump_test "gpr-names-eabi32"
+ run_dump_test "gpr-names-eabi64"
run_dump_test "fpr-names-numeric"
run_dump_test "fpr-names-32"
run_dump_test "fpr-names-n32"
run_dump_test "fpr-names-64"
+ run_dump_test "fpr-names-eabi32"
+ run_dump_test "fpr-names-eabi64"
run_dump_test "cp0-names-numeric"
run_dump_test "cp0-names-r3000"
Index: binutils-gdb/opcodes/mips-dis.c
===================================================================
--- binutils-gdb.orig/opcodes/mips-dis.c
+++ binutils-gdb/opcodes/mips-dis.c
@@ -106,6 +106,22 @@ static const char * const mips_fpr_names
"fs0", "fs1", "fs2", "fs3", "fs4", "fs5", "fs6", "fs7"
};
+static const char * const mips_fpr_names_eabi32[32] =
+{
+ "fv0", "fv0f", "fv1", "fv1f", "ft0", "ft0f", "ft1", "ft1f",
+ "ft2", "ft2f", "ft3", "ft3f", "fa0", "fa0f", "fa1", "fa1f",
+ "fa2", "fa2f", "fa3", "fa3f", "fs0", "fs0f", "fs1", "fs1f",
+ "fs2", "fs2f", "fs3", "fs3f", "fs4", "fs4f", "fs5", "fs5f",
+};
+
+static const char * const mips_fpr_names_eabi64[32] =
+{
+ "fv0", "fv1", "ft0", "ft1", "ft2", "ft3", "ft4", "ft5",
+ "ft6", "ft7", "ft8", "ft9", "fa0", "fa1", "fa2", "fa3",
+ "fa4", "fa5", "fa6", "fa7", "fs0", "fs1", "fs2", "fs3",
+ "fs4", "fs5", "fs6", "fs7", "fs8", "fs9", "fs10", "fs11",
+};
+
static const char * const mips_cp0_names_numeric[32] =
{
"$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7",
@@ -454,6 +470,8 @@ struct mips_abi_choice mips_abi_choices[
{ "32", mips_gpr_names_oldabi, mips_fpr_names_32 },
{ "n32", mips_gpr_names_newabi, mips_fpr_names_n32 },
{ "64", mips_gpr_names_newabi, mips_fpr_names_64 },
+ { "eabi32", mips_gpr_names_newabi, mips_fpr_names_eabi32 },
+ { "eabi64", mips_gpr_names_newabi, mips_fpr_names_eabi64 },
};
struct mips_arch_choice
More information about the Binutils
mailing list