[clang] [Clang][MIPS] Send correct architecture for MinGW toolchains (PR #121042)

Hervé Poussineau via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 24 01:04:21 PST 2024


https://github.com/hpoussin created https://github.com/llvm/llvm-project/pull/121042

'mipspe' name was chosen by binutils, when the project was able to create executables for Windows CE/MIPS.

>From 932c9cea721b45ffeee2e3f77be903241beab33a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= <hpoussin at reactos.org>
Date: Fri, 10 Nov 2023 23:09:05 +0100
Subject: [PATCH] [Clang][MIPS] Send correct architecture for MinGW toolchains

'mipspe' name was chosen by binutils, when the project was able to create
executables for Windows CE/MIPS.
---
 clang/lib/Driver/ToolChains/MinGW.cpp | 3 +++
 clang/test/Driver/mingw.cpp           | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/clang/lib/Driver/ToolChains/MinGW.cpp b/clang/lib/Driver/ToolChains/MinGW.cpp
index 963de81027ca9f..9f0c6160a309ec 100644
--- a/clang/lib/Driver/ToolChains/MinGW.cpp
+++ b/clang/lib/Driver/ToolChains/MinGW.cpp
@@ -138,6 +138,9 @@ void tools::MinGW::Linker::ConstructJob(Compilation &C, const JobAction &JA,
     else
       CmdArgs.push_back("arm64pe");
     break;
+  case llvm::Triple::mipsel:
+    CmdArgs.push_back("mipspe");
+    break;
   default:
     D.Diag(diag::err_target_unknown_triple) << TC.getEffectiveTriple().str();
   }
diff --git a/clang/test/Driver/mingw.cpp b/clang/test/Driver/mingw.cpp
index 9790c86a364f85..66da0c97f41668 100644
--- a/clang/test/Driver/mingw.cpp
+++ b/clang/test/Driver/mingw.cpp
@@ -85,6 +85,10 @@
 // RUN:   | FileCheck %s --check-prefix CHECK_MINGW_EC_LINK
 // CHECK_MINGW_EC_LINK: "-m" "arm64ecpe"
 
+// RUN: %clang --target=mipsel-windows-gnu -### -o /dev/null %s 2>&1 \
+// RUN:   | FileCheck %s --check-prefix CHECK_MINGW_MIPSPE
+// CHECK_MINGW_MIPSPE: "-m" "mipspe"
+
 // RUN: %clang --target=i686-windows-gnu -fms-hotpatch -### -- %s 2>&1 \
 // RUN:    | FileCheck %s --check-prefix=FUNCTIONPADMIN
 // FUNCTIONPADMIN: "--functionpadmin"



More information about the cfe-commits mailing list