[clang] [lld] [llvm] [clang][MIPS] Add support for mipsel-windows-* targets (PR #107744)

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 9 02:06:03 PDT 2024


================
@@ -28,6 +28,8 @@ COFF::MachineTypes llvm::getMachineType(StringRef S) {
       .Case("arm64", COFF::IMAGE_FILE_MACHINE_ARM64)
       .Case("arm64ec", COFF::IMAGE_FILE_MACHINE_ARM64EC)
       .Case("arm64x", COFF::IMAGE_FILE_MACHINE_ARM64X)
+      .Case("mips", COFF::IMAGE_FILE_MACHINE_R4000) // also handle mips (big-endian) because we want to support '/machine:MIPS'
+      .Case("mipsel", COFF::IMAGE_FILE_MACHINE_R4000)
----------------
mstorsjo wrote:

I don't think we should accept `mipsel` here, and the comment about big-endian above feels confusing/misleading.

This switch is only for mapping arch names from the MS tool `/machine:` flags, to the corresponding `COFF::IMAGE_FILE_MACHINE_*` values. I presume that no MS tool ever accepted `/machine:mipsel` right? Then we don't need that value here. And as all Windows/COFF MIPS was little-endian (I presume) we don't need claim anything to be big endian.

It's just that arch names in different namespaces can mean different things. In MS tools, `/machine:mips` unambiguously means little endian mips, while the corresponding thing in a triple is `mipsel-*`.

https://github.com/llvm/llvm-project/pull/107744


More information about the cfe-commits mailing list