Skip to content

Commit c6ba7b3

Browse files
authored
[Triple] Make mipsel-*-windows-* use COFF files by default (#107809)
Windows NT/MIPS and Windows CE/MIPS always used COFF format. This is an extract of PR #107744.
1 parent 784230b commit c6ba7b3

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

llvm/lib/TargetParser/Triple.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,6 @@ static Triple::ObjectFormatType getDefaultFormat(const Triple &T) {
925925
case Triple::mips64:
926926
case Triple::mips64el:
927927
case Triple::mips:
928-
case Triple::mipsel:
929928
case Triple::msp430:
930929
case Triple::nvptx64:
931930
case Triple::nvptx:
@@ -950,6 +949,11 @@ static Triple::ObjectFormatType getDefaultFormat(const Triple &T) {
950949
case Triple::xtensa:
951950
return Triple::ELF;
952951

952+
case Triple::mipsel:
953+
if (T.isOSWindows())
954+
return Triple::COFF;
955+
return Triple::ELF;
956+
953957
case Triple::ppc64:
954958
case Triple::ppc:
955959
if (T.isOSAIX())

llvm/unittests/TargetParser/TripleTest.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2468,6 +2468,10 @@ TEST(TripleTest, NormalizeWindows) {
24682468
Triple::normalize("i686-pc-windows-elf-elf"));
24692469

24702470
EXPECT_TRUE(Triple("x86_64-pc-win32").isWindowsMSVCEnvironment());
2471+
2472+
EXPECT_TRUE(Triple(Triple::normalize("mipsel-windows-msvccoff")).isOSBinFormatCOFF());
2473+
EXPECT_TRUE(Triple(Triple::normalize("mipsel-windows-msvc")).isOSBinFormatCOFF());
2474+
EXPECT_TRUE(Triple(Triple::normalize("mipsel-windows-gnu")).isOSBinFormatCOFF());
24712475
}
24722476

24732477
TEST(TripleTest, NormalizeAndroid) {

0 commit comments

Comments
 (0)