[committed] MIPS: Add missing interAptiv MR2 machine type handling

Maciej W. Rozycki macro@orcam.me.uk
Sun Nov 8 18:44:57 GMT 2026


Complement commit 38bf472a1521 ("MIPS: Add Imagination interAptiv MR2 
MIPS32r3 processor support") and add missing AFL_EXT_INTERAPTIV_MR2 to 
machine type conversion in BFD and add interAptiv MR2 machine type to 
a.out and gold.
---
 bfd/aoutx.h      |    1 +
 bfd/elfxx-mips.c |    1 +
 elfcpp/mips.h    |    6 +++++-
 gold/mips.cc     |   15 +++++++++++++++
 4 files changed, 22 insertions(+), 1 deletion(-)

binutils-mips-afl-ext-interaptiv-mr2.diff
Index: binutils-gdb/bfd/aoutx.h
===================================================================
--- binutils-gdb.orig/bfd/aoutx.h
+++ binutils-gdb/bfd/aoutx.h
@@ -818,6 +818,7 @@ NAME (aout, machine_type) (enum bfd_arch
 	case bfd_mach_mips_octeon2:
 	case bfd_mach_mips_octeon3:
 	case bfd_mach_mips_xlr:
+	case bfd_mach_mips_interaptiv_mr2:
 	  /* FIXME: These should be MIPS3, MIPS4, MIPS16, MIPS32, etc.  */
 	  arch_flags = M_MIPS2;
 	  break;
Index: binutils-gdb/bfd/elfxx-mips.c
===================================================================
--- binutils-gdb.orig/bfd/elfxx-mips.c
+++ binutils-gdb/bfd/elfxx-mips.c
@@ -14800,6 +14800,7 @@ bfd_mips_isa_ext_mach (unsigned int isa_
     case AFL_EXT_OCTEON2:     return bfd_mach_mips_octeon2;
     case AFL_EXT_OCTEON3:     return bfd_mach_mips_octeon3;
     case AFL_EXT_XLR:	      return bfd_mach_mips_xlr;
+    case AFL_EXT_INTERAPTIV_MR2: return bfd_mach_mips_interaptiv_mr2;
     default:		      return bfd_mach_mips3000;
     }
 }
Index: binutils-gdb/elfcpp/mips.h
===================================================================
--- binutils-gdb.orig/elfcpp/mips.h
+++ binutils-gdb/elfcpp/mips.h
@@ -228,6 +228,7 @@ enum
   EF_MIPS_MACH_OCTEON3 = 0x008e0000,
   EF_MIPS_MACH_5400 = 0x00910000,
   EF_MIPS_MACH_5900 = 0x00920000,
+  EF_MIPS_MACH_IAMR2 = 0x00930000,
   EF_MIPS_MACH_5500 = 0x00980000,
   EF_MIPS_MACH_9000 = 0x00990000,
   EF_MIPS_MACH_LS2E = 0x00A00000,
@@ -251,6 +252,7 @@ enum
   E_MIPS_MACH_OCTEON3 = EF_MIPS_MACH_OCTEON3,
   E_MIPS_MACH_5400    = EF_MIPS_MACH_5400,
   E_MIPS_MACH_5900    = EF_MIPS_MACH_5900,
+  E_MIPS_MACH_IAMR2   = EF_MIPS_MACH_IAMR2,
   E_MIPS_MACH_5500    = EF_MIPS_MACH_5500,
   E_MIPS_MACH_9000    = EF_MIPS_MACH_9000,
   E_MIPS_MACH_LS2E    = EF_MIPS_MACH_LS2E,
@@ -387,7 +389,9 @@ enum
   // ST Microelectronics Loongson 2F.
   AFL_EXT_LOONGSON_2F = 18,
   // Cavium Networks Octeon3.
-  AFL_EXT_OCTEON3 = 19
+  AFL_EXT_OCTEON3 = 19,
+  // Imagination interAptiv MR2.
+  AFL_EXT_INTERAPTIV_MR2 = 20
 };
 
 // Masks for the flags1 word of an ABI flags structure.
Index: binutils-gdb/gold/mips.cc
===================================================================
--- binutils-gdb.orig/gold/mips.cc
+++ binutils-gdb/gold/mips.cc
@@ -3990,6 +3990,7 @@ class Target_mips : public Sized_target<
     mach_mips_octeon2         = 6502,
     mach_mips_octeon3         = 6503,
     mach_mips_xlr             = 887682,   // decimal 'XLR'
+    mach_mips_interaptiv_mr2  = 736550,   // decimal 'IA2'
     mach_mipsisa32            = 32,
     mach_mipsisa32r2          = 33,
     mach_mipsisa32r3          = 34,
@@ -4196,6 +4197,9 @@ class Target_mips : public Sized_target<
     this->add_extension(mach_mips4100, mach_mips4000);
     this->add_extension(mach_mips5900, mach_mips4000);
 
+    // MIPS32r2 extensions.
+    this->add_extension(mach_mips_interaptiv_mr2, mach_mipsisa32r2);
+
     // MIPS32 extensions.
     this->add_extension(mach_mipsisa32r2, mach_mipsisa32);
 
@@ -8920,6 +8924,9 @@ Target_mips<size, big_endian>::elf_mips_
     case elfcpp::EF_MIPS_MACH_XLR:
       return mach_mips_xlr;
 
+    case elfcpp::EF_MIPS_MACH_IAMR2:
+      return mach_mips_interaptiv_mr2;
+
     default:
       switch (flags & elfcpp::EF_MIPS_ARCH)
         {
@@ -9024,6 +9031,9 @@ Target_mips<size, big_endian>::mips_isa_
     case elfcpp::AFL_EXT_XLR:
       return mach_mips_xlr;
 
+    case elfcpp::AFL_EXT_INTERAPTIV_MR2:
+      return mach_mips_interaptiv_mr2;
+
     default:
       return mach_mips3000;
     }
@@ -9091,6 +9101,9 @@ Target_mips<size, big_endian>::mips_isa_
     case mach_mips_xlr:
       return elfcpp::AFL_EXT_XLR;
 
+    case mach_mips_interaptiv_mr2:
+      return elfcpp::AFL_EXT_INTERAPTIV_MR2;
+
     default:
       return 0;
     }
@@ -12596,6 +12609,8 @@ Target_mips<size, big_endian>::elf_mips_
       return "mips:octeon3";
     case elfcpp::EF_MIPS_MACH_XLR:
       return "mips:xlr";
+    case elfcpp::EF_MIPS_MACH_IAMR2:
+      return "mips:interaptiv-mr2";
     default:
       switch (e_flags & elfcpp::EF_MIPS_ARCH)
         {


More information about the Binutils mailing list