Skip to content

Conversation

hpoussin
Copy link
Contributor

@hpoussin hpoussin commented Sep 6, 2025

When compiling for target mipsel-windows-gnu triple, clang is calling linker with mipspe machine.
Handle this case.

@llvmbot
Copy link
Member

llvmbot commented Sep 6, 2025

@llvm/pr-subscribers-lld-elf
@llvm/pr-subscribers-lld-macho

@llvm/pr-subscribers-lld

Author: Hervé Poussineau (hpoussin)

Changes

When compiling for target mipsel-windows-gnu triple, clang is calling linker with mipspe machine.
Handle this case.


Full diff: https://github.com/llvm/llvm-project/pull/157305.diff

2 Files Affected:

  • (modified) lld/Common/DriverDispatcher.cpp (+1-1)
  • (modified) lld/test/MinGW/driver.test (+1)
diff --git a/lld/Common/DriverDispatcher.cpp b/lld/Common/DriverDispatcher.cpp
index 34f0ed24b3df0..7c5f1cd3692ef 100644
--- a/lld/Common/DriverDispatcher.cpp
+++ b/lld/Common/DriverDispatcher.cpp
@@ -45,7 +45,7 @@ static cl::TokenizerCallback getDefaultQuotingStyle() {
 
 static bool isPETargetName(StringRef s) {
   return s == "i386pe" || s == "i386pep" || s == "thumb2pe" || s == "arm64pe" ||
-         s == "arm64ecpe" || s == "arm64xpe";
+         s == "arm64ecpe" || s == "arm64xpe" || s == "mipspe";
 }
 
 static std::optional<bool> isPETarget(llvm::ArrayRef<const char *> args) {
diff --git a/lld/test/MinGW/driver.test b/lld/test/MinGW/driver.test
index 618b888504320..47809d8a87495 100644
--- a/lld/test/MinGW/driver.test
+++ b/lld/test/MinGW/driver.test
@@ -296,6 +296,7 @@ RUN: not ld.lld -m i386pep --foo 2>&1 | FileCheck -check-prefix UNKNOWN_ARG %s
 UNKNOWN_ARG: error: unknown argument: --foo
 
 RUN: not ld.lld -m i386pep 2>&1 | FileCheck -check-prefix NO_INPUT_FILES %s
+RUN: not ld.lld -m mipspe 2>&1 | FileCheck -check-prefix NO_INPUT_FILES %s
 NO_INPUT_FILES: error: no input files
 
 RUN: ld.lld -### -m i386pep foo.o 2>&1 | FileCheck -check-prefix ENABLE_AUTO_IMPORT %s

Copy link
Member

@mstorsjo mstorsjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me.

Binutils did have some support for MIPS PE/COFF, which is being removed these days. Does this choice of name, mipspe, match what they used here? (The naming aspect here should ideally be synchronized, to allow for interoperability.)

@hpoussin
Copy link
Contributor Author

hpoussin commented Sep 8, 2025

Yes, this name was chosen by binutils linker.
It supported the mipspe target between versions 2.11 and 2.23
This name is now also used in clang: 8267bea

@mstorsjo
Copy link
Member

mstorsjo commented Sep 8, 2025

Yes, this name was chosen by binutils linker. It supported the mipspe target between versions 2.11 and 2.23 This name is now also used in clang: 8267bea

Thanks for confirming!

Copy link
Member

@mstorsjo mstorsjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mstorsjo mstorsjo merged commit 0fb2f52 into llvm:main Sep 8, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants