[PATCH v2 06/13] LD/PE: Remove remains of MIPS target support

Jan Beulich jbeulich@suse.com
Fri Aug 29 11:59:47 GMT 2025


From: Maciej W. Rozycki <macro@orcam.me.uk>

Support for ECOFF MIPS targets, including `mips*-*-pe*' among others, 
has been removed from GAS and LD with commit e8044f355dc9 ("Remove gas 
and ld support for MIPS ECOFF"), 
<https://inbox.sourceware.org/binutils/8761x65bzx.fsf@talisman.default/>.
However bits in PEI-format DLL support code have been left behind.

Remove the relevant pieces then, originally from commit 344a211f9995 
("Add support for WinCE based toolchains."), including MIPS architecture 
parts and HIGHADJ relocation support in particular.
---
v2 Integrate into series. Retain code generating LOW relocs.

--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
@@ -247,10 +247,9 @@ static const autofilter_entry_type autof
 
 #define PE_ARCH_i386	 1
 #define PE_ARCH_sh	 2
-#define PE_ARCH_mips	 3
-#define PE_ARCH_arm	 4
-#define PE_ARCH_arm_wince 5
-#define PE_ARCH_aarch64  6
+#define PE_ARCH_arm	 3
+#define PE_ARCH_arm_wince 4
+#define PE_ARCH_aarch64	 5
 
 /* Don't make it constant as underscore mode gets possibly overriden
    by target or -(no-)leading-underscore option.  */
@@ -317,16 +316,6 @@ static pe_details_type pe_detail_list[]
     autofilter_symbollist_generic
   },
   {
-    "pei-mips",
-    "pe-mips",
-    34 /* MIPS_R_RVA */,
-    ~0, 0, ~0, /* none */
-    PE_ARCH_mips,
-    bfd_arch_mips,
-    false,
-    autofilter_symbollist_generic
-  },
-  {
     "pei-arm-little",
     "pe-arm-little",
     11 /* ARM_RVA32 */,
@@ -1703,15 +1692,6 @@ generate_reloc (bfd *abfd, struct bfd_li
 		      reloc_data[total_relocs].type = IMAGE_REL_BASED_LOW;
 		      total_relocs++;
 		      break;
-		    case BITS_AND_SHIFT (16, 16):
-		      reloc_data[total_relocs].type = IMAGE_REL_BASED_HIGHADJ;
-		      /* FIXME: we can't know the symbol's right value
-			 yet, but we probably can safely assume that
-			 CE will relocate us in 64k blocks, so leaving
-			 it zero is safe.  */
-		      reloc_data[total_relocs].extra = 0;
-		      total_relocs++;
-		      break;
 		    case BITS_AND_SHIFT (26, 2):
 		      reloc_data[total_relocs].type =
                         IMAGE_REL_BASED_ARM_MOV32;
@@ -1765,9 +1745,6 @@ generate_reloc (bfd *abfd, struct bfd_li
 	}
 
       reloc_sz += 2;
-
-      if (reloc_data[i].type == IMAGE_REL_BASED_HIGHADJ)
-	reloc_sz += 2;
     }
 
   reloc_sz = (reloc_sz + 3) & ~3;	/* 4-byte align.  */
@@ -2314,18 +2291,6 @@ static const unsigned char jmp_sh_bytes[
   0x01, 0xd0, 0x02, 0x60, 0x2b, 0x40, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00
 };
 
-/* _function:
-	lui	$t0,<high:__imp_function>
-	lw	$t0,<low:__imp_function>
-	jr	$t0
-	nop                              */
-
-static const unsigned char jmp_mips_bytes[] =
-{
-  0x00, 0x00, 0x08, 0x3c,  0x00, 0x00, 0x08, 0x8d,
-  0x08, 0x00, 0x00, 0x01,  0x00, 0x00, 0x00, 0x00
-};
-
 static const unsigned char jmp_arm_bytes[] =
 {
   0x00, 0xc0, 0x9f, 0xe5,	/* ldr  ip, [pc] */
@@ -2388,10 +2353,6 @@ make_one (def_file_export *exp, bfd *par
 	  jmp_bytes = jmp_sh_bytes;
 	  jmp_byte_count = sizeof (jmp_sh_bytes);
 	  break;
-	case PE_ARCH_mips:
-	  jmp_bytes = jmp_mips_bytes;
-	  jmp_byte_count = sizeof (jmp_mips_bytes);
-	  break;
 	case PE_ARCH_arm:
 	case PE_ARCH_arm_wince:
 	  jmp_bytes = jmp_arm_bytes;
@@ -2478,11 +2439,6 @@ make_one (def_file_export *exp, bfd *par
 	case PE_ARCH_sh:
 	  quick_reloc (abfd, 8, BFD_RELOC_32, 2);
 	  break;
-	case PE_ARCH_mips:
-	  quick_reloc (abfd, 0, BFD_RELOC_HI16_S, 2);
-	  quick_reloc (abfd, 0, BFD_RELOC_LO16, 0); /* MIPS_R_PAIR */
-	  quick_reloc (abfd, 4, BFD_RELOC_LO16, 2);
-	  break;
 	case PE_ARCH_arm:
 	case PE_ARCH_arm_wince:
 	  quick_reloc (abfd, 8, BFD_RELOC_32, 2);



More information about the Binutils mailing list