[llvm] [Triple] Make mipsel-*-windows-* use COFF files by default (PR #107809)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 17 12:56:15 PDT 2024
https://github.com/hpoussin updated https://github.com/llvm/llvm-project/pull/107809
>From e1d893ff57272b2c23b21affa2b1c5bb7d2f68fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= <hpoussin at reactos.org>
Date: Sun, 22 Oct 2023 07:19:08 +0200
Subject: [PATCH] [Triple] Make mipsel-*-windows-* use COFF files by default
Windows NT/MIPS and Windows CE/MIPS always used COFF format.
---
llvm/lib/TargetParser/Triple.cpp | 6 +++++-
llvm/unittests/TargetParser/TripleTest.cpp | 4 ++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp
index 55911a7d71ac70..18e2d4fa465f8f 100644
--- a/llvm/lib/TargetParser/Triple.cpp
+++ b/llvm/lib/TargetParser/Triple.cpp
@@ -905,7 +905,6 @@ static Triple::ObjectFormatType getDefaultFormat(const Triple &T) {
case Triple::mips64:
case Triple::mips64el:
case Triple::mips:
- case Triple::mipsel:
case Triple::msp430:
case Triple::nvptx64:
case Triple::nvptx:
@@ -930,6 +929,11 @@ static Triple::ObjectFormatType getDefaultFormat(const Triple &T) {
case Triple::xtensa:
return Triple::ELF;
+ case Triple::mipsel:
+ if (T.isOSWindows())
+ return Triple::COFF;
+ return Triple::ELF;
+
case Triple::ppc64:
case Triple::ppc:
if (T.isOSAIX())
diff --git a/llvm/unittests/TargetParser/TripleTest.cpp b/llvm/unittests/TargetParser/TripleTest.cpp
index 0aecfc64da2080..23407c191a94cb 100644
--- a/llvm/unittests/TargetParser/TripleTest.cpp
+++ b/llvm/unittests/TargetParser/TripleTest.cpp
@@ -2302,6 +2302,10 @@ TEST(TripleTest, NormalizeWindows) {
Triple::normalize("i686-pc-windows-elf-elf"));
EXPECT_TRUE(Triple("x86_64-pc-win32").isWindowsMSVCEnvironment());
+
+ EXPECT_TRUE(Triple(Triple::normalize("mipsel-windows-msvccoff")).isOSBinFormatCOFF());
+ EXPECT_TRUE(Triple(Triple::normalize("mipsel-windows-msvc")).isOSBinFormatCOFF());
+ EXPECT_TRUE(Triple(Triple::normalize("mipsel-windows-gnu")).isOSBinFormatCOFF());
}
TEST(TripleTest, NormalizeAndroid) {
More information about the llvm-commits
mailing list