[binutils-gdb] MIPS objdump: Add `eabi32` and `eabi64` ABI options

Maciej W. Rozycki macro@sourceware.org
Sat Feb 15 01:35:16 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=caaa18f2128471cfaeda047d0725bef08daeb510

commit caaa18f2128471cfaeda047d0725bef08daeb510
Author: Anghelo Carvajal <angheloalf95@gmail.com>
Date:   Sat Feb 15 01:30:58 2025 +0000

    MIPS objdump: Add `eabi32` and `eabi64` ABI options
    
    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>

Diff:
---
 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(+)

diff --git a/gas/testsuite/gas/mips/fpr-names-eabi32.d b/gas/testsuite/gas/mips/fpr-names-eabi32.d
new file mode 100644
index 00000000000..6d9e674e89c
--- /dev/null
+++ b/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
+	\.\.\.
diff --git a/gas/testsuite/gas/mips/fpr-names-eabi64.d b/gas/testsuite/gas/mips/fpr-names-eabi64.d
new file mode 100644
index 00000000000..343feef8188
--- /dev/null
+++ b/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
+	\.\.\.
diff --git a/gas/testsuite/gas/mips/gpr-names-eabi32.d b/gas/testsuite/gas/mips/gpr-names-eabi32.d
new file mode 100644
index 00000000000..299dff7f8b4
--- /dev/null
+++ b/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
diff --git a/gas/testsuite/gas/mips/gpr-names-eabi64.d b/gas/testsuite/gas/mips/gpr-names-eabi64.d
new file mode 100644
index 00000000000..be0a0463b4c
--- /dev/null
+++ b/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
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index 1b6efda6eda..659ba14f187 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/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"
diff --git a/opcodes/mips-dis.c b/opcodes/mips-dis.c
index befe353b663..cef67fef036 100644
--- a/opcodes/mips-dis.c
+++ b/opcodes/mips-dis.c
@@ -106,6 +106,22 @@ static const char * const mips_fpr_names_64[32] =
   "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-cvs mailing list